I noticed that 10% my code run is system space. However I do NOT know which system calls. I suspect, though, it is either has to do files or timestamps.
Is there a tool to figure out which system calls are the culprits? Also, I want to know the frequency of (and location) of calls (and callee) .
I am on AS3
thx
Both strace
and truss
will help you see which system calls are taking time. Two useful options for strace
are:
-T
to show the time spent in each system call,
-c
to summarize syscall counts, calls, error counts as a table.
The two options are mutually exclusive though.
You may want a full system profiling tool, to allow you to profile the kernel in more detail. DTrace is probably the best if you have it on your platform.
By platform, here are some options:
- Linux: strace, oprofile, SystemTap.
- Solaris: dtrace (the original)
- FreeBSD: dtrace
- OS X: dtrace and Instruments; the latter is a graphical UI over DTrace and comes with Xcode.
DTrace can even help you profile your C/C++ code with the pid provider, e.g. see here.
If you are on Linux have a look at strace.
If you're on one of the other Unixes see if truss is available.
If your system has it then the truss command should do what you want.
If it is 10% then try this method for 30 samples. You will see the exact calls on ~3 samples, maybe 2, maybe 4.
Again on Linux, you could try the oprofile profiler. Make sure you have debug symbols available for libc and the kernel (many distributions have these on separate packages). It profiles entire systems, not (just) single processes. I've gotten valuable information from it.
On Solaris, you can use dtrace.