scalene icon indicating copy to clipboard operation
scalene copied to clipboard

Memory benchmark only shows parent function usage.

Open ooliver1 opened this issue 2 years ago • 2 comments
trafficstars

Discussed in https://github.com/plasma-umass/scalene/discussions/584

Moved to an issue since discussions seem to be ignored.

Originally posted by ooliver1 March 22, 2023 Using

        async def runner():
            try:
                await self.start(*args, **kwargs)
            finally:
                if not self.is_closed():
                    await self.close()

        def stop_loop_on_completion(f):
            loop.stop()

        future = asyncio.ensure_future(runner(), loop=loop)
        future.add_done_callback(stop_loop_on_completion)
        try:
            loop.run_forever()

causes the wrapping function to show as the biggest memory hog, how would I get it to show the actual functions taking memory?

ENTRYPOINT ["poetry", "run", "python3"]
CMD ["-m", "scalene", "scale.py", "--profile-interval", "60", "--json", "--outfile", "profile.json", "--profile-all", "--stacks", "--profile-exclude", "/usr/local/lib"]

image

ooliver1 avatar Apr 02 '23 18:04 ooliver1

Have similar issue

Parent function % of time = 100.0% (1m:21.710s / 1m:21.710s) this corresponds to this line asyncio.run()

every other functions % of time = 0.0% ( 0ms / 1m:21.710s)

dheerajck avatar Apr 04 '24 14:04 dheerajck

does scalene converts 0.5 seconds or lets says 10ms to 0s, if not this seems like a bug

dheerajck avatar Apr 04 '24 14:04 dheerajck