Skip to content

Commit

Permalink
add timing code back
Browse files Browse the repository at this point in the history
  • Loading branch information
bmyerz committed Jun 6, 2014
1 parent e64d5b2 commit 2747ca5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion raco/grappalang.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def group_wrap(ident, grpcode, attrs):
auto end_%(ident)s = walltime();
auto runtime_%(ident)s = end_%(ident)s - start_%(ident)s;
%(timer_metric)s += runtime_%(ident)s;
VLOG(1) << "pipeline %(ident)s: " << runtime_%(ident)s << " s";
VLOG(1) << "pipeline group %(ident)s: " << runtime_%(ident)s << " s";
""")

timer_metric = None
Expand All @@ -105,6 +105,17 @@ def group_wrap(ident, grpcode, attrs):
def pipeline_wrap(ident, plcode, attrs):
code = plcode

# timing code
if True:
inner_code = code
timing_template = ct("""auto start_%(ident)s = walltime();
%(inner_code)s
auto end_%(ident)s = walltime();
auto runtime_%(ident)s = end_%(ident)s - start_%(ident)s;
VLOG(1) << "pipeline %(ident)s: " << runtime_%(ident)s << " s";
""")
code = timing_template % locals()

syncname = attrs.get('sync')
if syncname:
inner_code = code
Expand Down

0 comments on commit 2747ca5

Please sign in to comment.