source: benchmark/mutex/goroutine.go @ b4107c8

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since b4107c8 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

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

  • Property mode set to 100644
File size: 440 bytes
RevLine 
[b4107c8]1package main
2
3import (
4    "fmt"
5    "time"
6    "flag"
7    "sync"
8)
9
10var mutex sync.Mutex
11
12func call() {
13     mutex.Lock();
14     mutex.Unlock();
15}
16func main() {
17        times := flag.Int( "times", 10000000, "loop iterations" )
18        flag.Parse()
19        start := time.Now()
20        for i := 1; i <= *times; i += 1 {
21                call();
22        }
23        end := time.Now()
24        fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) )
25}
26
27// Local Variables: //
28// tab-width: 4 //
29// End: //
Note: See TracBrowser for help on using the repository browser.