ADTast-experimentalpthread-emulation
Last change
on this file since fbb930e was
c12869e,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
update benchmarks for concurrency paper
|
-
Property mode set to
100644
|
File size:
380 bytes
|
Rev | Line | |
---|
[c12869e] | 1 | import sys |
---|
| 2 | import time |
---|
| 3 | |
---|
| 4 | times = 50000000 |
---|
| 5 | argc = len( sys.argv ) |
---|
| 6 | if argc > 2: |
---|
| 7 | sys.exit( 1 ) |
---|
| 8 | if argc == 2: |
---|
| 9 | times = int( sys.argv[1] ) |
---|
| 10 | |
---|
| 11 | def C(): |
---|
| 12 | yield |
---|
| 13 | |
---|
| 14 | start = time.time_ns() |
---|
| 15 | for i in range( 10000000 ): |
---|
| 16 | c = C() |
---|
| 17 | next( c ) # resume |
---|
| 18 | end = time.time_ns() |
---|
| 19 | print( (end - start) / times ) |
---|
| 20 | |
---|
| 21 | # Local Variables: # |
---|
| 22 | # tab-width: 4 # |
---|
| 23 | # compile-command: "python3.7 python_cor.py" # |
---|
| 24 | # End: # |
---|
Note: See
TracBrowser
for help on using the repository browser.