Skip to content

Commit f9d21e9

Browse files
authored
Merge pull request nico#24 from theidexisted/master
Tiny optimization: Move time calc out of loop
2 parents 21b9ff0 + bf849c9 commit f9d21e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ninjatracing

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def read_events(trace, options):
9898
def trace_to_dicts(target, trace, options, pid, tid):
9999
"""Read a file-like object |trace| containing -ftime-trace data and yields
100100
about:tracing dict per eligible event in that log."""
101+
ninja_time = (target.end - target.start) * 1000
101102
for event in read_events(trace, options):
102103
# Check if any event duration is greater than the duration from ninja.
103-
ninja_time = (target.end - target.start) * 1000
104104
if event['dur'] > ninja_time:
105105
print("Inconsistent timing found (clang time > ninja time). Please"
106106
" ensure that timings are from consistent builds.")

0 commit comments

Comments
 (0)