Email: bknpk@hotmail.com Phone: +972-54-7649119
V

 

ASIC/FPGA Design and Verification Out Source Services

Using Linux strace command to measure a CPU time

  1. To time a simple command, we usually use the Linux time command.
  2. In some cases we can not use time directly. As an example one may consider a runner program which gives our process to the flow tracer. The flow tracer may select a different machine from where we typed the run command. In that case it is impossible to use time as the command itself may run on another machine.
  3. Suppose we need to run simulation (ncsim). First find the machine which got your process. Than run strace in the following manner.
  4. You can use starce command with most switches set to off, in order not to slow the machine.
    strace -p28994 -c -q strace - c option
    where the process id is the ncsim PID.
  5. Here is an example (strace can be run with PID or the command itself):
    The -c counts the CPU time:
    In the example CPU time is 1.577776 seconds, while wall clock time is 17:04:42-17:04:29=13 seconds.date;strace -c -q find $HOT/evcs/ -name "rv*.e";date
  6. Tue May 27 17:04:29 IDT 2008
    % time seconds usecs/call calls errors syscall
    ------ ----------- ----------- --------- --------- ----------------
    45.62 0.719827 194 3711 37 open
    31.35 0.494681 68 7326 getdents64
    20.14 0.317826 29 10991 lstat
    1.85 0.029214 4 7325 chdir
    0.49 0.007663 2 3673 close
    0.23 0.003705 1 3669 fstat
    0.23 0.003586 1 3663 fcntl
    0.06 0.000997 997 1 execve
    0.01 0.000118 4 32 24 stat
    0.01 0.000086 10 9 read
    0.00 0.000028 2 13 mmap
    0.00 0.000014 7 2 fchdir
    0.00 0.000010 3 3 munmap
    0.00 0.000009 5 2 1 access
    0.00 0.000006 2 3 mprotect
    0.00 0.000003 1 3 brk
    0.00 0.000002 2 1 arch_prctl
    0.00 0.000001 1 1 uname
    ------ ----------- ----------- --------- --------- ----------------
    100.00 1.577776 40428 62 total
    Tue May 27 17:04:42 IDT 2008

Contact me now at:

  ...


I would be happy to offer my services. Call ASAP !


Home

Download Area






Search This Site


Feedback This Site




new pages on this site