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

Filter out "comments" in inferno-flamegraph input #237

Closed
mrob95 opened this issue May 1, 2022 · 1 comment
Closed

Filter out "comments" in inferno-flamegraph input #237

mrob95 opened this issue May 1, 2022 · 1 comment

Comments

@mrob95
Copy link
Contributor

mrob95 commented May 1, 2022

The austin Python profiler includes some metadata as "comments" in its output, e.g.:

# austin: 3.3.0
# interval: 100
# mode: wall
# python: 3.9.10

P247;T247;<frozen importlib._bootstrap>:_install_external_importers:1187;<frozen importlib._bootstrap>:_find_and_load:1007;<frozen importlib._bootstrap>:_find_and_load_unlocked:986;<frozen importlib._bootstrap>:_load_unlocked:680;<frozen importlib._bootstrap>:exec_module:838;<frozen importlib._bootstrap_external>:<module>:35;<frozen importlib._bootstrap>:_find_and_load:1007;<frozen importlib._bootstrap>:_find_and_load_unlocked:986;<frozen importlib._bootstrap>:_load_unlocked:680;<frozen importlib._bootstrap>:exec_module:768;<frozen importlib._bootstrap>:_call_with_frames_removed:228 53
...
P247;T247;/home/mike/profiling/test.py:<module>:6;/usr/lib/python3.9/dis.py:dis:79;/usr/lib/python3.9/dis.py:_disassemble_recursive:373;/usr/lib/python3.9/dis.py:disassemble:369;/usr/lib/python3.9/dis.py:_disassemble_bytes:404 180

# duration: 695345
# sampling: 6,15,159
# saturation: 10/3898
# errors: 4/3898

Most of these are correctly ignored as invalid lines by inferno-flamegraph, but some (like # duration: 695345) look enough like a valid sample to end up in the output svg. I think the original perl version correctly identifies all of them as invalid, since it uses a strict regex to parse lines.

It's fairly trivial to work around this with a sed '/^#/d', but it would be nice for austin and inferno-flamegraph to work together smoothly.

Would you accept a PR to filter out all lines which begin with # in inferno-flamegraph?

Thanks

@jonhoo
Copy link
Owner

jonhoo commented May 1, 2022

Absolutely — that seems reasonable!

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

2 participants