views:

185

answers:

6

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

+3  A: 

G'day,

If you are on Linux have a look at strace.

If you're on one of the other Unixes see if truss is available.

HTH

cheers,

Rob Wells
+1  A: 

If your system has it then the truss command should do what you want.

Jackson
+6  A: 

Both strace and truss will help you see which system calls are taking time. Two useful options for strace are:

  1. -T to show the time spent in each system call,
  2. -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:

DTrace can even help you profile your C/C++ code with the pid provider, e.g. see here.

Emil
A: 

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.

ariels
+1  A: 

If it is 10% then try this method for 30 samples. You will see the exact calls on ~3 samples, maybe 2, maybe 4.

Mike Dunlavey
A: 

On Solaris, you can use dtrace.

Howard Hong