Support Migration Notice: To update migrated JIRA cases click here to open a new case use www.vmware.com/go/sr | vFabric Hyperic 5.7.0 is Now Available

Sigar

CPU list functions should return cores by default

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.6.0
  • Component/s: None
  • Case Links:
    none

Description

The cpu list functions represent the physical CPU (aka socket), which on multi-core systems is the aggregate of the core metrics. These functions should return core info/metrics, as the majority of other OS apps do.

Issue Links

Activity

Hide
Ian Springer added a comment -

Hi Doug,

Is this still the case in SIGAR 1.5.0.1? From what I'm seeing, it looks like the cpu list functions now return a list of cores, not a list of sockets. For example, on my PC, which is a single-socket/dual-core:

>java -jar sigar.jar cpuinfo
2 total CPUs..
Vendor........Intel
Model.........Core(TM)2 CPU 6600 @ 2.40GHz
Mhz...........2394

CPU 0.........
User Time.....3.2%
Sys Time......9.4%
Idle Time.....87.4%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......12.6%

CPU 1.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

Totals........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

Class Not Found: junit/framework/TestCase
Unable to locate: junit.jar

NOTE: The Totals numbers seem to be wrong here - all of them, except for Idle Time, are 0.0%, yet the individual numbers for CPU 0 are non-zero.

And on an AIX box with 4 PowerPC POWER5 CPU's, all dual-core:

$ java -jar sigar-1.5.0.3.jar cpuinfo
8 total CPUs..
Vendor........IBM
Model.........PowerPC POWER5
Mhz...........1648
Cache size....1920

CPU 0.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

CPU 1.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

CPU 2.........
User Time.....1.9%
Sys Time......0.0%
Idle Time.....98.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......1.9%

CPU 3.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

CPU 4.........
User Time.....0.0%
Sys Time......1.9%
Idle Time.....98.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......1.9%

CPU 5.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

CPU 6.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

CPU 7.........
User Time.....0.0%
Sys Time......0.0%
Idle Time.....100.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.0%

Totals........
User Time.....0.0%
Sys Time......0.2%
Idle Time.....99.7%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......0.2%

Ideally, I'd like to see the CPU APIs enhanced to the point where the output from the cpuinfo prompt command for a multi-core system could look something like:

1 total CPU...
Vendor........Intel
Model.........Core(TM)2 CPU 6600
Clock Speed........2.4 GHz
Cores........2

CPU 0, Core 0.........
User Time.....3.2%
Sys Time......9.4%
Idle Time.....87.4%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......12.6%

CPU 0, Core 1.........
User Time.....12.1%
Sys Time......3.0%
Idle Time.....90.0%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......15.1%

Totals........
User Time.....7.7%
Sys Time......6.2%
Idle Time.....88.7%
Wait Time.....0.0%
Nice Time.....0.0%
Combined......13.9%

Thanks,
Ian

Show
Ian Springer added a comment - Hi Doug, Is this still the case in SIGAR 1.5.0.1? From what I'm seeing, it looks like the cpu list functions now return a list of cores, not a list of sockets. For example, on my PC, which is a single-socket/dual-core: >java -jar sigar.jar cpuinfo 2 total CPUs.. Vendor........Intel Model.........Core(TM)2 CPU 6600 @ 2.40GHz Mhz...........2394 CPU 0......... User Time.....3.2% Sys Time......9.4% Idle Time.....87.4% Wait Time.....0.0% Nice Time.....0.0% Combined......12.6% CPU 1......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% Totals........ User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% Class Not Found: junit/framework/TestCase Unable to locate: junit.jar NOTE: The Totals numbers seem to be wrong here - all of them, except for Idle Time, are 0.0%, yet the individual numbers for CPU 0 are non-zero. And on an AIX box with 4 PowerPC POWER5 CPU's, all dual-core: $ java -jar sigar-1.5.0.3.jar cpuinfo 8 total CPUs.. Vendor........IBM Model.........PowerPC POWER5 Mhz...........1648 Cache size....1920 CPU 0......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% CPU 1......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% CPU 2......... User Time.....1.9% Sys Time......0.0% Idle Time.....98.0% Wait Time.....0.0% Nice Time.....0.0% Combined......1.9% CPU 3......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% CPU 4......... User Time.....0.0% Sys Time......1.9% Idle Time.....98.0% Wait Time.....0.0% Nice Time.....0.0% Combined......1.9% CPU 5......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% CPU 6......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% CPU 7......... User Time.....0.0% Sys Time......0.0% Idle Time.....100.0% Wait Time.....0.0% Nice Time.....0.0% Combined......0.0% Totals........ User Time.....0.0% Sys Time......0.2% Idle Time.....99.7% Wait Time.....0.0% Nice Time.....0.0% Combined......0.2% Ideally, I'd like to see the CPU APIs enhanced to the point where the output from the cpuinfo prompt command for a multi-core system could look something like: 1 total CPU... Vendor........Intel Model.........Core(TM)2 CPU 6600 Clock Speed........2.4 GHz Cores........2 CPU 0, Core 0......... User Time.....3.2% Sys Time......9.4% Idle Time.....87.4% Wait Time.....0.0% Nice Time.....0.0% Combined......12.6% CPU 0, Core 1......... User Time.....12.1% Sys Time......3.0% Idle Time.....90.0% Wait Time.....0.0% Nice Time.....0.0% Combined......15.1% Totals........ User Time.....7.7% Sys Time......6.2% Idle Time.....88.7% Wait Time.....0.0% Nice Time.....0.0% Combined......13.9% Thanks, Ian
Hide
Doug MacEachern added a comment -

Hi Ian,

The changes have only been made to trunk (1.5.1). It's been getting more difficult over the years to detect # of physical sockets across all platforms and chips. There's a few sprinkles of assembler code (cpuid) for x86/x64, kstat based for sparc, no attempt for PowerPC. So if we're not able to detect cores-per-socket, you get back the list of cores rather than sockets. I'm leaning towards changing the cpu list functions to return cores (as most programs do), but still provide access to the cores-per-socket detection. For example, you'll see this in trunk's CpuInfo.java:

println("Total CPUs....." + info.getTotalCores());
if ((info.getTotalCores() != info.getTotalSockets()) ||
(info.getCoresPerSocket() > info.getTotalCores()))

{ println("Physical CPUs.." + info.getTotalSockets()); println("Cores per CPU.." + info.getCoresPerSocket()); }

I'd like to get this wrapped up fairly soon for 1.5.1, so any feedback would be great and even better if you're setup to build from source and help test

Show
Doug MacEachern added a comment - Hi Ian, The changes have only been made to trunk (1.5.1). It's been getting more difficult over the years to detect # of physical sockets across all platforms and chips. There's a few sprinkles of assembler code (cpuid) for x86/x64, kstat based for sparc, no attempt for PowerPC. So if we're not able to detect cores-per-socket, you get back the list of cores rather than sockets. I'm leaning towards changing the cpu list functions to return cores (as most programs do), but still provide access to the cores-per-socket detection. For example, you'll see this in trunk's CpuInfo.java: println("Total CPUs....." + info.getTotalCores()); if ((info.getTotalCores() != info.getTotalSockets()) || (info.getCoresPerSocket() > info.getTotalCores())) { println("Physical CPUs.." + info.getTotalSockets()); println("Cores per CPU.." + info.getCoresPerSocket()); } I'd like to get this wrapped up fairly soon for 1.5.1, so any feedback would be great and even better if you're setup to build from source and help test
Hide
Doug MacEachern added a comment -

The cpu list functions now return core info+metrics by default. To revert to the old behavior, set the following environment variable:
SIGAR_CPU_LIST_SOCKETS=1

CpuInfo now has the following for socket detection: TotalCores, TotalSockets, CoresPerSocket

Show
Doug MacEachern added a comment - The cpu list functions now return core info+metrics by default. To revert to the old behavior, set the following environment variable: SIGAR_CPU_LIST_SOCKETS=1 CpuInfo now has the following for socket detection: TotalCores, TotalSockets, CoresPerSocket
Hide
Doug MacEachern added a comment -

Closing Resolved -> Fixed

Show
Doug MacEachern added a comment - Closing Resolved -> Fixed

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:
    Last comment:
    5 years, 45 weeks, 6 days ago