@@ -89,8 +89,12 @@ class ClangTidy {
89
89
final StringSink _outSink;
90
90
final StringSink _errSink;
91
91
92
+ late final DateTime _startTime;
93
+
92
94
/// Runs clang-tidy on the repo as specified by the [Options] .
93
95
Future <int > run () async {
96
+ _startTime = DateTime .now ();
97
+
94
98
if (options.help) {
95
99
options.printUsage ();
96
100
return 0 ;
@@ -340,8 +344,20 @@ class ClangTidy {
340
344
341
345
Future <int > _runJobs (List <WorkerJob > jobs) async {
342
346
int result = 0 ;
343
- final ProcessPool pool = ProcessPool ();
347
+ final Set <String > pendingJobs = < String > {for (final WorkerJob job in jobs) job.name};
348
+
349
+ void reporter (int totalJobs, int completed, int inProgress, int pending, int failed) {
350
+ return _logWithTimestamp (ProcessPool .defaultReportToString (
351
+ totalJobs, completed, inProgress, pending, failed));
352
+ }
353
+
354
+ final ProcessPool pool = ProcessPool (printReport: reporter);
344
355
await for (final WorkerJob job in pool.startWorkers (jobs)) {
356
+ pendingJobs.remove (job.name);
357
+ if (pendingJobs.isNotEmpty && pendingJobs.length <= 3 ) {
358
+ final List <String > sortedJobs = pendingJobs.toList ()..sort ();
359
+ _logWithTimestamp ('Still running: $sortedJobs ' );
360
+ }
345
361
if (job.result.exitCode == 0 ) {
346
362
continue ;
347
363
}
@@ -358,4 +374,10 @@ class ClangTidy {
358
374
}
359
375
return result;
360
376
}
377
+
378
+ void _logWithTimestamp (String message) {
379
+ final Duration elapsedTime = DateTime .now ().difference (_startTime);
380
+ final String seconds = (elapsedTime.inSeconds % 60 ).toString ().padLeft (2 , '0' );
381
+ _outSink.writeln ('[${elapsedTime .inMinutes }:$seconds ] $message ' );
382
+ }
361
383
}
0 commit comments