1

I have a C program written in such a way that it takes a file name as input to read. Now the problem is i am using time/timex command on HPUX to know the exact performance or time elapsed during the complete execution of the program.

The problem is, i am not able to get the exact performance by these time/timex command due to the time taken during the input insertion for that program. time/timex command is also considering the time taken by the user to provide the input.

Can anyone please help me as to how should i measure the actual performance in such case where user is giving input which is required to run the program ?

j0k
  • 22,600
  • 28
  • 79
  • 90
Goldi
  • 41
  • 1
  • 5

1 Answers1

1

time reports both the real time and CPU time. The real time includes time spent waiting for input, but the CPU time (user + sys) should give you just the time actually spent by your program performing computations.

casablanca
  • 69,683
  • 7
  • 133
  • 150
  • in my case time gives the output like real 7.7 user 0.0 sys 0.0 i want to know the exact figure which is elapsed during execution. – Goldi Feb 07 '12 at 08:08
  • @Goldi: Then it effectively took 0 seconds (i.e. less than the resolution of your system clock). You'll have to run it with a much larger input to see non-zero values. – casablanca Feb 07 '12 at 08:11