| 1 | from platform import platform |
| 2 | |
| 3 | from pyinstrument import Profiler |
| 4 | |
| 5 | p = Profiler() |
| 6 | |
| 7 | p.start() |
| 8 | |
| 9 | |
| 10 | def func(): |
| 11 | fd = open("/dev/urandom", "rb") |
| 12 | _ = fd.read(1024 * 1024) |
| 13 | |
| 14 | |
| 15 | func() |
| 16 | |
| 17 | # this failed on ubuntu 12.04 |
| 18 | platform() |
| 19 | |
| 20 | p.stop() |
| 21 | |
| 22 | print(p.output_text()) |
| 23 | |
| 24 | p.write_html("ioerror_out.html") |