Changeset 4a60488 for benchmark


Ignore:
Timestamp:
Sep 27, 2019, 3:35:46 PM (6 years ago)
Author:
Andrew Beach <ajbeach@…>
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.
Message:

Merged from master taking the lvalue changes to expression and everything before that.

Location:
benchmark
Files:
9 added
6 edited

Legend:

Unmodified
Added
Removed
  • benchmark/Makefile.am

    r8e1467d r4a60488  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Jun 24 16:45:42 2019
    14 ## Update Count     : 53
     13## Last Modified On : Mon Jul 29 18:02:19 2019
     14## Update Count     : 54
    1515###############################################################################
    1616
     
    2222
    2323AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror
    24 AM_CFAFLAGS = -quiet -nodebug -in-tree
     24AM_CFAFLAGS = -quiet -nodebug
    2525AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14
    2626
     
    5050REPEAT   = ${abs_top_builddir}/tools/repeat
    5151STATS    = ${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
     53repeats  = 5 # 31 for benchmarks
     54arch     = x64
    5355skipcompile = no
    5456TIME_FORMAT = "%E"
     
    99101@DOifskipcompile@
    100102        @+make compile.csv
     103        @-+make compile.diff.csv
    101104@DOendif@
    102105        @+make ctxswitch.csv
     106        @-+make ctxswitch.diff.csv
    103107        @+make mutex.csv
     108        @-+make mutex.diff.csv
    104109        @+make signal.csv
     110        @-+make signal.diff.csv
    105111@DOifskipcompile@
    106         @cat compile.csv
     112        cat compile.csv
     113        -cat compile.diff.csv
    107114@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
    111121
    112122compile.csv:
     
    142152        @+make waitfor-cfa2.runquiet >> $@
    143153        @$(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
    144159
    145160## =========================================================================================================
  • benchmark/Makefile.in

    r8e1467d r4a60488  
    214214CCDEPMODE = @CCDEPMODE@
    215215CFACC = @CFACC@
     216CFACC_INSTALL = @CFACC_INSTALL@
    216217CFACPP = @CFACPP@
    217218CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    231232CYGPATH_W = @CYGPATH_W@
    232233DEFS = @DEFS@
     234DEMANGLER = @DEMANGLER@
    233235DEPDIR = @DEPDIR@
    234236DLLTOOL = @DLLTOOL@
     
    243245FGREP = @FGREP@
    244246GREP = @GREP@
     247HAS_DISTCC = @HAS_DISTCC@
    245248HOST_FLAGS = @HOST_FLAGS@
    246249INSTALL = @INSTALL@
     
    256259LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
    257260LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
     261LIBDEMANGLE = @LIBDEMANGLE@
    258262LIBOBJS = @LIBOBJS@
    259263LIBS = @LIBS@
     
    372376# applies to both programs
    373377AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror
    374 AM_CFAFLAGS = -quiet -nodebug -in-tree
     378AM_CFAFLAGS = -quiet -nodebug
    375379AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14
    376380BENCH_V_CC = $(__bench_v_CC_$(__quiet))
     
    396400REPEAT = ${abs_top_builddir}/tools/repeat
    397401STATS = ${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
     403repeats = 5 # 31 for benchmarks
     404arch = x64
    399405skipcompile = no
    400406TIME_FORMAT = "%E"
     
    761767@DOifskipcompile@
    762768        @+make compile.csv
     769        @-+make compile.diff.csv
    763770@DOendif@
    764771        @+make ctxswitch.csv
     772        @-+make ctxswitch.diff.csv
    765773        @+make mutex.csv
     774        @-+make mutex.diff.csv
    766775        @+make signal.csv
     776        @-+make signal.diff.csv
    767777@DOifskipcompile@
    768         @cat compile.csv
     778        cat compile.csv
     779        -cat compile.diff.csv
    769780@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
    773787
    774788compile.csv:
     
    805819        @$(srcdir)/fixcsv.sh $@
    806820
     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
    807825loop$(EXEEXT):
    808826        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
  • benchmark/creation/JavaThread.java

    r8e1467d r4a60488  
    11public 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
    230        public static class MyThread extends Thread {
    331                @Override
    432                public void run() {}
    533        }
    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 {
    1035                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();
    1339                        m.join();
    1440                }
     41        }
     42        public static void InnerMain() throws InterruptedException {
     43                long start = System.nanoTime();
     44                helper();
    1545                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);
    1755        }
    1856}
  • benchmark/ctxswitch/JavaThread.java

    r8e1467d r4a60488  
    11public 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() {
    531                for(int i = 1; i <= NoOfTimes; i += 1) {
    632                        Thread.yield();
    733                }
     34        }
     35        public static void InnerMain() {
     36                long start = System.nanoTime();
     37                helper();
    838                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);
    1048        }
    1149}
  • benchmark/mutex/JavaThread.java

    r8e1467d r4a60488  
    11public 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 ;
    38
    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 {
    634                JavaThread j = new JavaThread();
    7                 long start = System.nanoTime();
     35                // Inhibit biased locking ...
     36                x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ;     
    837                for(int i = 1; i <= NoOfTimes; i += 1) {
     38                        x = nextRandom(x);
    939                        j.noop();
    1040                }
     41        }
     42        public static void InnerMain() throws InterruptedException {
     43                long start = System.nanoTime();
     44                helper();
    1145                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);
    1355        }
    1456}
  • benchmark/schedint/JavaThread.java

    r8e1467d r4a60488  
    11class Monitor {
    22        public static volatile Boolean go = false;
     3        public static volatile Boolean next = false;
    34}
    45
     
    1314                while( Monitor.go ) {
    1415                        synchronized(this.m) {
     16                                Monitor.next = false;
    1517                                this.m.notify();
    1618                        }
     19                        while( ! Monitor.next && Monitor.go );  // spin until woken
    1720                }
    1821        }
     
    2023
    2124public 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 {
    2460                Monitor m = new Monitor();
    2561                long start, end;
     
    3167                        }
    3268                        start = System.nanoTime();
    33                         for(int i = 1; i <= NoOfTimes; i += 1) {
    34                                 m.wait();
    35                         }
     69                        helper( m );
    3670                        end = System.nanoTime();
    3771                }
     
    4074                System.out.println( (end - start) / NoOfTimes);
    4175        }
     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        }
    4284}
Note: See TracChangeset for help on using the changeset viewer.