Changeset b4107c8 for benchmark/creation
- 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/creation
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
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: // -
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: // -
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: // -
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: // -
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: // -
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: // -
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: //
Note: See TracChangeset
for help on using the changeset viewer.