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

Profiling PyPy using the Firefox profiler user interface | PyPy #150

Open
utterances-bot opened this issue Jan 22, 2025 · 1 comment
Open
Labels

Comments

@utterances-bot
Copy link

Profiling PyPy using the Firefox profiler user interface | PyPy

https://www.pypy.org/posts/2024/05/vmprof-firefox-converter.html

Copy link
Member

mattip commented Jan 22, 2025

Summarizing the steps to recreate the flame graph here:

import collections, sys
counts = collections.Counter()
remaining = ''
while True:
    chunk = remaining + sys.stdin.read(64*1024)
    if not chunk:
        break
    last_lf = chunk.rfind('\n')  # process to last LF character
    if last_lf == -1:
        remaining = ''
    else:
        remaining = chunk[last_lf+1:]
        chunk = chunk[:last_lf]
    counts.update(chunk.lower().split())

for word, count in counts.most_common():
    print(word, count)
  • pip install vmprof flask_cors
  • clone the converter repo, since it is not yet pip-installable git clone https://github.com/Cskorpion/vmprof-firefox-converter
  • run the test cd vmprof-firefox-converter; python -m vmprofconvert -run test_vmprof.py < ~/Downloads/kjvbible.txt
  • when the browser opens, click on "1/3 tracks" and change it to "show all tracks"
  • then click on the "Thread 0" track

@mattip mattip added the Comments label Jan 22, 2025 — with utterances
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