Skip to content

Commit

Permalink
Only write out non-trivial statistics
Browse files Browse the repository at this point in the history
This should filter out processes that merely import `distributed` or use
other functionality that is not actively profiled from the results. As a
result should make the results easier to parse.
  • Loading branch information
jakirkham committed Nov 23, 2020
1 parent 97ddced commit 3562816
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,15 @@

try:
import line_profiler

profile = line_profiler.LineProfiler()
atexit.register(profile.dump_stats, f"prof_{os.getpid()}.lstat")

def dump_stats(p):
s = p.get_stats()
if any(s.timings.values()):
profile.dump_stats(f"prof_{os.getpid()}.lstat")

atexit.register(dump_stats, profile)
except ImportError:
def profile(func):
return func
Expand Down

0 comments on commit 3562816

Please sign in to comment.