@@ -44,30 +44,37 @@ double readThroughput(std::string parseOutput) {
4444 return result / numResults;
4545}
4646
47- const double ERROR_MARGIN = 10 ; // 10%
48- const double INTERLEAVED_ATTEMPTS = 4 ;
47+ const double INTERLEAVED_ATTEMPTS = 6 ;
48+ const double PERCENT_DIFFERENCE_THRESHOLD = - 0.2 ;
4949
5050int main (int argc, char *argv[]) {
5151 if (argc != 3 ) {
52- std::cerr << " Usage: " << argv[0 ] << " <new parse cmd> <reference parse cmd>" ;
52+ std::cerr << " Usage: " << argv[0 ] << " <new parse cmd> <reference parse cmd>" << std::endl ;
5353 return 1 ;
5454 }
55- double newThroughput = 0 ;
56- double referenceThroughput = 0 ;
5755 for (int attempt=0 ; attempt < INTERLEAVED_ATTEMPTS; attempt++) {
58- newThroughput += readThroughput (exec (argv[1 ]));
59- referenceThroughput += readThroughput (exec (argv[2 ]));
60- }
61- newThroughput /= INTERLEAVED_ATTEMPTS;
62- referenceThroughput /= INTERLEAVED_ATTEMPTS;
56+ if (attempt > 0 ) {
57+ std::cout << " Running again to check whether it's a fluke ..." << std::endl;
58+ }
59+ std::cout << " Attempt #" << (attempt+1 ) << " of up to " << INTERLEAVED_ATTEMPTS << std::endl;
6360
64- std::cout << " New throughput: " << newThroughput << std::endl;
65- std::cout << " Ref throughput: " << referenceThroughput << std::endl;
66- double percentDifference = ((newThroughput / referenceThroughput) - 1.0 ) * 100 ;
67- std::cout << " Difference: " << percentDifference << " %" << std::endl;
68- if (percentDifference < -ERROR_MARGIN) {
69- std::cerr << " New throughput is more than " << ERROR_MARGIN << " % degraded from reference throughput!" << std::endl;
70- return 1 ;
61+ // Read new throughput
62+ double newThroughput = readThroughput (exec (argv[1 ]));
63+ std::cout << " New throughput: " << newThroughput << std::endl;
64+
65+ // Read reference throughput
66+ double referenceThroughput = readThroughput (exec (argv[2 ]));
67+ std::cout << " Ref throughput: " << referenceThroughput << std::endl;
68+
69+ // Check if % difference > 0
70+ double percentDifference = ((newThroughput / referenceThroughput) - 1.0 ) * 100 ;
71+ std::cout << " Difference: " << percentDifference << " %" << std::endl;
72+ if (percentDifference >= PERCENT_DIFFERENCE_THRESHOLD) {
73+ std::cout << " New throughput is same or better." << std::endl;
74+ return 0 ;
75+ } else {
76+ std::cout << " New throughput is lower!" ;
77+ }
7178 }
72- return 0 ;
79+ return 1 ;
7380}
0 commit comments