source: benchmark/mutex/goroutine.go@ 6e540ea

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 6e540ea was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 6 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
Line 
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.