perfstat_processor_pool_util interface
The perfstat_processor_pool_util
interface
returns a set of structures of type perfstat_processor_pool_util_t
,
which is defined in the libperfstat.h file
Item | Descriptor |
---|---|
max_capacity | Maximum pool processor capacity of the partition. |
entitled_capacity | Entitled pool processor capacity of the partition. |
phys_cpus_pool | Physical processors that are available in the Shared processor Pool to which the partition is associated. |
idle_cores | Physical processors that are available in the Shared processor Pool from the last interval. |
max_cores | Maximum cores used by the Shared processor Pool for the last interval, which is associated with the partition. |
busy_cores | Maximum busy (non-idle) cores that are accumulated for the last interval across all partitions in the Shared processor Pool, which is associated with the partition. |
sbusy_cores | Normalized summation of busy (non-idle) cores that are accumulated across all partitions in the Shared processor Pool, which is associated with the partition. This option applies if the cores run at nominal or rated frequency. |
gpool_tot_cores | Total number of cores across all physical processors that are allocated for shared processor use (across all pools). |
gpool_busy_cores | Summation of the busy (non-idle) cores that are accumulated across all shared processor partitions (across all pools) for the last interval. |
gpool_sbusy_cores | Normalized summation of the busy cores that are accumulated across all shared processor partitions (across all pools) for the last interval. This option applies if the cores run at nominal or rated frequency. |
tb_last_delta | Elapsed number of clock ticks. |
version | Version number of the data structure. |
The use of the perfstat_processor_pool_util API for the system-level utilization follows:
#include <libperfstat.h>
#include <sys/dr.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#define COUNT 2
#define INTERVAL 2
void main(int argc, char **argv)
{
perfstat_rawdata_t data;
perfstat_partition_total_t oldt,newt;
perfstat_processor_pool_util_t util,*uti;
static int once=0;
int rc;
u_longlong_t x=0;
int iInter=0,iCount=0;
int c;
while( (c = getopt(argc,argv,"i:c:"))!= EOF ){
switch(c) {
case 'i':
iInter=atoi(optarg);
break;
case 'c':
iCount=atoi(optarg);
break;
}
}
if(iCount<=0 && iInter<=0)
{
iCount=COUNT;
iInter=INTERVAL;
}
while(iCount--)
{
rc = perfstat_partition_total(NULL, &oldt, sizeof(perfstat_partition_total_t), 1);
if (rc != 1)
{
perror("Error in perfstat_partition_total");
exit(-1);
}
sleep(INTERVAL);
rc = perfstat_partition_total(NULL, &newt, sizeof(perfstat_partition_total_t), 1);
if (rc != 1)
{
perror("Error in perfstat_partition_total");
exit(-1);
}
data.type = SHARED_POOL_UTIL;
data.curstat = &newt; data.prevstat= &oldt;
data.sizeof_data = sizeof(perfstat_partition_total_t);
data.cur_elems = 1;
data.prev_elems = 1;
rc = perfstat_processor_pool_util(&data, &util,sizeof(perfstat_processor_pool_util_t),1);
if(rc <= 0)
{
perror("Error in perfstat_processor_util");
exit(-1);
}
if(!once)
{
printf("Pool_id\tCapacity\tPhys_cpus_pool\tApp\t\tPool_utlization\t\tGlobal_pool\n");
printf("\tMax|Entitled\t\t\t\t\tBusy|Scaled_busy\tMax|busy\n");
printf("-------------------------------------------------------------------------\n");
once=1;
}
printf("%u ", util.ssp_id);
printf("\t%llu ", util.max_capacity/100);
/*Convert physical units to cores*/
printf(" %llu ", util.entitled_capacity/100);
/*Convert physical units to cores*/
printf("\t\t\t%d ", util.phys_cpus_pool);
printf("\t%5.2f ",util.idle_cores);
printf("\t\t%5.2f ", util.busy_cores );
printf("%5.2f ", util.sbusy_cores );
printf("\t\t%5.2f ", util.gpool_tot_cores );
printf("%5.2f \n", util.gpool_busy_cores );
}
}