Changeset b4107c8 for benchmark/mutex
- Timestamp:
- Jan 7, 2020, 3:50:56 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 580c11b
- Parents:
- 846c026
- Location:
- benchmark/mutex
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified benchmark/mutex/JavaThread.java ¶
r846c026 rb4107c8 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("100000000");28 static private int times = Integer.parseInt("100000000"); 29 29 30 30 public synchronized void noop() { … … 35 35 // Inhibit biased locking ... 36 36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 37 for(int i = 1; i <= NoOfTimes; i += 1) {37 for(int i = 1; i <= times; i += 1) { 38 38 x = nextRandom(x); 39 39 j.noop(); … … 44 44 helper(); 45 45 long end = System.nanoTime(); 46 System.out.println( (end - start) / NoOfTimes );46 System.out.println( (end - start) / times ); 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 if ( args.length > 2 ) System.exit( 1 ); 50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 51 49 52 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 50 53 InnerMain(); … … 55 58 } 56 59 } 60 61 // Local Variables: // 62 // tab-width: 4 // 63 // End: // -
TabularUnified benchmark/mutex/cfa1.cfa ¶
r846c026 rb4107c8 7 7 void __attribute__((noinline)) call( M & mutex m ) {} 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 M m; 11 12 BENCH( 12 for ( i; n) {13 call( m);13 for ( i; times ) { 14 call( m ); 14 15 }, 15 16 result 16 17 ) 18 printf( "%g\n", result ); 19 } 17 20 18 printf("%g\n", result); 19 } 21 // Local Variables: // 22 // tab-width: 4 // 23 // End: // -
TabularUnified benchmark/mutex/cfa2.cfa ¶
r846c026 rb4107c8 7 7 void __attribute__((noinline)) call( M & mutex m1, M & mutex m2 ) {} 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 M m1, m2; 11 12 BENCH( 12 for ( i; n) {13 call( m1, m2);13 for ( i; times ) { 14 call( m1, m2 ); 14 15 }, 15 16 result 16 17 ) 18 printf( "%g\n", result ); 19 } 17 20 18 printf("%g\n", result); 19 } 21 // Local Variables: // 22 // tab-width: 4 // 23 // End: // -
TabularUnified benchmark/mutex/cfa4.cfa ¶
r846c026 rb4107c8 8 8 void __attribute__((noinline)) call( M & mutex m1, M & mutex m2, M & mutex m3, M & mutex m4 ) {} 9 9 10 int main(int argc, char* argv[]) { 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 M m1, m2, m3, m4; 12 13 BENCH( 13 for ( i; n) {14 call( m1, m2, m3, m4);14 for ( i; times ) { 15 call( m1, m2, m3, m4 ); 15 16 }, 16 17 result 17 18 ) 19 printf( "%g\n", result ); 20 } 18 21 19 printf("%g\n", result); 20 } 22 // Local Variables: // 23 // tab-width: 4 // 24 // End: // -
TabularUnified benchmark/mutex/pthreads.c ¶
r846c026 rb4107c8 7 7 8 8 void __attribute__((noinline)) call() { 9 pthread_mutex_lock (&mutex);10 pthread_mutex_unlock( &mutex);9 pthread_mutex_lock( &mutex ); 10 pthread_mutex_unlock( &mutex ); 11 11 } 12 13 int main(int argc, char* argv[]) { 12 int main( int argc, char * argv[] ) { 13 BENCH_START() 14 14 BENCH( 15 for ( size_t i = 0; i < n; i++) {15 for ( size_t i = 0; i < times; i++ ) { 16 16 call(); 17 17 }, 18 18 result 19 19 ) 20 printf( "%g\n", result ); 21 } 20 22 21 printf("%g\n", result); 22 } 23 // Local Variables: // 24 // tab-width: 4 // 25 // End: // -
TabularUnified benchmark/mutex/upp.cc ¶
r846c026 rb4107c8 8 8 }; 9 9 10 int main(int argc, char* argv[]) { 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 MyMonitor m; 12 13 BENCH( 13 for ( size_t i = 0; i < n; i++) {14 for ( size_t i = 0; i < times; i++ ) { 14 15 m.call(); 15 16 }, 16 17 result 17 18 ) 19 printf( "%g\n", result ); 20 } 18 21 19 printf("%g\n", result); 20 } 22 // Local Variables: // 23 // tab-width: 4 // 24 // End: //
Note: See TracChangeset
for help on using the changeset viewer.