Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorporating cProfile output into the page #39

Open
havok2063 opened this issue Jun 9, 2016 · 1 comment
Open

incorporating cProfile output into the page #39

havok2063 opened this issue Jun 9, 2016 · 1 comment
Labels

Comments

@havok2063
Copy link

I really like the webpage output of the endpoint statistics. It would be great to include the output from cProfile for each out as well, perhaps even in a visual way. I can see the option of clicking on one of the routes on the main page, and instead of simply displaying the detailed header info, it takes you to a new page that has that header info plus the detailed output from cProfile. How feasible is this?

Flask has a built-in profiler that you can run, which I'm currently using. It would be great to combine these two somehow. http://werkzeug.pocoo.org/docs/0.11/contrib/profiler/

The relevant code lines are

from werkzeug.contrib.profiler import ProfilerMiddleware, MergeStream

if logdirs:
logpath = os.path.join(logdirs, 'profile.log')
file = open(logpath, 'w')
stream = MergeStream(sys.stdout, file)
else:
stream = None

app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30], stream=stream)
app.run(debug=True, port=args.port)

@muatik
Copy link
Owner

muatik commented Jun 11, 2016

Indeed, in the past, I thought the same. but I did not have enough time. maybe, somebody who is willing to contribute or I can work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants