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

Side by Side Diff: client/dom/benchmarks/dromaeo/tests/Common.dart

Issue 9374026: Move dromaeo to third_party (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved Dromaeo to third party. Created 8 years, 10 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
OLDNEW
(Empty)
1 class Result {
2 int get runs() { return _sorted.length; }
3
4 double get sum() {
5 double result = 0.0;
6 _sorted.forEach((double e) { result += e; });
7 return result;
8 }
9
10 double get min() { return _sorted[0]; }
11 double get max() { return _sorted[runs - 1]; }
12
13 double get mean() { return sum / runs; }
14
15 double get median() {
16 return (runs % 2 == 0) ?
17 (_sorted[runs ~/ 2] + _sorted[runs ~/ 2 + 1]) / 2 : _sorted[runs ~/ 2];
18 }
19
20 double get variance() {
21 double m = mean;
22 double result = 0.0;
23 _sorted.forEach((double e) { result += Math.pow(e - m, 2.0); });
24 return result / (runs - 1);
25 }
26
27 double get deviation() { return Math.sqrt(variance); }
28
29 // Compute Standard Errors Mean
30 double get sem() { return (deviation / Math.sqrt(runs)) * T_DISTRIBUTION; }
31
32 double get error() { return (sem / mean) * 100; }
33
34 // TODO: Implement writeOn.
35 String toString() {
36 return '[Result: mean = ${mean}]';
37 }
38
39 factory Result(List<double> runsPerSecond) {
40 runsPerSecond.sort(int _(double a, double b) => a.compareTo(b));
41 return new Result._internal(runsPerSecond);
42 }
43
44 Result._internal(this._sorted) {}
45
46 List<double> _sorted;
47
48 // Populated from: http://www.medcalc.be/manual/t-distribution.php
49 // 95% confidence for N - 1 = 4
50 static final double T_DISTRIBUTION = 2.776;
51 }
OLDNEW
« no previous file with comments | « client/dom/benchmarks/dromaeo/test-tail.html ('k') | client/dom/benchmarks/dromaeo/tests/RunnerSuite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698