Skip to content

Commit 6332382

Browse files
committed
Profile
1 parent 44a4341 commit 6332382

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,14 +1423,16 @@ timeit('"-".join(str(a) for a in range(100))',
14231423
number=10000, globals=globals())
14241424
```
14251425

1426-
### PyCallGraph
1426+
### Call Graph
14271427
#### Generates a PNG image of call graph and highlights the bottlenecks.
14281428
```python
14291429
# $ pip3 install pycallgraph
1430-
import pycallgraph
1431-
graph = pycallgraph.output.GraphvizOutput()
1432-
graph.output_file = get_filename()
1433-
with pycallgraph.PyCallGraph(output=graph):
1430+
from pycallgraph import output, PyCallGraph
1431+
from datetime import datetime
1432+
graph = output.GraphvizOutput()
1433+
time_str = datetime.now().strftime('%Y%m%d%H%M%S')
1434+
graph.output_file = f'profile-{time_str}.png'
1435+
with PyCallGraph(output=graph):
14341436
<code_to_be_profiled>
14351437
```
14361438

0 commit comments

Comments
 (0)