2007/9/18, SpringFlowers AutumnMoon <summercoolness / gmail.com>:
> Robert Klemme wrote:
> > 2007/9/18, SpringFlowers AutumnMoon <summercoolness / gmail.com>:
>
> > Maybe your process is IO bound - probably without you being aware of
> > it (e.g. through paging, network IO, IPC or such).
>
> i can be just running calculations or just the following:
>
> require 'benchmark'
>
> n = 10_000_000
> b = 123
> c = 456
>
> Benchmark.bm do |x|
>   x.report { for i in 1..n; a = b + c; end }
>   x.report { n.times do   ; a = b + c; end }
>   x.report { 1.upto(n) do ; a = b + c; end }
> end
>
>
> If I run the same code on a Mac with single core, the CPU meter will go
> to 100%.  In the old days when I had a single Intel Windows XP machine,
> calculation intensive programs will make it go to 100% too.
>
> if the Ruby VM uses only one core, then why won't one core go to 100%?

Probably because the OS moves the process between cores.  See whether
you can switch off one core or make the process sticky.

Kind regards

robert