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

Side by Side Diff: benchmark/lib/suite.dart

Issue 1330723003: Implement a better dashboard for running benchmarks (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library protoc.benchmark.suite; 5 library protoc.benchmark.suite;
6 6
7 import "benchmark.dart"; 7 import "benchmark.dart";
8 import "benchmarks/int32_json.dart"; 8 import "benchmarks/int32_json.dart";
9 import "benchmarks/repeated_int32_json.dart"; 9 import "benchmarks/repeated_int32_json.dart";
10 import 'generated/benchmark.pb.dart' as pb; 10 import 'generated/benchmark.pb.dart' as pb;
(...skipping 16 matching lines...) Expand all
27 totalSamples += request.samples; 27 totalSamples += request.samples;
28 } 28 }
29 pb.Report progress() { 29 pb.Report progress() {
30 report.message = "Running ($sampleCount/$totalSamples)"; 30 report.message = "Running ($sampleCount/$totalSamples)";
31 return report.clone(); 31 return report.clone();
32 } 32 }
33 33
34 // Send first progress message before starting. 34 // Send first progress message before starting.
35 yield progress(); 35 yield progress();
36 36
37 // Fill in each response. 37 var benchmarks = <Benchmark>[];
38 for (var r in report.responses) { 38 for (var r in report.responses) {
39 var b = createBenchmark(r.request); 39 benchmarks.add(createBenchmark(r.request));
40 }
40 41
41 // Run the benchmark the requested number of times. 42 // Collect the requested number of samples.
42 for (pb.Sample s in b.measure(r.request)) { 43 while (sampleCount < totalSamples) {
43 r.samples.add(s); 44 for (var i = 0; i < benchmarks.length; i++) {
44 sampleCount++; 45 var b = benchmarks[i];
45 yield progress(); 46 var r = report.responses[i];
47 if (r.samples.length == r.request.samples) continue;
46 48
47 // Also send progress to the console. 49 for (pb.Sample s in b.measure(r.request, 1)) {
48 int usecsPerLoop = s.duration ~/ s.loopCount; 50 r.samples.add(s);
49 int kIntReadsPerSecond = s.counts.int32Reads * 1000 ~/ s.duration; 51 sampleCount++;
50 print("${b.summary} time: $usecsPerLoop us," 52 yield progress();
51 " throughput: ${kIntReadsPerSecond}k int32 reads/sec"); 53
54 // Also send progress to the console.
55 int usecsPerLoop = s.duration ~/ s.loopCount;
56 int kIntReadsPerSecond = s.counts.int32Reads * 1000 ~/ s.duration;
57 print("${b.summary} time: $usecsPerLoop us,"
58 " throughput: ${kIntReadsPerSecond}k int32 reads/sec");
59 }
52 } 60 }
53 } 61 }
54 62
55 // Send final report. 63 // Send final report.
56 report.status = pb.Status.DONE; 64 report.status = pb.Status.DONE;
57 report.message = "Done"; 65 report.message = "Done";
58 yield report; 66 yield report;
59 } 67 }
60 68
61 /// Creates the appropriate Benchmark instance for a protobuf. 69 /// Creates the appropriate Benchmark instance for a protobuf.
(...skipping 11 matching lines...) Expand all
73 Map<pb.BenchmarkID, BenchmarkType> _makeTypeMap(List<BenchmarkType> types) { 81 Map<pb.BenchmarkID, BenchmarkType> _makeTypeMap(List<BenchmarkType> types) {
74 var out = <pb.BenchmarkID, BenchmarkType>{}; 82 var out = <pb.BenchmarkID, BenchmarkType>{};
75 for (var type in types) { 83 for (var type in types) {
76 if (out.containsKey(type.id)) { 84 if (out.containsKey(type.id)) {
77 throw "already added: $type.id.name"; 85 throw "already added: $type.id.name";
78 } 86 }
79 out[type.id] = type; 87 out[type.id] = type;
80 } 88 }
81 return new Map.unmodifiable(out); 89 return new Map.unmodifiable(out);
82 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698