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

Side by Side Diff: samples/third_party/dromaeo/tests/RunnerSuite.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 months 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
« no previous file with comments | « samples/third_party/dromaeo/common/BenchUtil.dart ('k') | samples/time/time_server.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of dromaeo; 1 part of dromaeo;
2 2
3 typedef void Test(); 3 typedef void Test();
4 typedef void Operation(); 4 typedef void Operation();
5 typedef void Reporter(Map<String, Result> results); 5 typedef void Reporter(Map<String, Result> results);
6 6
7 class Suite { 7 class Suite {
8 /** 8 /**
9 * Ctor. 9 * Ctor.
10 * [:_window:] The window of the suite. 10 * [:_window:] The window of the suite.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // List of number of runs in seconds. 49 // List of number of runs in seconds.
50 List<double> runsPerSecond = new List<double>(); 50 List<double> runsPerSecond = new List<double>();
51 51
52 // Run the test several times. 52 // Run the test several times.
53 try { 53 try {
54 // TODO(antonm): use .setTimeout to schedule next run as JS 54 // TODO(antonm): use .setTimeout to schedule next run as JS
55 // version does. That allows to report the intermidiate results 55 // version does. That allows to report the intermidiate results
56 // more smoothly as well. 56 // more smoothly as well.
57 for (int i = 0; i < _N_RUNS; i++) { 57 for (int i = 0; i < _N_RUNS; i++) {
58 int runs = 0; 58 int runs = 0;
59 final int start = new Date.now().millisecondsSinceEpoch; 59 final int start = new DateTime.now().millisecondsSinceEpoch;
60 60
61 int cur = new Date.now().millisecondsSinceEpoch; 61 int cur = new DateTime.now().millisecondsSinceEpoch;
62 while ((cur - start) < 1000) { 62 while ((cur - start) < 1000) {
63 test_(); 63 test_();
64 cur = new Date.now().millisecondsSinceEpoch; 64 cur = new DateTime.now().millisecondsSinceEpoch;
65 runs++; 65 runs++;
66 } 66 }
67 67
68 runsPerSecond.add((runs * 1000.0) / (cur - start)); 68 runsPerSecond.add((runs * 1000.0) / (cur - start));
69 } 69 }
70 } catch (exception, stacktrace) { 70 } catch (exception, stacktrace) {
71 _window.alert('Exception ${exception}: ${stacktrace}'); 71 _window.alert('Exception ${exception}: ${stacktrace}');
72 return; 72 return;
73 } 73 }
74 _reportTestResults(name, new Result(runsPerSecond)); 74 _reportTestResults(name, new Result(runsPerSecond));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 List<Operation> _operations; 124 List<Operation> _operations;
125 int _nTests; 125 int _nTests;
126 int _nRanTests; 126 int _nRanTests;
127 127
128 Suite _addOperation(Operation operation) { 128 Suite _addOperation(Operation operation) {
129 _operations.add(operation); 129 _operations.add(operation);
130 return this; 130 return this;
131 } 131 }
132 } 132 }
OLDNEW
« no previous file with comments | « samples/third_party/dromaeo/common/BenchUtil.dart ('k') | samples/time/time_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698