- trace module
- Application performance monitoring (APM) tools that fit
- What part of the code should I profile?
- Typically, we profile:
- What metrics should I profile?
- References
trace module
You can do several things with trace:
- Produce a code coverage report to see which lines are run or skipped over (
python3 -m trace –count trace_example/main.py). - Report on the relationships between functions that call one other (
python3 -m trace –listfuncs trace_example/main.py | grep -v importlib). - Track which function is the caller (
python3 -m trace –listfuncs –trackcalls trace_example/main.py | grep -v importlib).
Application performance monitoring (APM) tools that fit
Datadog in my production
What part of the code should I profile?
The term “profiling” is mainly used for performance testing, and the purpose of performance testing is to find bottlenecks by doing deep analysis.
Typically, we profile:
- Method or function (most common)
- Lines (similar to method profiling, but doing it line by line)
- Memory (memory usage)
What metrics should I profile?
- Speed (time)
- Calls (frequency)
- Method and line profiling