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