2

I am running the command time 7zr a -mx=9 sample.7z sample.log to gauge how long it takes to compress a file larger than 1GB. The results I get are as follows.

real    10m40.156s
user    17m38.862s
sys     0m5.944s

I have a basic understanding of the difference but don't understand how this plays a role in the time in takes to compress the file. For example should I be looking at real or user + sys?

2
  • How could we tell you what you should be looking at? We don't know what it is you want to know. Aug 28, 2012 at 8:44
  • @David Schwartz - Like to know what is the common metric that is used especially when compressing large files. Speed is the essence but considering the CPU has an impact on real time, I am unsure as to which result will be accurate. Aug 28, 2012 at 18:40

1 Answer 1

4

If what matters to you is the wall clock time, real is the metric to look at.

user and sys are there to show how long the CPU was actually busy in userland and in the kernel. In your example, user+sys is bigger than real because the 7zr command is multi-threaded and you have more than one core/cpu available.

6
  • Thanks however am still confused by which is an accurate figure to cite. For example the time it takes to compress is crucial however if the CPU is busy processing other requests does this impact the wall clock time. My assumption is yes but does this mean that user+sys are an accurate representation of time as opposed to real? Also am amazed how you were able to tell that there in more than a single core or CPU. How do tell that? Also how do know if a command is multi-threaded via the command line? Aug 28, 2012 at 18:43
  • 2
    All the numbers are accurate. They do not oppose to each other. They simply represent different things. I was able to tell there was more than a single CPU because that is the more logical explanation. On single core systems, the user+sys time is always smaller that the real time. You can display all multi-threaded processes with this command ps -eo pid,nlwp,comm | awk '$2 > 1'
    – jlliagre
    Aug 28, 2012 at 21:32
  • So in what scenarios would I use real and user + sys? If there are multiple CPUs or cores why would user+sys be greater than real? Aug 29, 2012 at 0:10
  • The time spent by each core/cpu do add, i.e. in 1 hour of time, a quad core CPU can produce up to 4 hours of work. On the other hand, other processes might compete with yours for the CPU so the real time to complete your task might be larger.
    – jlliagre
    Aug 29, 2012 at 0:21
  • Sorry for being a n00b here but I don't quite follow what you mean by The time spent by each core/cpu do add, i.e. in 1 hour of time, a quad core CPU can produce up to 4 hours of work Aug 29, 2012 at 2:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .