From 1858ff16f33e052025bebe27d96db1b45eebb11a Mon Sep 17 00:00:00 2001 From: Marcel Koch <marcel.koch@uni-muenster.de> Date: Wed, 24 Apr 2019 17:14:19 +0200 Subject: [PATCH] adds function to get ssc marks --- python/dune/codegen/pdelab/driver/timings.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/python/dune/codegen/pdelab/driver/timings.py b/python/dune/codegen/pdelab/driver/timings.py index 7089a0f1..fc8cf3b7 100644 --- a/python/dune/codegen/pdelab/driver/timings.py +++ b/python/dune/codegen/pdelab/driver/timings.py @@ -170,12 +170,16 @@ def init_region_timer(region): post_include("HP_DECLARE_TIMER({});".format(region), filetag="driver") +def get_region_marks(region): + return _sde_marks.setdefault(region, (2 * (len(_sde_marks) + 1), 2 * (len(_sde_marks) + 1) + 1)) + + def start_region_timer(region): if get_option("use_likwid"): return ["LIKWID_MARKER_START(\"{}\");".format(region)] elif get_option("use_sde"): - _sde_marks[region + '_start'] = len(_sde_marks) - return ["__SSC_MARK(0x{});".format(_sde_marks[region + '_start'])] + marks = get_region_marks(region) + return ["__SSC_MARK(0x{});".format(marks[0])] else: return ["HP_TIMER_START({});".format(region)] @@ -184,10 +188,9 @@ def stop_region_timer(region): if get_option("use_likwid"): return ["LIKWID_MARKER_STOP(\"{}\");".format(region)] elif get_option("use_sde"): - _sde_marks[region + '_stop'] = len(_sde_marks) - return ["__SSC_MARK(0x{});".format(_sde_marks[region + '_stop']), - "std::cout << \"Timed region {}: {} <--> {}\" << std::endl;".format(region, _sde_marks[region + '_start'], - _sde_marks[region + '_stop'])] + marks = get_region_marks(region) + return ["__SSC_MARK(0x{});".format(marks[1]), + "std::cout << \"Timed region {}: {} <--> {}\" << std::endl;".format(region, *marks)] else: timestream = name_timing_stream() return ["HP_TIMER_STOP({});".format(region), -- GitLab