- Timestamp:
- Sep 27, 2019, 3:35:46 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 90ce35aa
- Parents:
- 8e1467d (diff), 849720f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- benchmark
- Files:
-
- 9 added
- 6 edited
-
Makefile.am (modified) (5 diffs)
-
Makefile.in (modified) (8 diffs)
-
baselines/calc.py (added)
-
baselines/x64/compile.csv (added)
-
baselines/x64/ctxswitch.csv (added)
-
baselines/x64/mutex.csv (added)
-
baselines/x64/signal.csv (added)
-
baselines/x86/compile.csv (added)
-
baselines/x86/ctxswitch.csv (added)
-
baselines/x86/mutex.csv (added)
-
baselines/x86/signal.csv (added)
-
creation/JavaThread.java (modified) (1 diff)
-
ctxswitch/JavaThread.java (modified) (1 diff)
-
mutex/JavaThread.java (modified) (1 diff)
-
schedint/JavaThread.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/Makefile.am
r8e1467d r4a60488 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Ju n 24 16:45:42201914 ## Update Count : 5 313 ## Last Modified On : Mon Jul 29 18:02:19 2019 14 ## Update Count : 54 15 15 ############################################################################### 16 16 … … 22 22 23 23 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror 24 AM_CFAFLAGS = -quiet -nodebug -in-tree24 AM_CFAFLAGS = -quiet -nodebug 25 25 AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14 26 26 … … 50 50 REPEAT = ${abs_top_builddir}/tools/repeat 51 51 STATS = ${abs_top_srcdir}/tools/stat.py 52 repeats = 3 # 30 52 # NEED AT LEAST 4 DATA VALUES FOR BENCHMARKS BECAUSE THE MAX AND MIN VALUES ARE REMOVED 53 repeats = 5 # 31 for benchmarks 54 arch = x64 53 55 skipcompile = no 54 56 TIME_FORMAT = "%E" … … 99 101 @DOifskipcompile@ 100 102 @+make compile.csv 103 @-+make compile.diff.csv 101 104 @DOendif@ 102 105 @+make ctxswitch.csv 106 @-+make ctxswitch.diff.csv 103 107 @+make mutex.csv 108 @-+make mutex.diff.csv 104 109 @+make signal.csv 110 @-+make signal.diff.csv 105 111 @DOifskipcompile@ 106 @cat compile.csv 112 cat compile.csv 113 -cat compile.diff.csv 107 114 @DOendif@ 108 @cat ctxswitch.csv 109 @cat mutex.csv 110 @cat signal.csv 115 cat ctxswitch.csv 116 -cat ctxswitch.diff.csv 117 cat mutex.csv 118 -cat mutex.diff.csv 119 cat signal.csv 120 -cat signal.diff.csv 111 121 112 122 compile.csv: … … 142 152 @+make waitfor-cfa2.runquiet >> $@ 143 153 @$(srcdir)/fixcsv.sh $@ 154 155 %.diff.csv: %.csv 156 @test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 157 @$(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 158 144 159 145 160 ## ========================================================================================================= -
benchmark/Makefile.in
r8e1467d r4a60488 214 214 CCDEPMODE = @CCDEPMODE@ 215 215 CFACC = @CFACC@ 216 CFACC_INSTALL = @CFACC_INSTALL@ 216 217 CFACPP = @CFACPP@ 217 218 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 231 232 CYGPATH_W = @CYGPATH_W@ 232 233 DEFS = @DEFS@ 234 DEMANGLER = @DEMANGLER@ 233 235 DEPDIR = @DEPDIR@ 234 236 DLLTOOL = @DLLTOOL@ … … 243 245 FGREP = @FGREP@ 244 246 GREP = @GREP@ 247 HAS_DISTCC = @HAS_DISTCC@ 245 248 HOST_FLAGS = @HOST_FLAGS@ 246 249 INSTALL = @INSTALL@ … … 256 259 LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@ 257 260 LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@ 261 LIBDEMANGLE = @LIBDEMANGLE@ 258 262 LIBOBJS = @LIBOBJS@ 259 263 LIBS = @LIBS@ … … 372 376 # applies to both programs 373 377 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror 374 AM_CFAFLAGS = -quiet -nodebug -in-tree378 AM_CFAFLAGS = -quiet -nodebug 375 379 AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14 376 380 BENCH_V_CC = $(__bench_v_CC_$(__quiet)) … … 396 400 REPEAT = ${abs_top_builddir}/tools/repeat 397 401 STATS = ${abs_top_srcdir}/tools/stat.py 398 repeats = 3 # 30 402 # NEED AT LEAST 4 DATA VALUES FOR BENCHMARKS BECAUSE THE MAX AND MIN VALUES ARE REMOVED 403 repeats = 5 # 31 for benchmarks 404 arch = x64 399 405 skipcompile = no 400 406 TIME_FORMAT = "%E" … … 761 767 @DOifskipcompile@ 762 768 @+make compile.csv 769 @-+make compile.diff.csv 763 770 @DOendif@ 764 771 @+make ctxswitch.csv 772 @-+make ctxswitch.diff.csv 765 773 @+make mutex.csv 774 @-+make mutex.diff.csv 766 775 @+make signal.csv 776 @-+make signal.diff.csv 767 777 @DOifskipcompile@ 768 @cat compile.csv 778 cat compile.csv 779 -cat compile.diff.csv 769 780 @DOendif@ 770 @cat ctxswitch.csv 771 @cat mutex.csv 772 @cat signal.csv 781 cat ctxswitch.csv 782 -cat ctxswitch.diff.csv 783 cat mutex.csv 784 -cat mutex.diff.csv 785 cat signal.csv 786 -cat signal.diff.csv 773 787 774 788 compile.csv: … … 805 819 @$(srcdir)/fixcsv.sh $@ 806 820 821 %.diff.csv: %.csv 822 @test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 823 @$(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 824 807 825 loop$(EXEEXT): 808 826 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c -
benchmark/creation/JavaThread.java
r8e1467d r4a60488 1 1 public class JavaThread { 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 4 // Cycle length for non-zero values is 4G-1. 5 // 0 is absorbing and should be avoided -- fixed point. 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 8 9 private static int nextRandom (int x) { 10 if (x == 0) { 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 } 21 x ^= x << 6; 22 x ^= x >>> 21; 23 x ^= x << 7; 24 return x ; 25 } 26 static int x = 2; 27 28 static private final int NoOfTimes = Integer.parseInt("10000") ; 29 2 30 public static class MyThread extends Thread { 3 31 @Override 4 32 public void run() {} 5 33 } 6 7 public static void main(String[] args) throws InterruptedException { 8 int NoOfTimes = 50000; 9 long start = System.nanoTime(); 34 public static void helper() throws InterruptedException { 10 35 for(int i = 1; i <= NoOfTimes; i += 1) { 11 JavaThread.MyThread m = new JavaThread.MyThread(); 12 m.start(); 36 MyThread m = new MyThread(); 37 x = nextRandom( x ); 38 m.start(); 13 39 m.join(); 14 40 } 41 } 42 public static void InnerMain() throws InterruptedException { 43 long start = System.nanoTime(); 44 helper(); 15 45 long end = System.nanoTime(); 16 System.out.println( (end - start) / NoOfTimes); 46 System.out.println( (end - start) / NoOfTimes ); 47 } 48 public static void main(String[] args) throws InterruptedException { 49 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 50 InnerMain(); 51 Thread.sleep(2000); // 2 seconds 52 x = nextRandom(x); 53 } 54 if ( x == 0 ) System.out.println(x); 17 55 } 18 56 } -
benchmark/ctxswitch/JavaThread.java
r8e1467d r4a60488 1 1 public class JavaThread { 2 public static void main(String[] args) { 3 int NoOfTimes = 5000000; 4 long start = System.nanoTime(); 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 4 // Cycle length for non-zero values is 4G-1. 5 // 0 is absorbing and should be avoided -- fixed point. 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 8 9 private static int nextRandom (int x) { 10 if (x == 0) { 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 } 21 x ^= x << 6; 22 x ^= x >>> 21; 23 x ^= x << 7; 24 return x ; 25 } 26 static int x = 2; 27 28 static private final int NoOfTimes = Integer.parseInt("1000000") ; 29 30 public static void helper() { 5 31 for(int i = 1; i <= NoOfTimes; i += 1) { 6 32 Thread.yield(); 7 33 } 34 } 35 public static void InnerMain() { 36 long start = System.nanoTime(); 37 helper(); 8 38 long end = System.nanoTime(); 9 System.out.println( (end - start) / NoOfTimes); 39 System.out.println( (end - start) / NoOfTimes ); 40 } 41 public static void main(String[] args) throws InterruptedException { 42 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 43 InnerMain(); 44 Thread.sleep(2000); // 2 seconds 45 x = nextRandom(x); 46 } 47 if ( x == 0 ) System.out.println(x); 10 48 } 11 49 } -
benchmark/mutex/JavaThread.java
r8e1467d r4a60488 1 1 public class JavaThread { 2 public synchronized void noop() {} 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 4 // Cycle length for non-zero values is 4G-1. 5 // 0 is absorbing and should be avoided -- fixed point. 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 3 8 4 public static void main(String[] args) { 5 int NoOfTimes = 5000000; 9 private static int nextRandom (int x) { 10 if (x == 0) { 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 } 21 x ^= x << 6; 22 x ^= x >>> 21; 23 x ^= x << 7; 24 return x ; 25 } 26 static int x = 2; 27 28 static private final int NoOfTimes = Integer.parseInt("100000000") ; 29 30 public synchronized void noop() { 31 x = nextRandom( x ); 32 } 33 public static void helper() throws InterruptedException { 6 34 JavaThread j = new JavaThread(); 7 long start = System.nanoTime(); 35 // Inhibit biased locking ... 36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 8 37 for(int i = 1; i <= NoOfTimes; i += 1) { 38 x = nextRandom(x); 9 39 j.noop(); 10 40 } 41 } 42 public static void InnerMain() throws InterruptedException { 43 long start = System.nanoTime(); 44 helper(); 11 45 long end = System.nanoTime(); 12 System.out.println( (end - start) / NoOfTimes); 46 System.out.println( (end - start) / NoOfTimes ); 47 } 48 public static void main(String[] args) throws InterruptedException { 49 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 50 InnerMain(); 51 Thread.sleep(2000); // 2 seconds 52 x = nextRandom(x); 53 } 54 if ( x == 0 ) System.out.println(x); 13 55 } 14 56 } -
benchmark/schedint/JavaThread.java
r8e1467d r4a60488 1 1 class Monitor { 2 2 public static volatile Boolean go = false; 3 public static volatile Boolean next = false; 3 4 } 4 5 … … 13 14 while( Monitor.go ) { 14 15 synchronized(this.m) { 16 Monitor.next = false; 15 17 this.m.notify(); 16 18 } 19 while( ! Monitor.next && Monitor.go ); // spin until woken 17 20 } 18 21 } … … 20 23 21 24 public class JavaThread { 22 public static void main(String[] args) throws InterruptedException { 23 int NoOfTimes = 50000; 25 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 26 // Bijective 27 // Cycle length for non-zero values is 4G-1. 28 // 0 is absorbing and should be avoided -- fixed point. 29 // The returned value is typically masked to produce a positive value. 30 static volatile int Ticket = 0 ; 31 32 private static int nextRandom (int x) { 33 if (x == 0) { 34 // reseed the PRNG 35 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 36 // Note that we use a non-atomic racy increment -- the race is rare and benign. 37 // If the race is a concern switch to an AtomicInteger. 38 // In addition accesses to the RW volatile global "Ticket" variable are not 39 // (readily) predictable at compile-time so the JIT will not be able to elide 40 // nextRandom() invocations. 41 x = ++Ticket ; 42 if (x == 0) x = 1 ; 43 } 44 x ^= x << 6; 45 x ^= x >>> 21; 46 x ^= x << 7; 47 return x ; 48 } 49 static int x = 2; 50 51 static private final int NoOfTimes = Integer.parseInt("1000000") ; 52 53 public static void helper( Monitor m ) throws InterruptedException { 54 for(int i = 1; i <= NoOfTimes; i += 1) { 55 m.wait(); // relase monitor lock 56 m.next = true; 57 } 58 } 59 public static void InnerMain() throws InterruptedException { 24 60 Monitor m = new Monitor(); 25 61 long start, end; … … 31 67 } 32 68 start = System.nanoTime(); 33 for(int i = 1; i <= NoOfTimes; i += 1) { 34 m.wait(); 35 } 69 helper( m ); 36 70 end = System.nanoTime(); 37 71 } … … 40 74 System.out.println( (end - start) / NoOfTimes); 41 75 } 76 public static void main(String[] args) throws InterruptedException { 77 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 78 InnerMain(); 79 Thread.sleep(2000); // 2 seconds 80 x = nextRandom(x); 81 } 82 if ( x == 0 ) System.out.println(x); 83 } 42 84 }
Note:
See TracChangeset
for help on using the changeset viewer.