MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / dump

Method dump

imperative/python/megengine/utils/profiler.py:205–227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203 return self
204
205 def dump(self):
206 if self._dump_callback is not None:
207 if not os.path.exists(self._path):
208 os.makedirs(self._path)
209 if not os.path.isdir(self._path):
210 get_logger().warning(
211 "{} is not a directory, cannot write profiling results".format(
212 self._path
213 )
214 )
215 return
216 for format in self._formats:
217 path = self.format_path(self._path, self._pid, format)
218 get_logger().info("process {} generating {}".format(self._pid, format))
219 self._dump_callback(path, format)
220 get_logger().info("profiling results written to {}".format(path))
221 if os.path.getsize(path) > 64 * 1024 * 1024:
222 get_logger().warning(
223 "profiling results too large, maybe you are profiling multi iters,"
224 "consider attach profiler in each iter separately"
225 )
226 self._dump_callback = None
227 _living_profilers.remove(self)
228
229 def format_path(self, path, pid, format):
230 return os.path.join(path, "{}.{}".format(pid, format))

Callers 4

mainFunction · 0.95
__del__Method · 0.95
merge_trace_eventsFunction · 0.45
_stop_current_profilerFunction · 0.45

Calls 5

format_pathMethod · 0.95
get_loggerFunction · 0.85
formatMethod · 0.45
infoMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected