Does anyone know of a usable (no sudo needed) strace for Darwin / OS X?
This is a tangent but why is sudo needed != usable?
Strace - The Sysadmin's Microscope
11–20 of 25 posts
Re: Strace - The Sysadmin's Microscope
#12Does anyone know of a usable (no sudo needed) strace for Darwin / OS X?
This is a tangent but why is sudo needed != usable?
Re: Strace - The Sysadmin's Microscope
#13Earlier quoted context omitted.
This is a tangent but why is sudo needed != usable?
I cannot think of a single time when I'm debugging an errant program when I would like to have it run as root. I can however think of many things, like debugging permission issues, resource limit issues, reading and writing files, etc where it makes a big difference to run as root. I know you can su and then su back to yourself, but that's a pain and things aren't exactly the same anymore, i.e. there is a usability p…
Re: Strace - The Sysadmin's Microscope
#14Re: Strace - The Sysadmin's Microscope
#15OS X has a fancy GUI for this called Instruments. (Obviously the cmdline tools are there as well.)
Additionally, OS X has several useful stock dtrace scripts, check 'apropos dtrace' for a listing
Re: Strace - The Sysadmin's Microscope
#16Does anyone know of a usable (no sudo needed) strace for Darwin / OS X?
Re: Strace - The Sysadmin's Microscope
#17dtruss - similar to strace opensnoop - all files nettop - all network access iosnoop/iotop - all io execsnoop - all new processes errinfo - all system calls resulting in errors
Not exactly the same info but I think much more powerful as it is system wide and you call always filter out what you don't need to know, or write your own scripts!
Re: Strace - The Sysadmin's Microscope
#18It's also worth looking at SystemTap or DTrace, depending on what OS you're running. While strace will allow you to look at an individual process and its children, SystemTap/DTrace will allow you to gather data on system call (and then some) usage system wide. Some examples: - monitor execve() calls system-wide - monitor I/O to a specific file, from any process - measure per-process network usage (note that newer Lin…
Re: Strace - The Sysadmin's Microscope
#19strace tip #31415927: If your program is I/O bound, sometimes you can improve performance by increasing the size of the read buffer. A bigger buffer means fewer system calls and potentially increased performance. How do you know how big the read buffer is? Sometimes it's hard to tell even if you have the source (i.e. you're using stdio). With strace you can see the number of bytes you're trying to slurp in with each…
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1278
2 | 0
4 | 0
8 | 0
16 | 0
32 | 0
64 | 0
128 | 0
256 | 0
512 | 1
1024 | 0
2048 |@ 20
4096 | 2
8192 | 0
16384 | 0
32768 | 0
65536 | 3
131072 | 2
262144 | 1
524288 | 0
and if you want to know where, say, the 512-byte reads are coming from:# dtrace -n 'syscall::read:entry/arg2 == 512/{ @[ ustack() ] = count(); }'
mdworker
libSystem.B.dylib`read+0xa
Foundation`-[NSConcreteFileHandle readDataOfLength:]+0x1d6
RichText`GetMetadataForURL+0x338
mdworker`0x100006a66
mdworker`0x100009ec1
libSystem.B.dylib`_pthread_start+0x14b
libSystem.B.dylib`thread_start+0xd
1Re: Strace - The Sysadmin's Microscope
#20Helped my trouble shoot why sudo was taking 25+ seconds yesterday. Apparently it was timing out attempting to perform some NIS operations on a misconfigured setup.