#include #include #include #include "../bench.h" test_spinlock LOCKS; inline void lock( test_spinlock &a, test_spinlock &b ) { lock(a); lock(b); } inline void lock( test_spinlock &a, test_spinlock &b, test_spinlock &c, test_spinlock &d ) { lock(a); lock(b); lock(c); lock(d); } inline void lock( test_spinlock &a, test_spinlock &b, test_spinlock &c, test_spinlock &d, test_spinlock &e, test_spinlock &f, test_spinlock &g, test_spinlock &h ) { lock(a); lock(b); lock(c); lock(d); lock(e); lock(f); lock(g); lock(h); } inline void unlock( test_spinlock &a, test_spinlock &b ) { unlock(a); unlock(b); } inline void unlock( test_spinlock &a, test_spinlock &b, test_spinlock &c, test_spinlock &d ) { unlock(a); unlock(b); unlock(c); unlock(d); } inline void unlock( test_spinlock &a, test_spinlock &b, test_spinlock &c, test_spinlock &d, test_spinlock &e, test_spinlock &f, test_spinlock &g, test_spinlock &h ) { unlock(a); unlock(b); unlock(c); unlock(d); unlock(e); unlock(f); unlock(g); unlock(h); } bool done = false; uint64_t total = 0; thread worker {}; void main( worker & w ) { BENCH( lock( LOCKS ); unlock( LOCKS );, total, done ) } int main( int argc, char * argv[] ) { BENCH_START() processor p[threads]; // one extra for main thread { worker w[threads]; sleep( 10`s ); done = true; } printf( "%lu\n", total ); } // Local Variables: // // tab-width: 4 // // End: //