Skip to content

Commit ae481ed

Browse files
committed
Fixed last commit
1 parent 05aeeda commit ae481ed

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,23 @@ duration = time() - start_time
13391339
from timeit import timeit
13401340
timeit('"-".join(str(n) for n in range(100))',
13411341
number=10000, globals=globals())
1342+
```
13421343

1344+
#### Generates a PNG image of call graph and highlights the bottlenecks:
1345+
```python
1346+
# $ pip3 install pycallgraph
1347+
import pycallgraph
1348+
graph = pycallgraph.output.GraphvizOutput()
1349+
graph.output_file = get_filename()
1350+
with pycallgraph.PyCallGraph(output=graph):
1351+
<code_to_be_profiled>
1352+
```
1353+
1354+
```python
1355+
def get_filename():
1356+
from datetime import datetime
1357+
time_str = datetime.now().strftime('%Y%m%d%H%M%S')
1358+
return f'profile-{time_str}.png'
13431359
```
13441360

13451361
#### Decorator for timing function execution:
@@ -1399,23 +1415,6 @@ def tracer(func):
13991415
return traced_func
14001416
```
14011417

1402-
#### Generates a PNG image of call graph and highlights the bottlenecks:
1403-
```python
1404-
# $ pip3 install pycallgraph
1405-
import pycallgraph
1406-
graph = pycallgraph.output.GraphvizOutput()
1407-
graph.output_file = get_filename()
1408-
with pycallgraph.PyCallGraph(output=graph):
1409-
<code_to_be_profiled>
1410-
```
1411-
1412-
```python
1413-
def get_filename():
1414-
from datetime import datetime
1415-
time_str = datetime.now().strftime('%Y%m%d%H%M%S')
1416-
return f'profile-{time_str}.png'
1417-
```
1418-
14191418

14201419
Progress Bar
14211420
------------

0 commit comments

Comments
 (0)