doc:appunti:prog:python_profiling_with_yappi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:prog:python_profiling_with_yappi [2022/01/10 11:00] – niccolo | doc:appunti:prog:python_profiling_with_yappi [2022/01/10 11:05] (current) – niccolo | ||
---|---|---|---|
Line 28: | Line 28: | ||
- | Ecco uno pseudo esempio di come implementare il profiler all' | + | Ecco uno pseudo esempio di come implementare il profiler all' |
<code python> | <code python> | ||
import daemon | import daemon | ||
+ | import socketserver | ||
import threading | import threading | ||
import yappi | import yappi | ||
+ | |||
+ | def timer_callback(): | ||
+ | ... | ||
+ | |||
+ | class socket_tcp_handler(socketserver.StreamRequestHandler): | ||
+ | ... | ||
def main_loop(): | def main_loop(): | ||
+ | tcp_server = socketserver.TCPServer((BIND_ADDR, | ||
timer1_thread = threading.Timer(interval, | timer1_thread = threading.Timer(interval, | ||
th = threading.Thread(target=tcp_server.serve_forever) | th = threading.Thread(target=tcp_server.serve_forever) |
doc/appunti/prog/python_profiling_with_yappi.txt · Last modified: 2022/01/10 11:05 by niccolo