Skip to content

Commit

Permalink
upload pt2 cprofile stats to manifold
Browse files Browse the repository at this point in the history
Summary:
https://fb.workplace.com/groups/257735836456307/permalink/657458576484029/

upload cprofile to manifold

D56696397 has a script to convert profiler stats to dot graphs (see its test plan)

Differential Revision: D56679561
  • Loading branch information
dshi7 authored and facebook-github-bot committed Apr 29, 2024
1 parent 9c93876 commit e5b6ef6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
ValuesView,
)

from torch._utils_internal import maybe_upload_prof_stats_to_manifold

from ..utils.hooks import RemovableHandle

try:
Expand Down Expand Up @@ -144,7 +146,7 @@ def cprofile_wrapper(func):
def profile_wrapper(*args, **kwargs):
global timer_counter
profile_cnt = next(timer_counter)
profile_path = Path(func.__name__ + f"{profile_cnt}.profile")
profile_path = Path("/tmp/" + func.__name__ + f"{profile_cnt}.profile")
prof = cProfile.Profile()
prof.enable()
start_ts = time.time()
Expand Down Expand Up @@ -182,6 +184,9 @@ def profile_wrapper(*args, **kwargs):
)
ps.sort_stats(pstats.SortKey.TIME).print_stats(20)
ps.sort_stats(pstats.SortKey.CUMULATIVE).print_stats(20)

maybe_upload_prof_stats_to_manifold(str(profile_path)) # fb-only

return retval

return profile_wrapper
Expand Down

0 comments on commit e5b6ef6

Please sign in to comment.