/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* bos720 src/bos/usr/ccs/lib/libperfstat/simplepoolstat.c 1.1.1.3 */ /* */ /* Licensed Materials - Property of IBM */ /* */ /* Restricted Materials of IBM */ /* */ /* COPYRIGHT International Business Machines Corp. 2012 */ /* All Rights Reserved */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* */ /* IBM_PROLOG_END_TAG */ #include #include #include #include #include #include #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_pool_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.max_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 ); } }