tjrburgess
tjrburgess

Reputation: 787

Benchmarking in Ruby

I have been doing some benchmarking in Ruby and have the following results:

                           user     system      total        real
part1                  0.156000   0.000000   0.156000 (  0.158009)
                           user     system      total        real
part2                  0.015000   0.000000   0.015000 (  0.162010)

Commonly, as in part1, the total and real times are nearly the same. However this is not true in part 2.

  1. What is the meaning of the total and real divergence in part2?
  2. Does the divergence raise any concerns?
  3. What run is faster?

Upvotes: 1

Views: 213

Answers (2)

raubarede
raubarede

Reputation: 433

user/system are cpu times, measured by the kernel. which have scheduled your process. real time is the time of calculation.

So real time bigger than user+system mean :

  • io or sleep in code tested
  • there a other process/daemon which consumes CPU

Upvotes: 1

user2005477
user2005477

Reputation:

The results are organized in columns and are in this order; user CPU time, system CPU time, the sum of the user and system CPU times, and the elapsed real time. The units of them all are seconds. So in real time, part1 was faster than part2.

Upvotes: 0

Related Questions