add cpu_info.cores_per_socket

This commit is contained in:
Doug MacEachern 2008-04-11 17:46:36 +00:00
parent e4c00a7b92
commit 51b607866f
9 changed files with 17 additions and 4 deletions

View File

@ -509,6 +509,10 @@ use vars qw(%classes %cmds);
name => 'total_sockets', type => 'Int',
desc => 'Total CPU sockets (physical)',
},
{
name => 'cores_per_socket', type => 'Int',
desc => 'Number of CPU cores per CPU socket',
},
],
Uptime => [
{

View File

@ -66,6 +66,7 @@ public class CpuInfo extends SigarCommandBase {
println("Total CPUs....." + info.getTotalCores());
if (info.getTotalCores() != info.getTotalSockets()) {
println("Physical CPUs.." + info.getTotalSockets());
println("Cores per CPU.." + info.getCoresPerSocket());
}
if (cacheSize != Sigar.FIELD_NOTIMPL) {

View File

@ -188,6 +188,7 @@ typedef struct {
sigar_uint64_t cache_size;
int total_sockets;
int total_cores;
int cores_per_socket;
} sigar_cpu_info_t;
typedef struct {

View File

@ -1987,8 +1987,9 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
info = &cpu_infos->data[cpu_infos->number++];
info->total_sockets = ncpu;
info->total_cores = ncpu;
info->cores_per_socket = 1; /*XXX*/
info->total_sockets = ncpu; /*XXX*/
info->cache_size = SIGAR_CPU_CACHE_SIZE;

View File

@ -2132,6 +2132,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
info->mhz = mhz;
info->cache_size = cache_size;
info->total_cores = sigar->ncpu;
info->cores_per_socket = sigar->lcpu;
info->total_sockets = sigar_cpu_socket_count(sigar);
}

View File

@ -679,8 +679,9 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
info = &cpu_infos->data[cpu_infos->number++];
info->total_sockets = sigar->ncpu;
info->total_cores = sigar->ncpu;
info->cores_per_socket = 1; /*XXX*/
info->total_sockets = sigar->ncpu; /*XXX*/
#ifdef __ia64__
SIGAR_SSTRCPY(info->vendor, "Intel"); /*XXX*/

View File

@ -1589,8 +1589,10 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
cpu_info = &cpu_infos->data[cpu_infos->number];
get_cpuinfo_max_freq(cpu_info, cpu_infos->number);
cpu_info->total_sockets = sigar_cpu_socket_count(sigar);
cpu_info->total_cores = sigar->ncpu;
info->cores_per_socket = sigar->lcpu;
cpu_info->total_sockets = sigar_cpu_socket_count(sigar);
++cpu_infos->number;
SIGAR_CPU_INFO_LIST_GROW(cpu_infos);

View File

@ -1799,6 +1799,7 @@ int sigar_cpu_info_list_get(sigar_t *sigar,
sigar_cpu_info_t *info = &cpu_infos->data[i];
info->total_sockets = nsockets;
info->total_cores = sigar->ncpu;
info->cores_per_socket = sigar->ncpu / nsockets;
}
return SIGAR_OK;

View File

@ -2005,8 +2005,9 @@ static int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
RegCloseKey(key);
RegCloseKey(cpu);
info->total_sockets = sigar_cpu_socket_count(sigar);
info->total_cores = sigar->ncpu;
info->cores_per_socket = sigar->lcpu;
info->total_sockets = sigar_cpu_socket_count(sigar);
return SIGAR_OK;
}