Peering into the black box: tips for visualizing your program's behavior
summary
Shows concrete techniques: use IPython formatted stack traces instead of one-line traces, open frames in unstack vim plugin, add a decorator that logs function calls and returns (with fold markers so editors collapse call contexts), use Python's trace/coverage to discover dead code (example: a cache path never ran due to a typo), dump line-level traces into a DB with smiley for postmortem queries, generate call graphs and flame charts with d3 to find hot or unexpectedly-called functions, and diff two traces to find where executions diverge.
AI-written summary · about
chapters (26)
- 0:00Intro
- 2:09The problem
- 2:35Looking at the code
- 2:55Stack traces
- 5:29Why are stack traces so common
- 6:05Stack traces in logs
- 6:55Write a decorator
- 9:20Log exceptions
- 10:18Folding logs
- 12:08Debugging
- 13:27Logging
- 14:20Getting started
- 14:45Your Code as a Crime Scene
- 15:31D3 Visualization Library
- 16:18Bash Oneliner
- 16:56Call Graph
- 17:34Make your own graphs
- 17:54Generating graphs
- 18:11Other features
- 18:39Project example
- 20:17Flame charts
- 22:22Problems with debugging
- 23:37Shortterm fixes
- 24:12Longterm fixes
- 26:46The bare minimum
- 27:56Logs
related talks
44mObservability Tools C++: Beyond GDB and printf - Tools to Understand the Behavior of Your Program
44mNow You See Me Too: Visual Tooling for Advanced System Analysis
34mVisualising program execution
31mPeeking into Ruby: Tracing Running Code
23mEntomology 101: Effective Bug Hunting
58mDebugging #Java
12mDebugging Python in Production: Practical Techniques Beyond Print Statements
28mKnocking On A Process’s Door: Introspecting Live Python Processes
