ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 580c11b was
b4107c8,
checked in by Peter A. Buhr <pabuhr@…>, 5 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
|
Rev | Line | |
---|
[b4107c8] | 1 | package main |
---|
| 2 | |
---|
| 3 | import ( |
---|
| 4 | "fmt" |
---|
| 5 | "time" |
---|
| 6 | "flag" |
---|
| 7 | "sync" |
---|
| 8 | ) |
---|
| 9 | |
---|
| 10 | var mutex sync.Mutex |
---|
| 11 | |
---|
| 12 | func call() { |
---|
| 13 | mutex.Lock(); |
---|
| 14 | mutex.Unlock(); |
---|
| 15 | } |
---|
| 16 | func 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.