Skip to content
Snippets Groups Projects
Commit e92b8dc8 authored by René Heß's avatar René Heß
Browse files

Merge branch 'feature/cleanup_timer' into 'feature/application'

"Cleanup timer statements"

See merge request !99
parents 3ab527e7 9466a4a2
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
#define HP_TIMER_OPCOUNTERS(name) __hp_timer_##name##_counters
#define HP_TIMER_ELAPSED(name) std::chrono::duration_cast<std::chrono::duration<double> >( HP_TIMER_DURATION(name) ).count()
#ifdef ENABLE_HP_TIMERS
#ifdef ENABLE_COUNTER
......@@ -38,7 +40,7 @@
#define HP_TIMER_RESET(name) \
do { \
HP_TIMER_DURATION(name) = std::chrono::high_resolution_clock::duration::zero(); \
HP_TIMER_DURATION(name) = std::chrono::high_resolution_clock::duration::zero(); \
HP_TIMER_OPCOUNTERS(name).reset(); \
} while (false)
......@@ -69,6 +71,8 @@
#endif // ENABLE_HP_TIMERS
#ifdef ENABLE_COUNTER
#define DUMP_TIMER(name,os,reset)\
......
......@@ -44,13 +44,10 @@ def constructor_parameter(_type, name):
def dump_accumulate_timer(name):
from dune.perftool.pdelab.localoperator import (name_time_dumper_os,
name_time_dumper_reset,
name_time_dumper_t,
name_time_dumper_counter,
name_time_dumper_exec,)
os = name_time_dumper_os()
reset = name_time_dumper_reset()
t = name_time_dumper_t()
counter = name_time_dumper_counter()
# reset = name_time_dumper_reset()
reset = 'false'
code = "DUMP_AND_ACCUMULATE_TIMER({},{},{},{},{});".format(name, os, reset, t, counter)
code = "DUMP_TIMER({},{},{});".format(name, os, reset)
return code
......@@ -530,14 +530,6 @@ def name_time_dumper_reset():
return "reset"
def name_time_dumper_t():
return "t"
def name_time_dumper_counter():
return "counter"
def name_time_dumper_exec():
return "exec"
......@@ -551,25 +543,15 @@ class TimerMethod(ClassMember):
def __init__(self):
os = name_time_dumper_os()
reset = name_time_dumper_reset()
t = name_time_dumper_t()
ex = name_time_dumper_exec()
knl = name_example_kernel()
assert(knl is not None)
content = ["template <typename Stream>",
"void dump_timers(Stream& {}, char* {}, bool {})".format(os, ex, reset),
"{",
" double {} = 0.0;".format(t),
"#ifdef ENABLE_COUNTER",
" auto counter = HP_TIMER_OPCOUNTERS({});".format(knl),
" counter.reset();",
"#endif",
""]
"{"]
dump_timers = [i for i in retrieve_cache_items(condition='dump_timers')]
content.extend(map(lambda x: ' ' + x, dump_timers))
content.extend(["#ifdef ENABLE_COUNTERS",
" counter.reportOperations({});".format(os),
"#endif"])
content.append("}")
ClassMember.__init__(self, content)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment