Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: chrome/browser/resources/file_manager/js/metrics.js

Issue 8490014: [filebrowser] Historgram for the file browser's open time. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Utility methods for accessing chrome.experimental.metrics API.
7 *
8 * To be included as a first script in main.html
9 */
10
11 var metrics = {};
12
13 metrics.intervals = {};
14
15 metrics.startInterval = function(name) {
16 metrics.intervals[name] = Date.now();
17 };
18
19 metrics.startInterval('TotalLoad');
20 metrics.startInterval('ScriptParse');
21
22 metrics.convertName_ = function(name) {
23 // chrome.experimental.metrics will append extension ID after the last dot.
24 return 'FileBrowser.' + name + '.';
25 };
26
27 metrics.recordTime = function(name) {
28 if (name in metrics.intervals) {
29 var elapsed = Date.now() - metrics.intervals[name];
30 console.log(name + ': ' + elapsed + 'ms');
SeRya 2011/11/07 13:29:23 I think we we shouldn't litter in the common log b
Vladislav Kaznacheev 2011/11/08 11:06:20 I suggest keeping this for the time being because
31 chrome.experimental.metrics.recordTime(metrics.convertName_(name), elapsed);
32 } else {
33 console.error('Unknown interval: ' + name);
34 }
35 };
36
37 metrics.recordAction = function(name) {
38 chrome.experimental.metrics.recordUserAction(metrics.convertName_(name));
39 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698