Search code examples
pythonmayacprofilepymel

How to output a .cprofile file from script


I'm using the cProfiler in my script. I'd like to output the .cprofile file with results. I want to get the output file that is not human readable and later open it in snakeviz. Is that possible?

I cannot use the

python -m cProfile -o program.prof my_program.py

command, because I'm runing the script with the Python interpreter embedded in the Autodesk Maya software in gui mode.


Solution

  • Ok, I've asked the question too soon. I've found that:

    cProfile.run('function', 'path')
    

    can do this