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
3
650
strace(1) all the things!
Presented at the Marist College Computer Society meeting, 11/12/14
Dan Miller
November 13, 2014
Tweet
Share
More Decks by Dan Miller
See All by Dan Miller
Oh Snap!
jazzdan
0
300
HHVM at Etsy
jazzdan
22
6.9k
"API First" Development
jazzdan
7
1.1k
Other Decks in Programming
See All in Programming
Claude Code Skill入門
mayahoney
0
430
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
230
Java 21/25 Virtual Threads 소개
debop
0
270
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
安いハードウェアでVulkan
fadis
1
790
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
420
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
560
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
640
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
250
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.1k
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.4k
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
140
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
690
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
79
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Code Reviewing Like a Champion
maltzj
528
40k
The untapped power of vector embeddings
frankvandijk
2
1.6k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
320
Discover your Explorer Soul
emna__ayadi
2
1.1k
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?