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

Unified Diff: tools/full-coverage.dart

Issue 140303008: Fairly partition work in tools/full-coverage.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/full-coverage.dart
diff --git a/tools/full-coverage.dart b/tools/full-coverage.dart
index 0fe6e6fed2ee18d820cf401e27073d8dd7411310..bafc0d1b5aa7b02adfe96770a863e4fbca9335ee 100644
--- a/tools/full-coverage.dart
+++ b/tools/full-coverage.dart
@@ -271,7 +271,7 @@ worker(WorkMessage msg) {
if (env["verbose"]) {
final end = new DateTime.now().millisecondsSinceEpoch;
- print("${msg.workerName}: Finished processing files. "
+ print("${msg.workerName}: Finished processing ${files.length} files. "
"Took ${end - start} ms.");
}
@@ -295,17 +295,16 @@ class ResultMessage {
final env = new Environment();
List<List> split(List list, int nBuckets) {
- // Leftover goes in the last bucket.
- // TODO(16505): Do a fair split.
var buckets = new List(nBuckets);
var bucketSize = list.length ~/ nBuckets;
+ var leftover = list.length % nBuckets;
var taken = 0;
+ var start = 0;
for (int i = 0; i < nBuckets; i++) {
- bool lastBucket = i + 1 == nBuckets;
- var start = i * bucketSize;
- var end = lastBucket ? list.length : start + bucketSize ;
+ var end = (i < leftover) ? (start + bucketSize + 1) : (start + bucketSize);
buckets[i] = list.sublist(start, end);
taken += buckets[i].length;
+ start = end;
}
if (taken != list.length) throw "Error splitting";
return buckets;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698