Where does uWSGI put its profiler file?

2.1k Views Asked by At

I'm using uWSGI with the "--profiler" flag switched on but I can't seem to find the output file (if there is one), and (like many things in uWSGI) this isn't properly documented.

2

There are 2 best solutions below

0
On

A useful trick is to use uWSGIs logger to filter out the profiler logs into their own file:

uwsgi \
    << other uwsgi options >> \
    --logger profiler file:/path/to/profile.log \
    --log-route profiler uWSGI Python profiler
0
On

I just got this problem today. Here is a good project, you can use: https://github.com/what-studio/profiling

I used it from my code, like this:

from profiling.tracing import TracingProfiler

profiler = TracingProfiler()
profiler.start()
# ... run your program...
profiler.stop()
# save profile data to file
profiler.dump('path/to/file')