OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Utility methods for measuring loading times. | 6 * @fileoverview Utility methods for measuring loading times. |
7 * | 7 * |
8 * To be included as a first script in main.html | 8 * To be included as a first script in main.html |
9 */ | 9 */ |
10 | 10 |
| 11 /** |
| 12 * measureTime class |
| 13 * @constructor |
| 14 */ |
11 var measureTime = { | 15 var measureTime = { |
12 isEnabled: localStorage.measureTimeEnabled, | 16 isEnabled: localStorage.measureTimeEnabled, |
13 | 17 |
14 startInterval: function(name) { | 18 startInterval: function(name) { |
15 if (this.isEnabled) | 19 if (this.isEnabled) |
16 console.time(name); | 20 console.time(name); |
17 }, | 21 }, |
18 | 22 |
19 recordInterval: function(name) { | 23 recordInterval: function(name) { |
20 if (this.isEnabled) | 24 if (this.isEnabled) |
21 console.timeEnd(name); | 25 console.timeEnd(name); |
22 }, | 26 }, |
23 }; | 27 }; |
24 | 28 |
25 measureTime.startInterval('Load.Total'); | 29 measureTime.startInterval('Load.Total'); |
26 measureTime.startInterval('Load.Script'); | 30 measureTime.startInterval('Load.Script'); |
OLD | NEW |