@@ -436,21 +436,32 @@ private static (bool success, List<ExecuteResult> executeResults, GcStats gcStat
436
436
. Where ( r => r . IterationMode != IterationMode . Unknown )
437
437
. ToArray ( ) ;
438
438
439
- if ( ! measurements . Any ( ) )
439
+ if ( ! measurements . Any ( measurement => measurement . IsWorkload ( ) ) )
440
440
{
441
441
// Something went wrong during the benchmark, don't bother doing more runs
442
442
logger . WriteLineError ( "No more Benchmark runs will be launched as NO measurements were obtained from the previous run!" ) ;
443
443
success = false ;
444
444
break ;
445
445
}
446
446
447
+ if ( ! success && benchmarkCase . Config . Options . IsSet ( ConfigOptions . StopOnFirstError ) )
448
+ {
449
+ break ;
450
+ }
451
+
447
452
if ( useDiagnoser )
448
453
{
449
454
if ( benchmarkCase . Config . HasMemoryDiagnoser ( ) )
450
- gcStats = GcStats . Parse ( executeResult . Data . Last ( line => ! string . IsNullOrEmpty ( line ) && line . StartsWith ( GcStats . ResultsLinePrefix ) ) ) ;
455
+ {
456
+ string resultsLine = executeResult . Data . LastOrDefault ( line => ! string . IsNullOrEmpty ( line ) && line . StartsWith ( GcStats . ResultsLinePrefix ) ) ;
457
+ gcStats = resultsLine is not null ? GcStats . Parse ( resultsLine ) : default ;
458
+ }
451
459
452
460
if ( benchmarkCase . Config . HasThreadingDiagnoser ( ) )
453
- threadingStats = ThreadingStats . Parse ( executeResult . Data . Last ( line => ! string . IsNullOrEmpty ( line ) && line . StartsWith ( ThreadingStats . ResultsLinePrefix ) ) ) ;
461
+ {
462
+ string resultsLine = executeResult . Data . LastOrDefault ( line => ! string . IsNullOrEmpty ( line ) && line . StartsWith ( ThreadingStats . ResultsLinePrefix ) ) ;
463
+ threadingStats = resultsLine is not null ? ThreadingStats . Parse ( resultsLine ) : default ;
464
+ }
454
465
455
466
metrics . AddRange (
456
467
noOverheadCompositeDiagnoser . ProcessResults (
@@ -465,17 +476,12 @@ private static (bool success, List<ExecuteResult> executeResults, GcStats gcStat
465
476
double percent = overheadApprox / workloadApprox * 100 ;
466
477
launchCount = ( int ) Math . Round ( Math . Max ( 2 , 2 + ( percent - 1 ) / 3 ) ) ; // an empirical formula
467
478
}
468
-
469
- if ( ! success && benchmarkCase . Config . Options . IsSet ( ConfigOptions . StopOnFirstError ) )
470
- {
471
- break ;
472
- }
473
479
}
474
480
logger . WriteLine ( ) ;
475
481
476
482
// Do a "Diagnostic" run, but DISCARD the results, so that the overhead of Diagnostics doesn't skew the overall results
477
483
var extraRunCompositeDiagnoser = benchmarkCase . Config . GetCompositeDiagnoser ( benchmarkCase , Diagnosers . RunMode . ExtraRun ) ;
478
- if ( extraRunCompositeDiagnoser != null )
484
+ if ( extraRunCompositeDiagnoser != null && success )
479
485
{
480
486
logger . WriteLineInfo ( "// Run, Diagnostic" ) ;
481
487
@@ -499,7 +505,7 @@ private static (bool success, List<ExecuteResult> executeResults, GcStats gcStat
499
505
}
500
506
501
507
var separateLogicCompositeDiagnoser = benchmarkCase . Config . GetCompositeDiagnoser ( benchmarkCase , Diagnosers . RunMode . SeparateLogic ) ;
502
- if ( separateLogicCompositeDiagnoser != null )
508
+ if ( separateLogicCompositeDiagnoser != null && success )
503
509
{
504
510
logger . WriteLineInfo ( "// Run, Diagnostic [SeparateLogic]" ) ;
505
511
0 commit comments