Commit 6887a0c90b77ce124b607146bb6146d9398a875c
1 parent
e6f1858b
Collect elapsed CPU seconds for multi-threading (#3592)
Showing
1 changed file
with
6 additions
and
0 deletions
cscripts/mputils.py
| @@ -105,6 +105,12 @@ def process(nthreads, function, args): | @@ -105,6 +105,12 @@ def process(nthreads, function, args): | ||
| 105 | pool.close() | 105 | pool.close() |
| 106 | pool.join() | 106 | pool.join() |
| 107 | 107 | ||
| 108 | + # Add CPU times of child processes to CPU time of parent | ||
| 109 | + nchilds = len(args) | ||
| 110 | + for i in range(nchilds): | ||
| 111 | + celapse = results[i][1]['celapse'] | ||
| 112 | + args[i][0]._add_celapse(celapse) | ||
| 113 | + | ||
| 108 | # Return results | 114 | # Return results |
| 109 | return results | 115 | return results |
| 110 | 116 |