Programmatically Creating A FlameGraph .htm file #847
-
|
Hey all, So right now Im just experimenting with memray and really liking it so far. However, I really wanted handle some stuff programmatically instead of using the command line. I have this snippet of code from memray import FileReader, Tracker subprocess.run(["rm", "-f", "memray_output.bin"], check=True) Where Im using the Tracker and then trying to create the FlameGraph. I mainly pulled this code from looking at unit tests and playing around. However, where Im stuck is the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Memray does not yet have a stable, supported API for generating reports. The only documented API that we expose is the tracking API - Also, this is unrelated to your question, but with Tracker(output_file):
subprocess.run(["python3", "test.py"], check=True)is probably not doing what you want it to do. That's not tracking the memory usage of subprocess.run([sys.executable, "-m", "memray", "run", "-o", output_file, "test.py"]) |
Beta Was this translation helpful? Give feedback.
Memray does not yet have a stable, supported API for generating reports. The only documented API that we expose is the tracking API -
memray.Tracker, along with thememray.FileDestinationandmemray.SocketDestinationandmemray.FileFormatthat are used with it. We've always intended to eventually provide a public API for parsing and processing the raw capture files, but we've never gotten around to it. All of which is to say: please don't usememray.reporters.flamegraph.FlameGraphReporter.renderto produce a flame graph, please instead usesubprocess.run(["memray", "flamegraph", ...])to generate the flame graph.Also, this is unrelated to your question, but