I’m working on a project (programming language) and I’m starting to do some profiling. When I run time on my factorial test, I get the following:
burton@smokey:~/repl$ time tests/fact.repl
real 0m4.451s
user 0m1.820s
sys 0m2.620s
My problem is with the sys time. I am doing no system calls other than reading the input files (there is no output). This should be an almost completely user time bound application. I have tried running strace -c to see if there are any errant system calls taking up a lot of time but have found nothing. Gprof doesn’t give me any answers either.
Are there any other tools to find out what is taking so much system time in my application? Am I just being tricked by the time command? When I run sbcl doing the same calculation, the sys time is around 0.03 seconds and what I am hoping for.
Here is the complete output of strace -c:
burton@smokey:~/repl$ strace -c tests/fact.repl
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
-nan 0.000000 0 2 read
-nan 0.000000 0 3 open
-nan 0.000000 0 2 close
-nan 0.000000 0 3 fstat
-nan 0.000000 0 12 mmap
-nan 0.000000 0 4 mprotect
-nan 0.000000 0 1 munmap
-nan 0.000000 0 16 brk
-nan 0.000000 0 2 rt_sigaction
-nan 0.000000 0 4 rt_sigprocmask
-nan 0.000000 0 1 1 ioctl
-nan 0.000000 0 3 3 access
-nan 0.000000 0 1 execve
-nan 0.000000 0 1 arch_prctl
-nan 0.000000 0 2 setrlimit
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 57 4 total
The time it takes to allocate and page in your memory counts as system time. Try
/usr/bin/time tests/fact.repl— it shows the number of page faults.By the way, “I am doing no system calls other than reading the input files” and “I am allocating gobs of memory” are contradictory statements.