summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-08 08:21:10 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-08 08:21:10 +0200
commit605f66e758fe955c543113c9f29b549c9e7de54f (patch)
treef677e52d4ea7d0ac55efdd600675f3155085cf1c
parent71b54b103f8290377a6a5afe5c32edf9cdae9240 (diff)
callcycles_median: subtract nop cycles
-rw-r--r--lib/data_parameters.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/data_parameters.py b/lib/data_parameters.py
index 9b5a875..fd78079 100644
--- a/lib/data_parameters.py
+++ b/lib/data_parameters.py
@@ -131,7 +131,10 @@ class Protolog:
if val > 10_000_000:
return np.nan
# All measurements in data[key] cover the same instructions, so they
- # should be identical.
+ # should be identical -> it's safe to take the median.
+ # However, we leave out the first measurement as it is often bogus.
+ if key == 'nop':
+ return np.median(data['nop'][1:])
return max(0, int(np.median(data[key][1:]) - np.median(data['nop'][1:])))
def _median_callcycles(data):
@@ -147,6 +150,8 @@ class Protolog:
['bss_serdes', 'bss_size_serdes', idem],
['callcycles_raw', 'callcycles', idem],
['callcycles_median', 'callcycles', _median_callcycles],
+ # Used to remove nop cycles from callcycles_median
+ ['cycles_nop', 'cycles', lambda x: Protolog._median_cycles(x, 'nop')],
['cycles_ser', 'cycles', lambda x: Protolog._median_cycles(x, 'ser')],
['cycles_des', 'cycles', lambda x: Protolog._median_cycles(x, 'des')],
['cycles_enc', 'cycles', lambda x: Protolog._median_cycles(x, 'enc')],
@@ -219,6 +224,11 @@ class Protolog:
except KeyError:
pass
try:
+ for line in val['callcycles_median'].keys():
+ val['callcycles_median'][line] -= val['cycles_nop']
+ except KeyError:
+ pass
+ try:
val['total_dmem_ser'] = val['stack_alloc_ser']
val['total_dmem_ser'] += val['heap_ser']
except KeyError: