Is there a way to run cProfile or line_profile on a script on a server?
ie: how could I get the results for one of the two methods on http://www.Example.com/cgi-bin/myScript.py
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not sure what
line_profileis. ForcProfile, you just need to direct the results to a file you can later read on the server (depending on what kind of access you have to the server).To quote the example from the docs,
and put all the rest of the code into a
def foo():— then later retrieve thatfooproffile and analyze it at leisure (assuming your script runs with permissions to write it in the first place, of course).Of course you can ensure different runs get profiled into different files, etc, etc — whether this is practical also depends on what kind of access and permissions you’re getting from your hosting provider, i.e., how are you allowed to persist data, in a way that lets you retrieve that data later? That’s not a question of Python, it’s a question of contracts between you and your hosting provider;-).