MCPcopy Create free account
hub / github.com/pytorch/executorch / adjust_time_scale

Function adjust_time_scale

profiler/parse_profiler_results.py:108–122  ·  view source on GitHub ↗
(event: ProfileData, time_scale: TimeScale)

Source from the content-addressed store, hash-verified

106
107
108def adjust_time_scale(event: ProfileData, time_scale: TimeScale):
109 time_div_factor = {
110 TimeScale.CPU_CYCLES: 1,
111 TimeScale.TIME_IN_MS: 1,
112 TimeScale.TIME_IN_US: 1000,
113 TimeScale.TIME_IN_NS: 1000000,
114 }
115 div_factor = time_div_factor[time_scale]
116 if div_factor != 1:
117 duration = round((event.end_time - event.start_time) / div_factor, 4)
118 start_time = round((event.start_time) / div_factor, 4)
119 else:
120 duration = event.end_time - event.start_time
121 start_time = event.start_time
122 return start_time, duration
123
124
125def parse_prof_blocks(

Callers 1

parse_prof_blocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected