pooler / cpuminer

CPU miner for Litecoin and Bitcoin
https://bitcointalk.org/index.php?topic=55038.0
Other
2.77k stars 1.21k forks source link

Cpu utiliaztion not maximized?? #97

Closed haris00 closed 8 years ago

haris00 commented 8 years ago

I ran minerd and it would producing on average 5khash/s per thread. Then i did 'mpstat -P ALL' and i got cpu utilization: 03:50:32 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 03:50:32 AM all 0.00 90.57 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.43 03:50:32 AM 0 0.00 90.58 0.01 0.01 0.00 0.00 0.00 0.00 0.00 9.40 03:50:32 AM 1 0.00 90.60 0.01 0.00 0.00 0.00 0.00 0.00 0.00 9.39 03:50:32 AM 2 0.00 90.57 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.42 03:50:32 AM 3 0.00 90.57 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.43 It seems that process is not fully utilizing each core. Wouldn't the performance increase if it utilized each core more. Is there anyway to tune it?

pooler commented 8 years ago

If you don't specify an interval parameter, mpstat reports statistics for the time since system startup. Try instead:

$ mpstat -P ALL 1
01:36:16 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:36:17 PM  all   99.25    0.00    0.75    0.00    0.00    0.00    0.00    0.00    0.00    0.00
01:36:17 PM    0  100.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
01:36:17 PM    1   99.01    0.00    0.99    0.00    0.00    0.00    0.00    0.00    0.00    0.00
01:36:17 PM    2   99.00    0.00    1.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
01:36:17 PM    3  100.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
haris00 commented 8 years ago

Here is the output of 'mpstat -P ALL 1' 06:33:07 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 06:33:08 AM all 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 06:33:08 AM 0 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 06:33:08 AM 1 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 06:33:08 AM 2 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 06:33:08 AM 3 0.00 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Still same

haris00 commented 8 years ago

Here is the output of 'top': PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3933 root 20 0 4006868 131504 6040 S 4796 0.0 7995:37 minerd

and when I press 1 %Cpu0 : 0.0 us, 0.0 sy,100.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu1 : 0.0 us, 0.0 sy,100.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu2 : 0.0 us, 0.0 sy,100.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu3 : 0.0 us, 0.0 sy,100.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

pooler commented 8 years ago

No, it's not the same. Unlike the first output you posted, the last output shows zero idle time, and user-level processes with nice priority are reported to use 100% of the CPU, which is exactly what we want. My output was recorded with minerd running in benchmark mode, which is why it was running with default priority.