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

Output a new profile programmatically #483

Open
Salah-Shihaibi opened this issue Nov 9, 2022 · 3 comments
Open

Output a new profile programmatically #483

Salah-Shihaibi opened this issue Nov 9, 2022 · 3 comments

Comments

@Salah-Shihaibi
Copy link

Salah-Shihaibi commented Nov 9, 2022

Is there a way to output a new profile report programmatically in python?

@sternj
Copy link
Collaborator

sternj commented Nov 9, 2022

I am unsure what you're asking, perhaps you're asking about the --json flag or the --profile-interval flag?

@Salah-Shihaibi
Copy link
Author

Salah-Shihaibi commented Nov 10, 2022

Sorry the question was a bit vague, I have a python script shown below and I was wondering if there was a function 'print_profile_json' that can print out the json file before the code stops executing. --profile-interval does this periodically but I was wondering if it can be done by sending a signal from python.

do_something_forever():
        '''some code'''
    scalene_profiler.start()
        '''some code'''
    scalene_profiler.stop()
    scalene_profiler.print_profile_json(file_path='/data')
        ''' some code'''


if __name__ == "__main__":
    while True:
        do_something_forever()
        time.sleep(0.5)

python -m scalene --reduced-profile --off main.py

@Rmsharks4
Copy link

did you find a solution for this? I'm trying to grasp the output in a python-dict format as well programmatically #546

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

No branches or pull requests

3 participants