Changeset b4107c8 for benchmark


Ignore:
Timestamp:
Jan 7, 2020, 3:50:56 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

Location:
benchmark
Files:
9 added
2 deleted
35 edited
3 moved

Legend:

Unmodified
Added
Removed
  • TabularUnified benchmark/basic/fetch_add.c

    r846c026 rb4107c8  
    1111}
    1212
    13 int main(int argc, char* argv[]) {
     13int main( int argc, char * argv[] ) {
     14        BENCH_START()
    1415        BENCH(
    15                 for (size_t i = 0; i < n; i++) {
     16                for (size_t i = 0; i < times; i++) {
    1617                        do_call();
    1718                },
    1819                result
    1920        )
     21        printf( "%g\n", result );
     22}
    2023
    21         printf("%g\n", result);
    22 }
     24// Local Variables: //
     25// tab-width: 4 //
     26// End: //
  • TabularUnified benchmark/basic/tls_fetch_add.c

    r846c026 rb4107c8  
    1616}
    1717
    18 int main(int argc, char* argv[]) {
     18int main( int argc, char * argv[] ) {
     19        BENCH_START()
    1920        BENCH(
    20                 for (size_t i = 0; i < n; i++) {
     21                for (size_t i = 0; i < times; i++) {
    2122                        do_call();
    2223                },
    2324                result
    2425        )
     26        printf( "%g\n", result );
     27}
    2528
    26         printf("%g\n", result);
    27 }
     29// Local Variables: //
     30// tab-width: 4 //
     31// End: //
  • TabularUnified benchmark/basic/ttst_lock.c

    r846c026 rb4107c8  
    3535}
    3636
    37 int main(int argc, char* argv[]) {
     37int main( int argc, char * argv[] ) {
     38        BENCH_START()
    3839        BENCH(
    39                 for (size_t i = 0; i < n; i++) {
     40                for (size_t i = 0; i < times; i++) {
    4041                        do_call();
    4142                },
    4243                result
    43                 )
    44 
    45                 printf("%g\n", result);
     44        )
     45        printf( "%g\n", result );
    4646}
    4747
  • TabularUnified benchmark/creation/JavaThread.java

    r846c026 rb4107c8  
    2626        static int x = 2;
    2727
    28         static private final int NoOfTimes = Integer.parseInt("10000") ;
     28        static private int times = Integer.parseInt("10000") ;
    2929
    3030        public static class MyThread extends Thread {
     
    4747        }
    4848        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 ; ) {
    5053                        InnerMain();
    51                         Thread.sleep(2000);     // 2 seconds
     54                        Thread.sleep(2000);     // 2 seconds
    5255                        x = nextRandom(x);
    5356                }
     
    5558        }
    5659}
     60
     61// Local Variables: //
     62// tab-width: 4 //
     63// End: //
  • TabularUnified benchmark/creation/cfa_cor.cfa

    r846c026 rb4107c8  
    1212void main(MyCoroutine &) {}
    1313
    14 int main(int argc, char* argv[]) {
     14int main( int argc, char * argv[] ) {
     15        BENCH_START()
    1516        BENCH(
    16                 for ( i; n ) {
     17                for ( i; times ) {
    1718                        MyCoroutine m;
    1819                },
    1920                result
    2021        )
     22        printf( "%g\n", result );
     23}
    2124
    22         printf("%g\n", result);
    23 }
     25// Local Variables: //
     26// tab-width: 4 //
     27// End: //
  • TabularUnified benchmark/creation/cfa_thrd.cfa

    r846c026 rb4107c8  
    77void main(MyThread &) {}
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for ( i; n ) {
     12                for ( i; times ) {
    1213                        MyThread m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
  • TabularUnified benchmark/creation/goroutine.go

    r846c026 rb4107c8  
    44    "fmt"
    55    "time"
     6    "flag"
    67)
    78
     
    1718
    1819func main() {
    19         const NoOfTimes = 500000
     20        times := flag.Int( "times", 500000, "loop iterations" )
     21        flag.Parse()
    2022        start := time.Now()
    21         for i := 1; i <= NoOfTimes; i += 1 {
     23        for i := 1; i <= *times; i += 1 {
    2224                go noop()               // creation
     25                <- shake                // wait for completion
    2326        }
    2427        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) )
    2729}
     30
     31// Local Variables: //
     32// tab-width: 4 //
     33// End: //
  • TabularUnified benchmark/creation/pthreads.c

    r846c026 rb4107c8  
    44#include "bench.h"
    55
    6 static void *foo(void *arg) {
     6static void * foo(void *arg) {
    77    return arg;
    88}
    99
    10 int main(int argc, char* argv[]) {
     10int main( int argc, char * argv[] ) {
     11        BENCH_START()
    1112        BENCH(
    12                 for (size_t i = 0; i < n; i++) {
     13                for (size_t i = 0; i < times; i++) {
    1314                        pthread_t thread;
    1415                        if (pthread_create(&thread, NULL, foo, NULL) < 0) {
     
    1617                                return 1;
    1718                        }
    18 
    1919                        if (pthread_join( thread, NULL) < 0) {
    2020                                perror( "failure" );
     
    2424                result
    2525        )
     26        printf( "%g\n", result );
     27}
    2628
    27         printf("%g\n", result);
    28 }
     29// Local Variables: //
     30// tab-width: 4 //
     31// End: //
  • TabularUnified benchmark/creation/upp_cor.cc

    r846c026 rb4107c8  
    77};
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for (size_t i = 0; i < n; i++) {
     12                for (size_t i = 0; i < times; i++) {
    1213                        MyCor m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
  • TabularUnified benchmark/creation/upp_thrd.cc

    r846c026 rb4107c8  
    77};
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        BENCH(
    11                 for (size_t i = 0; i < n; i++) {
     12                for (size_t i = 0; i < times; i++) {
    1213                        MyThread m;
    1314                },
    1415                result
    1516        )
     17        printf( "%g\n", result );
     18}
    1619
    17         printf("%g\n", result);
    18 }
     20// Local Variables: //
     21// tab-width: 4 //
     22// End: //
  • TabularUnified benchmark/ctxswitch/JavaThread.java

    r846c026 rb4107c8  
    2626        static int x = 2;
    2727
    28         static private final int NoOfTimes = Integer.parseInt("1000000") ;
     28        static private int times = Integer.parseInt("100000");
    2929
    3030        public static void helper() {
    31                 for(int i = 1; i <= NoOfTimes; i += 1) {
     31                for(int i = 1; i <= times; i += 1) {
    3232                        Thread.yield();
    3333                }
     
    3737                helper();
    3838                long end = System.nanoTime();
    39                 System.out.println( (end - start) / NoOfTimes );
     39                System.out.println( (end - start) / times );
    4040        }
    4141        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 ; ) {
    4346                        InnerMain();
    44                         Thread.sleep(2000);     // 2 seconds
     47                        Thread.sleep(2000);     // 2 seconds
    4548                        x = nextRandom(x);
    4649                }
     
    4851        }
    4952}
     53
     54// Local Variables: //
     55// tab-width: 4 //
     56// End: //
  • TabularUnified benchmark/ctxswitch/cfa_cor.cfa

    r846c026 rb4107c8  
    55
    66coroutine GreatSuspender {};
    7 
    8 void ?{}( GreatSuspender & this ) {
    9         prime(this);
    10 }
    11 
    127void main( __attribute__((unused)) GreatSuspender & this ) {
    13         while( true ) {
     8        while ( true ) {
    149                suspend();
    1510        }
    1611}
    17 
    18 int main(int argc, char* argv[]) {
     12int main( int argc, char * argv[] ) {
     13        BENCH_START()
    1914        GreatSuspender s;
    20 
    2115        BENCH(
    22                 for ( i; n ) {
     16                for ( i; times ) {
    2317                        resume( s );
    2418                },
    2519                result
    2620        )
     21        printf( "%g\n", result );
     22}
    2723
    28         printf("%g\n", result);
    29 }
     24// Local Variables: //
     25// tab-width: 4 //
     26// End: //
  • TabularUnified benchmark/ctxswitch/cfa_cor_then.cfa

    r846c026 rb4107c8  
    1818}
    1919
    20 int main(int argc, char* argv[]) {
     20int main( int argc, char * argv[] ) {
     21        BENCH_START()
    2122        GreatSuspender s;
    22 
    2323        BENCH(
    24                 for ( i; n ) {
     24                for ( i; times ) {
    2525                        resume( s );
    2626                },
    2727                result
    2828        )
     29        printf( "%g\n", result );
     30}
    2931
    30         printf("%g\n", result);
    31 }
     32// Local Variables: //
     33// tab-width: 4 //
     34// End: //
  • TabularUnified benchmark/ctxswitch/cfa_gen.cfa

    r846c026 rb4107c8  
    66
    77void comain( GreatSuspender * this ) {
    8     if ( __builtin_expect(this->next != 0, 1) ) goto *(this->next);
    9     this->next = &&s1;
     8        if ( __builtin_expect(this->next != 0, 1) ) goto *(this->next);
     9        this->next = &&s1;
    1010        for () {
    11             return;
     11                return;
    1212          s1: ;
    1313        }
    1414}
    1515
    16 int main(int argc, char* argv[]) {
    17     GreatSuspender s = { 0 };
    18 
     16int main( int argc, char * argv[] ) {
     17        BENCH_START()
     18        GreatSuspender s = { 0 };
    1919        BENCH(
    20                 for ( i; n ) {
     20                for ( i; times ) {
    2121                        comain( &s );
    2222                },
    2323                result
    2424        )
     25        printf( "%g\n", result );
     26}
    2527
    26         printf("%g\n", result);
    27 }
     28// Local Variables: //
     29// tab-width: 4 //
     30// End: //
  • TabularUnified benchmark/ctxswitch/cfa_thrd.cfa

    r846c026 rb4107c8  
    33#include "bench.h"
    44
    5 int main(int argc, char* argv[]) {
     5int main( int argc, char * argv[] ) {
     6        BENCH_START()
    67        BENCH(
    7                 for ( i; n ) {
     8                for ( i; times ) {
    89                        yield();
    910                },
    1011                result
    1112        )
     13        printf( "%g\n", result );
     14}
    1215
    13         printf("%g\n", result);
    14 }
     16// Local Variables: //
     17// tab-width: 4 //
     18// End: //
  • TabularUnified benchmark/ctxswitch/cfa_thrd2.cfa

    r846c026 rb4107c8  
    1313}
    1414
    15 int main(int argc, char* argv[]) {
     15int main( int argc, char * argv[] ) {
     16        BENCH_START()
    1617        Fibre f1;
    1718        BENCH(
    18                 for ( i; n ) {
     19                for ( i; times ) {
    1920                        yield();
    2021                },
    2122                result
    2223        )
     24        printf( "%g\n", result );
     25        done = true;
     26}
    2327
    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  
    33import (
    44    "fmt"
     5    "time"
     6    "flag"
    57    "runtime"
    6     "time"
    78)
    89
     
    2829
    2930func main() {
    30         const NoOfTimes = 10000000
    31         go ContextSwitch( NoOfTimes )           // context switch
     31        times := flag.Int( "times", 10000000, "loop iterations" )
     32        go ContextSwitch( *times )              // context switch
    3233        <- shake
    3334}
     35
     36// Local Variables: //
     37// tab-width: 4 //
     38// End: //
  • TabularUnified benchmark/ctxswitch/kos_fibre.cpp

    r846c026 rb4107c8  
    33#include "bench.h"
    44
    5 int main(int argc, char* argv[]) {
     5int main( int argc, char * argv[] ) {
     6        BENCH_START()
    67        BENCH(
    7                 for (size_t i = 0; i < n; i++) {
     8                for (size_t i = 0; i < times; i++) {
    89                        Fibre::yield();
    910                },
    1011                result
    1112        )
    12         printf("%g\n", result);
    13         return 0;
     13        printf( "%g\n", result );
    1414}
     15
     16// Local Variables: //
     17// tab-width: 4 //
     18// End: //
  • TabularUnified benchmark/ctxswitch/kos_fibre2.cpp

    r846c026 rb4107c8  
    1111}
    1212
    13 int main(int argc, char* argv[]) {
     13int main( int argc, char * argv[] ) {
     14        BENCH_START()
    1415        Fibre* f1 = (new Fibre)->run(f1main);
    1516        BENCH(
    16                 for (size_t i = 0; i < n; i++) {
     17                for (size_t i = 0; i < times; i++) {
    1718                        Fibre::yield();
    1819                },
    1920                result
    2021        )
    21         printf("%g\n", result);
     22        printf( "%g\n", result );
    2223        done = true;
    2324        Fibre::yield();
    2425        f1->join();
    25         return 0;
    2626}
     27
     28// Local Variables: //
     29// tab-width: 4 //
     30// End: //
  • TabularUnified benchmark/ctxswitch/pthreads.c

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int main(int argc, char* argv[]) {
     8int main( int argc, char * argv[] ) {
     9        BENCH_START()
    910        BENCH(
    10                 for (size_t i = 0; i < n; i++) {
     11                for (size_t i = 0; i < times; i++) {
    1112                        sched_yield();
    1213                },
    1314                result
    1415        )
    15 
    16         printf("%g\n", result);
     16        printf( "%g\n", result );
    1717}
  • TabularUnified benchmark/ctxswitch/upp_cor.cc

    r846c026 rb4107c8  
    44
    55_Coroutine GreatSuspender {
    6 public:
    7         GreatSuspender() {
    8                 resume();
    9         }
    10 
    11         void do_resume() {
    12                 resume();
    13         }
    14 private:
    156        void main() {
    167                while( true ) {
     
    189                }
    1910        }
     11  public:
     12        void do_resume() {
     13                resume();
     14        }
    2015};
    21 
    22 int main(int argc, char* argv[]) {
     16int main( int argc, char * argv[] ) {
     17        BENCH_START()
    2318        GreatSuspender s;
    24 
    2519        BENCH(
    26                 for (size_t i = 0; i < n; i++) {
     20                for (size_t i = 0; i < times; i++) {
    2721                        s.do_resume();
    2822                },
    2923                result
    3024        )
     25        printf( "%g\n", result );
     26}
    3127
    32         printf("%g\n", result);
    33 }
     28// Local Variables: //
     29// tab-width: 4 //
     30// End: //
  • TabularUnified benchmark/ctxswitch/upp_thrd.cc

    r846c026 rb4107c8  
    33#include "bench.h"
    44
    5 int main(int argc, char* argv[]) {
     5int main( int argc, char * argv[] ) {
     6        BENCH_START()
    67        BENCH(
    7                 for (size_t i = 0; i < n; i++) {
     8                for (size_t i = 0; i < times; i++) {
    89                        uThisTask().yield();
    910                },
    1011                result
    1112        )
     13        printf( "%g\n", result );
     14}
    1215
    13         printf("%g\n", result);
    14 }
     16// Local Variables: //
     17// tab-width: 4 //
     18// End: //
  • TabularUnified benchmark/mutex/JavaThread.java

    r846c026 rb4107c8  
    2626        static int x = 2;
    2727
    28         static private final int NoOfTimes = Integer.parseInt("100000000") ;
     28        static private int times = Integer.parseInt("100000000");
    2929
    3030        public synchronized void noop() {
     
    3535                // Inhibit biased locking ...
    3636                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) {
    3838                        x = nextRandom(x);
    3939                        j.noop();
     
    4444                helper();
    4545                long end = System.nanoTime();
    46                 System.out.println( (end - start) / NoOfTimes );
     46                System.out.println( (end - start) / times );
    4747        }
    4848        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
    4952                for (int n = Integer.parseInt("5"); --n >= 0 ; ) {
    5053                        InnerMain();
     
    5558        }
    5659}
     60
     61// Local Variables: //
     62// tab-width: 4 //
     63// End: //
  • TabularUnified benchmark/mutex/cfa1.cfa

    r846c026 rb4107c8  
    77void __attribute__((noinline)) call( M & mutex m ) {}
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        M m;
    1112        BENCH(
    12                 for ( i; n ) {
    13                         call(m);
     13                for ( i; times ) {
     14                        call( m );
    1415                },
    1516                result
    1617        )
     18        printf( "%g\n", result );
     19}
    1720
    18         printf("%g\n", result);
    19 }
     21// Local Variables: //
     22// tab-width: 4 //
     23// End: //
  • TabularUnified benchmark/mutex/cfa2.cfa

    r846c026 rb4107c8  
    77void __attribute__((noinline)) call( M & mutex m1, M & mutex m2 ) {}
    88
    9 int main(int argc, char* argv[]) {
     9int main( int argc, char * argv[] ) {
     10        BENCH_START()
    1011        M m1, m2;
    1112        BENCH(
    12                 for ( i; n ) {
    13                         call(m1, m2);
     13                for ( i; times ) {
     14                        call( m1, m2 );
    1415                },
    1516                result
    1617        )
     18        printf( "%g\n", result );
     19}
    1720
    18         printf("%g\n", result);
    19 }
     21// Local Variables: //
     22// tab-width: 4 //
     23// End: //
  • TabularUnified benchmark/mutex/cfa4.cfa

    r846c026 rb4107c8  
    88void __attribute__((noinline)) call( M & mutex m1, M & mutex m2, M & mutex m3, M & mutex m4 ) {}
    99
    10 int main(int argc, char* argv[]) {
     10int main( int argc, char * argv[] ) {
     11        BENCH_START()
    1112        M m1, m2, m3, m4;
    1213        BENCH(
    13                 for ( i; n ) {
    14                         call(m1, m2, m3, m4);
     14                for ( i; times ) {
     15                        call( m1, m2, m3, m4 );
    1516                },
    1617                result
    1718        )
     19        printf( "%g\n", result );
     20}
    1821
    19         printf("%g\n", result);
    20 }
     22// Local Variables: //
     23// tab-width: 4 //
     24// End: //
  • TabularUnified benchmark/mutex/pthreads.c

    r846c026 rb4107c8  
    77
    88void __attribute__((noinline)) call() {
    9          pthread_mutex_lock  (&mutex);
    10          pthread_mutex_unlock(&mutex);
     9         pthread_mutex_lock( &mutex );
     10         pthread_mutex_unlock( &mutex );
    1111}
    12 
    13 int main(int argc, char* argv[]) {
     12int main( int argc, char * argv[] ) {
     13        BENCH_START()
    1414        BENCH(
    15                 for (size_t i = 0; i < n; i++) {
     15                for ( size_t i = 0; i < times; i++ ) {
    1616                        call();
    1717                },
    1818                result
    1919        )
     20        printf( "%g\n", result );
     21}
    2022
    21         printf("%g\n", result);
    22 }
     23// Local Variables: //
     24// tab-width: 4 //
     25// End: //
  • TabularUnified benchmark/mutex/upp.cc

    r846c026 rb4107c8  
    88};
    99
    10 int main(int argc, char* argv[]) {
     10int main( int argc, char * argv[] ) {
     11        BENCH_START()
    1112        MyMonitor m;
    1213        BENCH(
    13                 for (size_t i = 0; i < n; i++) {
     14                for ( size_t i = 0; i < times; i++ ) {
    1415                        m.call();
    1516                },
    1617                result
    1718        )
     19        printf( "%g\n", result );
     20}
    1821
    19         printf("%g\n", result);
    20 }
     22// Local Variables: //
     23// tab-width: 4 //
     24// End: //
  • TabularUnified benchmark/schedext/cfa1.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    1715int  __attribute__((noinline)) wait( M & mutex a1 ) {
    1816        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        }
    2720        go = 0;
    2821        return 0;
     
    3326void main( T & ) {
    3427        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 );
    3733}
    3834
    39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     35int main( int argc, char * argv[] ) {
     36        BENCH_START()
    4037        T t;
    41         return wait(m1);
     38        return wait( m1 );
    4239}
     40
     41// Local Variables: //
     42// tab-width: 4 //
     43// End: //
  • TabularUnified benchmark/schedext/cfa2.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    1715int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) {
    1816        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        }
    2720        go = 0;
    2821        return 0;
     
    3326void main( T & ) {
    3427        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 );
    3733}
    3834
    39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     35int main( int argc, char * argv[] ) {
     36        BENCH_START()
    4037        T t;
    41         return wait(m1, m2);
     38        return wait( m1, m2 );
    4239}
     40
     41// Local Variables: //
     42// tab-width: 4 //
     43// End: //
  • TabularUnified benchmark/schedext/cfa4.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    1715int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {
    1816        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        }
    2720        go = 0;
    2821        return 0;
     
    3326void main( T & ) {
    3427        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 );
    3733}
    3834
    39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     35int main( int argc, char * argv[] ) {
     36        BENCH_START()
    4037        T t;
    41         return wait(m1, m2, m3, m4);
     38        return wait( m1, m2, m3, m4 );
    4239}
     40
     41// Local Variables: //
     42// tab-width: 4 //
     43// End: //
  • TabularUnified benchmark/schedext/upp.cc

    r846c026 rb4107c8  
    33#include "bench.h"
    44
    5 int argc;
    6 char** argv;
    75volatile int go = 0;
    86
     
    1311        int __attribute__((noinline)) wait() {
    1412                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                }
    2316                go = 0;
    2417                return 0;
     
    3124        void main() {
    3225                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 );
    3531        }
    3632};
    3733
    38 int main(int margc, char* margv[]) {
    39         argc = margc;
    40         argv = margv;
     34int main( int argc, char * argv[] ) {
     35        BENCH_START()
    4136        T t;
    4237        return m.wait();
    4338}
     39
     40// Local Variables: //
     41// tab-width: 4 //
     42// End: //
  • TabularUnified benchmark/schedint/JavaThread.java

    r846c026 rb4107c8  
    4949        static int x = 2;
    5050
    51         static private final int NoOfTimes = Integer.parseInt("1000000") ;
     51        static private int times = Integer.parseInt("1000000");
    5252
    5353        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) {
    5555                        m.wait();               // relase monitor lock
    5656                        m.next = true;
     
    7272                Monitor.go = false;
    7373                s.join();
    74                 System.out.println( (end - start) / NoOfTimes);
     74                System.out.println( (end - start) / times);
    7575        }
    7676        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
    7780                for (int n = Integer.parseInt("5"); --n >= 0 ; ) {
    7881                        InnerMain();
     
    8386        }
    8487}
     88
     89// Local Variables: //
     90// tab-width: 4 //
     91// End: //
  • TabularUnified benchmark/schedint/cfa1.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    2624                result
    2725        )
    28 
    29         printf("%g\n", result);
     26        printf( "%g\n", result );
    3027        go = 0;
    3128        return 0;
     
    4037}
    4138
    42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     39int main( int argc, char * argv[] ) {
     40        BENCH_START()
    4341        T t;
    4442        return wait(m1);
    4543}
     44
     45// Local Variables: //
     46// tab-width: 4 //
     47// End: //
  • TabularUnified benchmark/schedint/cfa2.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    2624                result
    2725        )
    28 
    29         printf("%g\n", result);
     26        printf( "%g\n", result );
    3027        go = 0;
    3128        return 0;
     
    4037}
    4138
    42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     39int main( int argc, char * argv[] ) {
     40        BENCH_START()
    4341        T t;
    4442        return wait(m1, m2);
    4543}
     44
     45// Local Variables: //
     46// tab-width: 4 //
     47// End: //
  • TabularUnified benchmark/schedint/cfa4.cfa

    r846c026 rb4107c8  
    66#include "bench.h"
    77
    8 int argc;
    9 char** argv;
    108volatile int go = 0;
    119
     
    2624                result
    2725        )
    28 
    29         printf("%g\n", result);
     26        printf( "%g\n", result );
    3027        go = 0;
    3128        return 0;
     
    4037}
    4138
    42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     39int main( int argc, char * argv[] ) {
     40        BENCH_START()
    4341        T t;
    4442        return wait(m1, m2, m3, m4);
    4543}
     44
     45// Local Variables: //
     46// tab-width: 4 //
     47// End: //
  • TabularUnified benchmark/schedint/pthreads.c

    r846c026 rb4107c8  
    44#include "bench.h"
    55
    6 int argc;
    7 char** argv;
    86volatile int go = 0;
    97
     
    2119        go = 1;
    2220        BENCH(
    23                 for (size_t i = 0; i < n; i++) {
     21                for (size_t i = 0; i < times; i++) {
    2422                        pthread_cond_wait(&c, &m);
    2523                },
    2624                result
    2725        )
    28 
    29         printf("%g\n", result);
     26        printf( "%g\n", result );
    3027        go = 0;
    3128        pthread_mutex_unlock(&m);
     
    3936}
    4037
    41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     38int main( int argc, char * argv[] ) {
     39        BENCH_START()
    4240        pthread_t thread;
    4341        if (pthread_create(&thread, NULL, thread_main, NULL) < 0) {
     
    5048                return 1;
    5149        }
    52         return 0;
    5350}
     51
     52// Local Variables: //
     53// tab-width: 4 //
     54// End: //
  • TabularUnified benchmark/schedint/upp.cc

    r846c026 rb4107c8  
    33#include "bench.h"
    44
    5 int argc;
    6 char** argv;
    75volatile int go = 0;
    86
     
    2220                        result
    2321                )
    24 
    25                 printf("%g\n", result);
     22                printf( "%g\n", result );
    2623                go = 0;
    2724                return 0;
     
    3936};
    4037
    41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
     38int main( int argc, char * argv[] ) {
     39        BENCH_START()
    4240        T t;
    4341        return m.wait();
    4442}
     43
     44// Local Variables: //
     45// tab-width: 4 //
     46// End: //
Note: See TracChangeset for help on using the changeset viewer.