Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
strace(1) all the things!
Search
Dan Miller
November 13, 2014
Programming
670
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
More Decks by Dan Miller
See All by Dan Miller
Oh Snap!
jazzdan
0
310
HHVM at Etsy
jazzdan
22
6.9k
"API First" Development
jazzdan
7
1.2k
Other Decks in Programming
See All in Programming
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
130
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
140
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
290
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
990
アクセシビリティから考える情報設計
high_g_engineer
0
230
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
240
新卒PdEのリアル
ryu1013
1
410
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
220
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.3k
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The SEO Collaboration Effect
kristinabergwall1
1
550
Paper Plane (Part 1)
katiecoart
PRO
1
11k
Technical Leadership for Architectural Decision Making
baasie
3
550
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
Producing Creativity
orderedlist
PRO
348
41k
Utilizing Notion as your number one productivity tool
mfonobong
4
570
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Transcript
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?