|
1 // |reftest| random -- bug 524788 |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 |
|
8 //----------------------------------------------------------------------------- |
|
9 var BUGNUMBER = 363258; |
|
10 var summary = 'Timer resolution'; |
|
11 var actual = ''; |
|
12 var expect = ''; |
|
13 |
|
14 |
|
15 //----------------------------------------------------------------------------- |
|
16 test(); |
|
17 //----------------------------------------------------------------------------- |
|
18 |
|
19 function test() |
|
20 { |
|
21 enterFunc ('test'); |
|
22 printBugNumber(BUGNUMBER); |
|
23 printStatus (summary); |
|
24 |
|
25 var start = 0; |
|
26 var stop = 0; |
|
27 var i; |
|
28 var limit = 0; |
|
29 var incr = 10; |
|
30 var resolution = 5; |
|
31 |
|
32 while (stop - start == 0) |
|
33 { |
|
34 limit += incr; |
|
35 start = Date.now(); |
|
36 for (i = 0; i < limit; i++) {} |
|
37 stop = Date.now(); |
|
38 } |
|
39 |
|
40 print('limit=' + limit + ', resolution=' + resolution + ', time=' + (stop - start)); |
|
41 |
|
42 expect = true; |
|
43 actual = (stop - start <= resolution); |
|
44 |
|
45 reportCompare(expect, actual, summary); |
|
46 |
|
47 exitFunc ('test'); |
|
48 } |