Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
strace(1) all the things!
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Dan Miller
November 13, 2014
Programming
680
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
strace(1) all the things!
Presented at the Marist College Computer Society meeting, 11/12/14
Dan Miller
November 13, 2014
Transcript
50 slides
strace(1) all the things Dan Miller Software Engineer Etsy
etsy.com/careers
@jazzdan strace(1) all the things What is strace(1)? How to
see what a program does without the source A quick aside about man(1) pages How does ls(1) work?
What is strace?
@jazzdan strace(1) is a unix utility for observing system calls
How do we see what a program does without reading
the source?
@jazzdan $ls
@jazzdan $strace ls
None
@jazzdan strace ls • execve(2) • open(2) • close(2) •
getdents(2) • write(2)
A quick aside on Unix man pages
@jazzdan $man man
None
None
None
How does ls work?
execve("/bin/ls", ["ls"], [/* 23 vars */]) = 0
None
execve() executes the program pointed to by filename. filename must
be either a binary executable, or a script starting with a line of the form: ! #! interpreter [optional-arg]
int execve(const char *filename, char *const argv[], char *const envp[]);
open( “/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC ) = 3
None
Given a pathname for a file, open() returns a file
descriptor, a small, nonnegative integer for use in subsequent system calls (read(2), write(2), lseek(2), fcntl(2), etc.).
int open(const char *pathname, int flags)
open( “/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC ) = 3
@jazzdan Wait… what is libc?
@jazzdan $man libc
None
open( “.", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC ) = 3
getdents( 3, /* 4 entries */, 32768 ) = 712
None
int getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count);
getdents( 3, /* 23 entries */, 32768 )= 712
open( “.", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC ) = 3
close(3)
None
int close(int fd);
close(3)
write( 1, “hello_world\n", hello_world ) = 23
None
exit_group(0) = ?
None
This system call is equivalent to exit(2) except that it
terminates not only the calling thread, but all threads in the calling process's thread group.
void exit_group(int status);
@jazzdan When is strace(1) useful? • Anything involving files or
sockets • Path issues • See what is being sent over a network interface
@jazzdan When is strace(1) not useful? • In production (performance
is terrible) • When no syscalls are being executed
One Cool Trick for Performance Analysis (perf folks hate ‘em)
@jazzdan $strace -c ls
None
Questions?
More Decks by Dan Miller
See All by Dan Miller
Oh Snap!
jazzdan
0
320
HHVM at Etsy
jazzdan
22
7k
"API First" Development
jazzdan
7
1.2k
Other Decks in Programming
See All in Programming
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
590
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
440
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
140
Spec-driven Development with AI
simas
PRO
0
2.3k
Canvas 2D Context Next
petamoriken
0
930
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
150
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
220
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
260
眠らない開発チームの作り方
biwakonbu
0
180
LLM 101
dalinaum
0
560
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
440
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
220
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
The Pragmatic Product Professional
lauravandoore
37
7.5k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
350
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
530
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
590
The World Runs on Bad Software
bkeepers
PRO
72
12k
For a Future-Friendly Web
brad_frost
184
11k