Zet - What are Dave’s handy tips for strace?
What are Dave’s handy tips for strace?
My usual execution from my snippets is
strace -rt -s2000 -T -y -yy -C -p <process_id>
(or replace the -p arg with just the command to run if you want strace to start it and trace from the very beginning)
-rtgets you the proper time and relative timestamps;-s2000sets the max length of string args to print (the default of 32 is often too short and loses useful info)-yand-yyget you some more detailed/helpful info on file paths for fds and protocol-specific info;-Cgets you a summary at the end of which syscalls time was spent in- If the process forks, adding a
-flets it follow forks, -ecan be used to limit what you see, e.g. if you only want to know what files it’s interacting with,-e trace=%filewill limit to file-related syscalls
#strace