#pragma once #include #include #include struct cluster * the_benchmark_cluster = 0p; struct BenchCluster { cluster self; }; void ?{}( BenchCluster & this, int flags ) { (this.self){ "Benchmark Cluster", flags }; assert( the_benchmark_cluster == 0p ); the_benchmark_cluster = &this.self; } struct BenchProc { processor self; }; void ?{}( BenchProc & this ) { assert( the_benchmark_cluster != 0p ); (this.self){ "Benchmark Processor", *the_benchmark_cluster }; } void wait(double duration, Time & start, Time & end, bool is_tty) { for() { sleep(100`ms); end = getTimeNsec(); Duration delta = end - start; if(is_tty) { printf("\r%.1f", delta`ds); fflush(stdout); } if( delta >= duration`s ) { break; } } }