diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/data_parameters.py | 12 |
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: |