Tcsh time and makefile time are significantly different

I see different behavior when run time

in make and in terminal. I am building multi-threaded programs with OpenMP and pthread (separately) and calculate them to compare their speedups with the serial version of the program. However, when I run time a.out

in terminal I get 60+ seconds for each program, but in the makefile I get less than 10 seconds for both. Also, it takes less than 60 seconds for the terminal to time out, so I feel like it is lying to me.

What could be causing this? Initially I thought that maybe make and terminal use different functions time

, but apparently I don't /usr/bin/time

. Does it have a built-in time

or something?

Edit . Yes, I know that user and sys are time

dependent on the number of threads and may be more real, and that time

is built in. My question is: why run the same thing from different places (terminal and do in the same session) cause significant differences during return? The two output signals are not remotely close to each other.

+3


source to share


1 answer


Almost all shells have a timing built in. I don't know what you call the time, but you may have to interpret the results from it differently depending on the shell.

I ran an experiment with a program with 4 threads wasting time:



$ cc -o foo foo.c && time ./foo

real    0m5.258s
user    0m18.805s
sys 0m0.061s
$ tcsh
% time ./foo
18.978u 0.062s 0:05.30 359.0%   0+0k 0+0io 0pf+0w

      

tcsh first tells the user the time, then the system time, then in real time. Bash reports real time, user time, then system time. These are two different things. Real time is the wall clock time, how much time has passed if you measured it with a stopwatch. User time is the cpu time that you used to run your code in userland, which is common to the entire cpu you are using.

+2


source







All Articles