Skip to content

Commit 1771d71

Browse files
committed
added profile module example to tooling doc
1 parent ca5f410 commit 1771d71

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

docs/user/Tooling.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ For example, it does not currently track calls, only line counts and called func
3939
The `_lsprof` built-in module has been implemented using the GraalVM `cpusampler` tool.
4040
Not all profiling features are currently supported, but basic profiling works:
4141
```shell
42-
graalpy -m cProfile -s sort -m ginstall --help
42+
graalpy -m cProfile -s calls -m ginstall --help
4343
```
4444

4545
The interactive exploration of a stats output file also works:
@@ -50,3 +50,24 @@ ginstall.profile%
5050
callers
5151
[...]
5252
```
53+
54+
The profile module works as well:
55+
```shell
56+
graalpy -m profile -s calls -m ginstall --help
57+
```
58+
or
59+
```shell
60+
>>> import profile
61+
>>> profile.run('l = []; l.append(1)')
62+
5 function calls in 0.002 seconds
63+
64+
Ordered by: standard name
65+
66+
ncalls tottime percall cumtime percall filename:lineno(function)
67+
1 0.000 0.000 0.000 0.000 :0(_setprofile)
68+
1 0.000 0.000 0.000 0.000 :0(append)
69+
1 0.000 0.000 0.001 0.001 :0(exec)
70+
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
71+
1 0.001 0.001 0.002 0.002 profile:0(l = []; l.append(1))
72+
0 0.000 0.000 profile:0(profiler)
73+
```

0 commit comments

Comments
 (0)