- 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
- Files:
-
- 9 added
- 2 deleted
- 35 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified benchmark/basic/fetch_add.c ¶
r846c026 rb4107c8 11 11 } 12 12 13 int main(int argc, char* argv[]) { 13 int main( int argc, char * argv[] ) { 14 BENCH_START() 14 15 BENCH( 15 for (size_t i = 0; i < n; i++) {16 for (size_t i = 0; i < times; i++) { 16 17 do_call(); 17 18 }, 18 19 result 19 20 ) 21 printf( "%g\n", result ); 22 } 20 23 21 printf("%g\n", result); 22 } 24 // Local Variables: // 25 // tab-width: 4 // 26 // End: // -
TabularUnified benchmark/basic/tls_fetch_add.c ¶
r846c026 rb4107c8 16 16 } 17 17 18 int main(int argc, char* argv[]) { 18 int main( int argc, char * argv[] ) { 19 BENCH_START() 19 20 BENCH( 20 for (size_t i = 0; i < n; i++) {21 for (size_t i = 0; i < times; i++) { 21 22 do_call(); 22 23 }, 23 24 result 24 25 ) 26 printf( "%g\n", result ); 27 } 25 28 26 printf("%g\n", result); 27 } 29 // Local Variables: // 30 // tab-width: 4 // 31 // End: // -
TabularUnified benchmark/basic/ttst_lock.c ¶
r846c026 rb4107c8 35 35 } 36 36 37 int main(int argc, char* argv[]) { 37 int main( int argc, char * argv[] ) { 38 BENCH_START() 38 39 BENCH( 39 for (size_t i = 0; i < n; i++) {40 for (size_t i = 0; i < times; i++) { 40 41 do_call(); 41 42 }, 42 43 result 43 ) 44 45 printf("%g\n", result); 44 ) 45 printf( "%g\n", result ); 46 46 } 47 47 -
TabularUnified benchmark/creation/JavaThread.java ¶
r846c026 rb4107c8 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("10000") ;28 static private int times = Integer.parseInt("10000") ; 29 29 30 30 public static class MyThread extends Thread { … … 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 49 if ( args.length > 2 ) System.exit( 1 ); 50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 51 52 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 50 53 InnerMain(); 51 Thread.sleep(2000); 54 Thread.sleep(2000); // 2 seconds 52 55 x = nextRandom(x); 53 56 } … … 55 58 } 56 59 } 60 61 // Local Variables: // 62 // tab-width: 4 // 63 // End: // -
TabularUnified benchmark/creation/cfa_cor.cfa ¶
r846c026 rb4107c8 12 12 void main(MyCoroutine &) {} 13 13 14 int main(int argc, char* argv[]) { 14 int main( int argc, char * argv[] ) { 15 BENCH_START() 15 16 BENCH( 16 for ( i; n) {17 for ( i; times ) { 17 18 MyCoroutine m; 18 19 }, 19 20 result 20 21 ) 22 printf( "%g\n", result ); 23 } 21 24 22 printf("%g\n", result); 23 } 25 // Local Variables: // 26 // tab-width: 4 // 27 // End: // -
TabularUnified benchmark/creation/cfa_thrd.cfa ¶
r846c026 rb4107c8 7 7 void main(MyThread &) {} 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 BENCH( 11 for ( i; n) {12 for ( i; times ) { 12 13 MyThread m; 13 14 }, 14 15 result 15 16 ) 17 printf( "%g\n", result ); 18 } 16 19 17 printf("%g\n", result); 18 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
TabularUnified benchmark/creation/goroutine.go ¶
r846c026 rb4107c8 4 4 "fmt" 5 5 "time" 6 "flag" 6 7 ) 7 8 … … 17 18 18 19 func main() { 19 const NoOfTimes = 500000 20 times := flag.Int( "times", 500000, "loop iterations" ) 21 flag.Parse() 20 22 start := time.Now() 21 for i := 1; i <= NoOfTimes; i += 1 {23 for i := 1; i <= *times; i += 1 { 22 24 go noop() // creation 25 <- shake // wait for completion 23 26 } 24 27 end := time.Now() 25 fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes)) 26 <- shake 28 fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) ) 27 29 } 30 31 // Local Variables: // 32 // tab-width: 4 // 33 // End: // -
TabularUnified benchmark/creation/pthreads.c ¶
r846c026 rb4107c8 4 4 #include "bench.h" 5 5 6 static void * foo(void *arg) {6 static void * foo(void *arg) { 7 7 return arg; 8 8 } 9 9 10 int main(int argc, char* argv[]) { 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 BENCH( 12 for (size_t i = 0; i < n; i++) {13 for (size_t i = 0; i < times; i++) { 13 14 pthread_t thread; 14 15 if (pthread_create(&thread, NULL, foo, NULL) < 0) { … … 16 17 return 1; 17 18 } 18 19 19 if (pthread_join( thread, NULL) < 0) { 20 20 perror( "failure" ); … … 24 24 result 25 25 ) 26 printf( "%g\n", result ); 27 } 26 28 27 printf("%g\n", result); 28 } 29 // Local Variables: // 30 // tab-width: 4 // 31 // End: // -
TabularUnified benchmark/creation/upp_cor.cc ¶
r846c026 rb4107c8 7 7 }; 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 BENCH( 11 for (size_t i = 0; i < n; i++) {12 for (size_t i = 0; i < times; i++) { 12 13 MyCor m; 13 14 }, 14 15 result 15 16 ) 17 printf( "%g\n", result ); 18 } 16 19 17 printf("%g\n", result); 18 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
TabularUnified benchmark/creation/upp_thrd.cc ¶
r846c026 rb4107c8 7 7 }; 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 BENCH( 11 for (size_t i = 0; i < n; i++) {12 for (size_t i = 0; i < times; i++) { 12 13 MyThread m; 13 14 }, 14 15 result 15 16 ) 17 printf( "%g\n", result ); 18 } 16 19 17 printf("%g\n", result); 18 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
TabularUnified benchmark/ctxswitch/JavaThread.java ¶
r846c026 rb4107c8 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("1000000");28 static private int times = Integer.parseInt("100000"); 29 29 30 30 public static void helper() { 31 for(int i = 1; i <= NoOfTimes; i += 1) {31 for(int i = 1; i <= times; i += 1) { 32 32 Thread.yield(); 33 33 } … … 37 37 helper(); 38 38 long end = System.nanoTime(); 39 System.out.println( (end - start) / NoOfTimes );39 System.out.println( (end - start) / times ); 40 40 } 41 41 public static void main(String[] args) throws InterruptedException { 42 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 42 if ( args.length > 2 ) System.exit( 1 ); 43 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 44 45 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 43 46 InnerMain(); 44 Thread.sleep(2000); 47 Thread.sleep(2000); // 2 seconds 45 48 x = nextRandom(x); 46 49 } … … 48 51 } 49 52 } 53 54 // Local Variables: // 55 // tab-width: 4 // 56 // End: // -
TabularUnified benchmark/ctxswitch/cfa_cor.cfa ¶
r846c026 rb4107c8 5 5 6 6 coroutine GreatSuspender {}; 7 8 void ?{}( GreatSuspender & this ) {9 prime(this);10 }11 12 7 void main( __attribute__((unused)) GreatSuspender & this ) { 13 while ( true ) {8 while ( true ) { 14 9 suspend(); 15 10 } 16 11 } 17 18 int main(int argc, char* argv[]) { 12 int main( int argc, char * argv[] ) { 13 BENCH_START() 19 14 GreatSuspender s; 20 21 15 BENCH( 22 for ( i; n) {16 for ( i; times ) { 23 17 resume( s ); 24 18 }, 25 19 result 26 20 ) 21 printf( "%g\n", result ); 22 } 27 23 28 printf("%g\n", result); 29 } 24 // Local Variables: // 25 // tab-width: 4 // 26 // End: // -
TabularUnified benchmark/ctxswitch/cfa_cor_then.cfa ¶
r846c026 rb4107c8 18 18 } 19 19 20 int main(int argc, char* argv[]) { 20 int main( int argc, char * argv[] ) { 21 BENCH_START() 21 22 GreatSuspender s; 22 23 23 BENCH( 24 for ( i; n) {24 for ( i; times ) { 25 25 resume( s ); 26 26 }, 27 27 result 28 28 ) 29 printf( "%g\n", result ); 30 } 29 31 30 printf("%g\n", result); 31 } 32 // Local Variables: // 33 // tab-width: 4 // 34 // End: // -
TabularUnified benchmark/ctxswitch/cfa_gen.cfa ¶
r846c026 rb4107c8 6 6 7 7 void comain( GreatSuspender * this ) { 8 9 8 if ( __builtin_expect(this->next != 0, 1) ) goto *(this->next); 9 this->next = &&s1; 10 10 for () { 11 11 return; 12 12 s1: ; 13 13 } 14 14 } 15 15 16 int main( int argc, char* argv[]) {17 GreatSuspender s = { 0 }; 18 16 int main( int argc, char * argv[] ) { 17 BENCH_START() 18 GreatSuspender s = { 0 }; 19 19 BENCH( 20 for ( i; n) {20 for ( i; times ) { 21 21 comain( &s ); 22 22 }, 23 23 result 24 24 ) 25 printf( "%g\n", result ); 26 } 25 27 26 printf("%g\n", result); 27 } 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
TabularUnified benchmark/ctxswitch/cfa_thrd.cfa ¶
r846c026 rb4107c8 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for ( i; n) {8 for ( i; times ) { 8 9 yield(); 9 10 }, 10 11 result 11 12 ) 13 printf( "%g\n", result ); 14 } 12 15 13 printf("%g\n", result); 14 } 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
TabularUnified benchmark/ctxswitch/cfa_thrd2.cfa ¶
r846c026 rb4107c8 13 13 } 14 14 15 int main(int argc, char* argv[]) { 15 int main( int argc, char * argv[] ) { 16 BENCH_START() 16 17 Fibre f1; 17 18 BENCH( 18 for ( i; n) {19 for ( i; times ) { 19 20 yield(); 20 21 }, 21 22 result 22 23 ) 24 printf( "%g\n", result ); 25 done = true; 26 } 23 27 24 printf("%g\n", result); 25 done = true; 26 return 0; 27 } 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
TabularUnified benchmark/ctxswitch/goroutine.go ¶
r846c026 rb4107c8 3 3 import ( 4 4 "fmt" 5 "time" 6 "flag" 5 7 "runtime" 6 "time"7 8 ) 8 9 … … 28 29 29 30 func main() { 30 const NoOfTimes = 1000000031 go ContextSwitch( NoOfTimes ) // context switch31 times := flag.Int( "times", 10000000, "loop iterations" ) 32 go ContextSwitch( *times ) // context switch 32 33 <- shake 33 34 } 35 36 // Local Variables: // 37 // tab-width: 4 // 38 // End: // -
TabularUnified benchmark/ctxswitch/kos_fibre.cpp ¶
r846c026 rb4107c8 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for (size_t i = 0; i < n; i++) {8 for (size_t i = 0; i < times; i++) { 8 9 Fibre::yield(); 9 10 }, 10 11 result 11 12 ) 12 printf("%g\n", result); 13 return 0; 13 printf( "%g\n", result ); 14 14 } 15 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
TabularUnified benchmark/ctxswitch/kos_fibre2.cpp ¶
r846c026 rb4107c8 11 11 } 12 12 13 int main(int argc, char* argv[]) { 13 int main( int argc, char * argv[] ) { 14 BENCH_START() 14 15 Fibre* f1 = (new Fibre)->run(f1main); 15 16 BENCH( 16 for (size_t i = 0; i < n; i++) {17 for (size_t i = 0; i < times; i++) { 17 18 Fibre::yield(); 18 19 }, 19 20 result 20 21 ) 21 printf( "%g\n", result);22 printf( "%g\n", result ); 22 23 done = true; 23 24 Fibre::yield(); 24 25 f1->join(); 25 return 0;26 26 } 27 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
TabularUnified benchmark/ctxswitch/pthreads.c ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int main(int argc, char* argv[]) { 8 int main( int argc, char * argv[] ) { 9 BENCH_START() 9 10 BENCH( 10 for (size_t i = 0; i < n; i++) {11 for (size_t i = 0; i < times; i++) { 11 12 sched_yield(); 12 13 }, 13 14 result 14 15 ) 15 16 printf("%g\n", result); 16 printf( "%g\n", result ); 17 17 } -
TabularUnified benchmark/ctxswitch/upp_cor.cc ¶
r846c026 rb4107c8 4 4 5 5 _Coroutine GreatSuspender { 6 public:7 GreatSuspender() {8 resume();9 }10 11 void do_resume() {12 resume();13 }14 private:15 6 void main() { 16 7 while( true ) { … … 18 9 } 19 10 } 11 public: 12 void do_resume() { 13 resume(); 14 } 20 15 }; 21 22 int main(int argc, char* argv[]) { 16 int main( int argc, char * argv[] ) { 17 BENCH_START() 23 18 GreatSuspender s; 24 25 19 BENCH( 26 for (size_t i = 0; i < n; i++) {20 for (size_t i = 0; i < times; i++) { 27 21 s.do_resume(); 28 22 }, 29 23 result 30 24 ) 25 printf( "%g\n", result ); 26 } 31 27 32 printf("%g\n", result); 33 } 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
TabularUnified benchmark/ctxswitch/upp_thrd.cc ¶
r846c026 rb4107c8 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for (size_t i = 0; i < n; i++) {8 for (size_t i = 0; i < times; i++) { 8 9 uThisTask().yield(); 9 10 }, 10 11 result 11 12 ) 13 printf( "%g\n", result ); 14 } 12 15 13 printf("%g\n", result); 14 } 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
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: // -
TabularUnified benchmark/schedext/cfa1.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 17 15 int __attribute__((noinline)) wait( M & mutex a1 ) { 18 16 go = 1; 19 BENCH( 20 for ( i; n ) { 21 waitfor(call, a1); 22 }, 23 result 24 ) 25 26 printf("%g\n", result); 17 for ( i; times ) { 18 waitfor(call, a1); 19 } 27 20 go = 0; 28 21 return 0; … … 33 26 void main( T & ) { 34 27 while(go == 0) { yield(); } 35 while(go == 1) { call(m1); } 36 28 BENCH( 29 while(go == 1) { call(m1); }, 30 result 31 ) 32 printf( "%g\n", result ); 37 33 } 38 34 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 35 int main( int argc, char * argv[] ) { 36 BENCH_START() 40 37 T t; 41 return wait( m1);38 return wait( m1 ); 42 39 } 40 41 // Local Variables: // 42 // tab-width: 4 // 43 // End: // -
TabularUnified benchmark/schedext/cfa2.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 17 15 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { 18 16 go = 1; 19 BENCH( 20 for ( i; n ) { 21 waitfor(call, a1, a2); 22 }, 23 result 24 ) 25 26 printf("%g\n", result); 17 for ( i; times ) { 18 waitfor(call, a1, a2); 19 } 27 20 go = 0; 28 21 return 0; … … 33 26 void main( T & ) { 34 27 while(go == 0) { yield(); } 35 while(go == 1) { call(m1, m2); } 36 28 BENCH( 29 while(go == 1) { call(m1, m2); }, 30 result 31 ) 32 printf( "%g\n", result ); 37 33 } 38 34 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 35 int main( int argc, char * argv[] ) { 36 BENCH_START() 40 37 T t; 41 return wait( m1, m2);38 return wait( m1, m2 ); 42 39 } 40 41 // Local Variables: // 42 // tab-width: 4 // 43 // End: // -
TabularUnified benchmark/schedext/cfa4.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 17 15 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) { 18 16 go = 1; 19 BENCH( 20 for ( i; n ) { 21 waitfor(call, a1, a2, a3, a4); 22 }, 23 result 24 ) 25 26 printf("%g\n", result); 17 for ( i; times ) { 18 waitfor( call, a1, a2, a3, a4 ); 19 } 27 20 go = 0; 28 21 return 0; … … 33 26 void main( T & ) { 34 27 while(go == 0) { yield(); } 35 while(go == 1) { call(m1, m2, m3, m4); } 36 28 BENCH( 29 while(go == 1) { call(m1, m2, m3, m4); }, 30 result 31 ) 32 printf( "%g\n", result ); 37 33 } 38 34 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 35 int main( int argc, char * argv[] ) { 36 BENCH_START() 40 37 T t; 41 return wait( m1, m2, m3, m4);38 return wait( m1, m2, m3, m4 ); 42 39 } 40 41 // Local Variables: // 42 // tab-width: 4 // 43 // End: // -
TabularUnified benchmark/schedext/upp.cc ¶
r846c026 rb4107c8 3 3 #include "bench.h" 4 4 5 int argc;6 char** argv;7 5 volatile int go = 0; 8 6 … … 13 11 int __attribute__((noinline)) wait() { 14 12 go = 1; 15 BENCH( 16 for (size_t i = 0; i < n; i++) { 17 _Accept(call); 18 }, 19 result 20 ) 21 22 printf("%g\n", result); 13 for (size_t i = 0; i < times; i++) { 14 _Accept(call); 15 } 23 16 go = 0; 24 17 return 0; … … 31 24 void main() { 32 25 while(go == 0) { yield(); } 33 while(go == 1) { m.call(); } 34 26 BENCH( 27 while(go == 1) { m.call(); }, 28 result 29 ) 30 printf( "%g\n", result ); 35 31 } 36 32 }; 37 33 38 int main(int margc, char* margv[]) { 39 argc = margc; 40 argv = margv; 34 int main( int argc, char * argv[] ) { 35 BENCH_START() 41 36 T t; 42 37 return m.wait(); 43 38 } 39 40 // Local Variables: // 41 // tab-width: 4 // 42 // End: // -
TabularUnified benchmark/schedint/JavaThread.java ¶
r846c026 rb4107c8 49 49 static int x = 2; 50 50 51 static private final int NoOfTimes = Integer.parseInt("1000000");51 static private int times = Integer.parseInt("1000000"); 52 52 53 53 public static void helper( Monitor m ) throws InterruptedException { 54 for(int i = 1; i <= NoOfTimes; i += 1) {54 for(int i = 1; i <= times; i += 1) { 55 55 m.wait(); // relase monitor lock 56 56 m.next = true; … … 72 72 Monitor.go = false; 73 73 s.join(); 74 System.out.println( (end - start) / NoOfTimes);74 System.out.println( (end - start) / times); 75 75 } 76 76 public static void main(String[] args) throws InterruptedException { 77 if ( args.length > 2 ) System.exit( 1 ); 78 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 79 77 80 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 78 81 InnerMain(); … … 83 86 } 84 87 } 88 89 // Local Variables: // 90 // tab-width: 4 // 91 // End: // -
TabularUnified benchmark/schedint/cfa1.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 26 24 result 27 25 ) 28 29 printf("%g\n", result); 26 printf( "%g\n", result ); 30 27 go = 0; 31 28 return 0; … … 40 37 } 41 38 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 39 int main( int argc, char * argv[] ) { 40 BENCH_START() 43 41 T t; 44 42 return wait(m1); 45 43 } 44 45 // Local Variables: // 46 // tab-width: 4 // 47 // End: // -
TabularUnified benchmark/schedint/cfa2.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 26 24 result 27 25 ) 28 29 printf("%g\n", result); 26 printf( "%g\n", result ); 30 27 go = 0; 31 28 return 0; … … 40 37 } 41 38 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 39 int main( int argc, char * argv[] ) { 40 BENCH_START() 43 41 T t; 44 42 return wait(m1, m2); 45 43 } 44 45 // Local Variables: // 46 // tab-width: 4 // 47 // End: // -
TabularUnified benchmark/schedint/cfa4.cfa ¶
r846c026 rb4107c8 6 6 #include "bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 … … 26 24 result 27 25 ) 28 29 printf("%g\n", result); 26 printf( "%g\n", result ); 30 27 go = 0; 31 28 return 0; … … 40 37 } 41 38 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 39 int main( int argc, char * argv[] ) { 40 BENCH_START() 43 41 T t; 44 42 return wait(m1, m2, m3, m4); 45 43 } 44 45 // Local Variables: // 46 // tab-width: 4 // 47 // End: // -
TabularUnified benchmark/schedint/pthreads.c ¶
r846c026 rb4107c8 4 4 #include "bench.h" 5 5 6 int argc;7 char** argv;8 6 volatile int go = 0; 9 7 … … 21 19 go = 1; 22 20 BENCH( 23 for (size_t i = 0; i < n; i++) {21 for (size_t i = 0; i < times; i++) { 24 22 pthread_cond_wait(&c, &m); 25 23 }, 26 24 result 27 25 ) 28 29 printf("%g\n", result); 26 printf( "%g\n", result ); 30 27 go = 0; 31 28 pthread_mutex_unlock(&m); … … 39 36 } 40 37 41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 38 int main( int argc, char * argv[] ) { 39 BENCH_START() 42 40 pthread_t thread; 43 41 if (pthread_create(&thread, NULL, thread_main, NULL) < 0) { … … 50 48 return 1; 51 49 } 52 return 0;53 50 } 51 52 // Local Variables: // 53 // tab-width: 4 // 54 // End: // -
TabularUnified benchmark/schedint/upp.cc ¶
r846c026 rb4107c8 3 3 #include "bench.h" 4 4 5 int argc;6 char** argv;7 5 volatile int go = 0; 8 6 … … 22 20 result 23 21 ) 24 25 printf("%g\n", result); 22 printf( "%g\n", result ); 26 23 go = 0; 27 24 return 0; … … 39 36 }; 40 37 41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 38 int main( int argc, char * argv[] ) { 39 BENCH_START() 42 40 T t; 43 41 return m.wait(); 44 42 } 43 44 // Local Variables: // 45 // tab-width: 4 // 46 // End: //
Note: See TracChangeset
for help on using the changeset viewer.