Skip to content

Commit abc73c9

Browse files
committed
vmprof-firefox-blog first draft
1 parent 07d6a79 commit abc73c9

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

posts/2024/05/vmprof-firefox.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!--
2+
.. title: vmprof-firefox-converter
3+
.. slug:
4+
.. date: 2024-04-15 13:49:00 UTC
5+
.. tags:
6+
.. category:
7+
.. link:
8+
.. description:
9+
.. type: text
10+
.. author: Christoph Jung
11+
-->
12+
13+
# Introduction
14+
15+
If you ever wanted to profile your Python code on PyPy, you probably came across VMProf.
16+
17+
Vmprof's console output can already give some insights into where your code spends time,
18+
but it is far from showing all the information VMProf captures while profiling.
19+
20+
Created in the context of my bachelor's thesis, the vmprof-firefox-converter is a tool for viewing VMProf profiles with the Firefox profilers user interface.
21+
Here you can zoom into profiles, look at different visualizations like flamegraphs,
22+
or even dive deeper into jitted functions.
23+
24+
25+
# Usage
26+
27+
Profile your code with VMProf
28+
29+
`pypy -m vmprof -o profile.prof yourcode.py <args>`
30+
31+
Then convert the output file
32+
33+
`pypy -m vmprofconvert -convert profile.prof`
34+
35+
Or let the converter take care of everything and run your code directly
36+
37+
`pypy -m vmprofconvert -run yourcode.py <args>`
38+
39+
Both `-convert` and `-run` will magically open the Firefox profiler in your browser
40+
41+
![firefox profiler](https://github.com/Cskorpion/vmprof-firefox-converter/blob/main/images/firefox.png?raw=true)
42+
43+
You may even create a sharable zip file that contains all the files necessary for investigating performance issues on another (person's) system.
44+
45+
(This includes jitlog, pypylog, all the source files and of course the profile itself)
46+
47+
`pypy -m vmprofconvert --zip -run yourcode.py <args>`
48+
49+
# Getting started
50+
51+
Even though VMProf (and the converter) were created for profiling PyPy, you can also use them with CPython.
52+
53+
You can get the converter from [GitHub](https://github.com/Cskorpion/vmprof-firefox-converter)

0 commit comments

Comments
 (0)