Path: blob/master/src/hotspot/os/aix/libperfstat_aix.hpp
40930 views
/*1* Copyright (c) 2012, 2018 SAP SE. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324// Encapsulates the libperfstat library.25//26// The purpose of this code is to dynamically load the libperfstat library27// instead of statically linking against it. The libperfstat library is an28// AIX-specific library which only exists on AIX, not on PASE. If I want to29// share binaries between AIX and PASE, I cannot directly link against libperfstat.so.3031#ifndef OS_AIX_LIBPERFSTAT_AIX_HPP32#define OS_AIX_LIBPERFSTAT_AIX_HPP3334#include <sys/types.h>35#include <stdlib.h>3637///////////////////////////////////////////////////////////////////////////////////////////////38// These are excerpts from the AIX 5.3, 6.1, 7.1 libperfstat.h -39// this is all we need from libperfstat.h and I want to avoid having to include <libperfstat.h>40//41// Note: I define all structures as if I were to include libperfstat.h on an AIX 5.242// build machine.43//44// The ratio behind that is that if I would build on an AIX 5.2 build machine,45// include libperfstat.h and hard-link against libperfstat.a, the program should46// work without recompilation on all newer AIX versions.47//4849#define IDENTIFIER_LENGTH 64 /* length of strings included in the structures */505152typedef struct { /* structure element identifier */53char name[IDENTIFIER_LENGTH]; /* name of the identifier */54} perfstat_id_t;5556#define CEC_ID_LEN 40 /* CEC identifier length */57#define MAXCORRALNAMELEN 25 /* length of the wpar name */58#define FIRST_WPARNAME "" /* pseudo-name for the first WPAR */59#define FIRST_WPARID -1 /* pseudo-id for the first WPAR */6061typedef unsigned short cid_t; /* workload partition identifier */6263typedef struct { /* Virtual memory utilization */64u_longlong_t virt_total; /* total virtual memory (in 4KB pages) */65u_longlong_t real_total; /* total real memory (in 4KB pages) */66u_longlong_t real_free; /* free real memory (in 4KB pages) */67u_longlong_t real_pinned; /* real memory which is pinned (in 4KB pages) */68u_longlong_t real_inuse; /* real memory which is in use (in 4KB pages) */69u_longlong_t pgbad; /* number of bad pages */70u_longlong_t pgexct; /* number of page faults */71u_longlong_t pgins; /* number of pages paged in */72u_longlong_t pgouts; /* number of pages paged out */73u_longlong_t pgspins; /* number of page ins from paging space */74u_longlong_t pgspouts; /* number of page outs from paging space */75u_longlong_t scans; /* number of page scans by clock */76u_longlong_t cycles; /* number of page replacement cycles */77u_longlong_t pgsteals; /* number of page steals */78u_longlong_t numperm; /* number of frames used for files (in 4KB pages) */79u_longlong_t pgsp_total; /* total paging space (in 4KB pages) */80u_longlong_t pgsp_free; /* free paging space (in 4KB pages) */81u_longlong_t pgsp_rsvd; /* reserved paging space (in 4KB pages) */82u_longlong_t real_system; /* real memory used by system segments (in 4KB pages). This is the sum of all the used pages in segment marked for system usage.83* Since segment classifications are not always guaranteed to be accurate, this number is only an approximation. */84u_longlong_t real_user; /* real memory used by non-system segments (in 4KB pages). This is the sum of all pages used in segments not marked for system usage.85* Since segment classifications are not always guaranteed to be accurate, this number is only an approximation. */86u_longlong_t real_process; /* real memory used by process segments (in 4KB pages). This is real_total-real_free-numperm-real_system. Since real_system is an87* approximation, this number is too. */88u_longlong_t virt_active; /* Active virtual pages. Virtual pages are considered active if they have been accessed */8990} perfstat_memory_total_t;9192typedef struct { /* global cpu information AIX 5.3 < TL10 */93int ncpus; /* number of active logical processors */94int ncpus_cfg; /* number of configured processors */95char description[IDENTIFIER_LENGTH]; /* processor description (type/official name) */96u_longlong_t processorHZ; /* processor speed in Hz */97u_longlong_t user; /* raw total number of clock ticks spent in user mode */98u_longlong_t sys; /* raw total number of clock ticks spent in system mode */99u_longlong_t idle; /* raw total number of clock ticks spent idle */100u_longlong_t wait; /* raw total number of clock ticks spent waiting for I/O */101u_longlong_t pswitch; /* number of process switches (change in currently running process) */102u_longlong_t syscall; /* number of system calls executed */103u_longlong_t sysread; /* number of read system calls executed */104u_longlong_t syswrite; /* number of write system calls executed */105u_longlong_t sysfork; /* number of forks system calls executed */106u_longlong_t sysexec; /* number of execs system calls executed */107u_longlong_t readch; /* number of characters tranferred with read system call */108u_longlong_t writech; /* number of characters tranferred with write system call */109u_longlong_t devintrs; /* number of device interrupts */110u_longlong_t softintrs; /* number of software interrupts */111time_t lbolt; /* number of ticks since last reboot */112u_longlong_t loadavg[3]; /* (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes.113* To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. */114u_longlong_t runque; /* length of the run queue (processes ready) */115u_longlong_t swpque; /* ength of the swap queue (processes waiting to be paged in) */116u_longlong_t bread; /* number of blocks read */117u_longlong_t bwrite; /* number of blocks written */118u_longlong_t lread; /* number of logical read requests */119u_longlong_t lwrite; /* number of logical write requests */120u_longlong_t phread; /* number of physical reads (reads on raw devices) */121u_longlong_t phwrite; /* number of physical writes (writes on raw devices) */122u_longlong_t runocc; /* updated whenever runque is updated, i.e. the runqueue is occupied.123* This can be used to compute the simple average of ready processes */124u_longlong_t swpocc; /* updated whenever swpque is updated. i.e. the swpqueue is occupied.125* This can be used to compute the simple average processes waiting to be paged in */126u_longlong_t iget; /* number of inode lookups */127u_longlong_t namei; /* number of vnode lookup from a path name */128u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */129u_longlong_t msg; /* number of IPC message operations */130u_longlong_t sema; /* number of IPC semaphore operations */131u_longlong_t rcvint; /* number of tty receive interrupts */132u_longlong_t xmtint; /* number of tyy transmit interrupts */133u_longlong_t mdmint; /* number of modem interrupts */134u_longlong_t tty_rawinch; /* number of raw input characters */135u_longlong_t tty_caninch; /* number of canonical input characters (always zero) */136u_longlong_t tty_rawoutch; /* number of raw output characters */137u_longlong_t ksched; /* number of kernel processes created */138u_longlong_t koverf; /* kernel process creation attempts where:139* -the user has forked to their maximum limit140* -the configuration limit of processes has been reached */141u_longlong_t kexit; /* number of kernel processes that became zombies */142u_longlong_t rbread; /* number of remote read requests */143u_longlong_t rcread; /* number of cached remote reads */144u_longlong_t rbwrt; /* number of remote writes */145u_longlong_t rcwrt; /* number of cached remote writes */146u_longlong_t traps; /* number of traps */147int ncpus_high; /* index of highest processor online */148u_longlong_t puser; /* raw number of physical processor tics in user mode */149u_longlong_t psys; /* raw number of physical processor tics in system mode */150u_longlong_t pidle; /* raw number of physical processor tics idle */151u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */152u_longlong_t decrintrs; /* number of decrementer tics interrupts */153u_longlong_t mpcrintrs; /* number of mpc's received interrupts */154u_longlong_t mpcsintrs; /* number of mpc's sent interrupts */155u_longlong_t phantintrs; /* number of phantom interrupts */156u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */157u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */158u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */159u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */160u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */161u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */162u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */163u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */164short iowait; /* number of processes that are asleep waiting for buffered I/O */165short physio; /* number of processes waiting for raw I/O */166longlong_t twait; /* number of threads that are waiting for filesystem direct(cio) */167u_longlong_t hpi; /* number of hypervisor page-ins */168u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds) */169} perfstat_cpu_total_t_53;170171typedef struct { /* global cpu information AIX 6.1|5.3 > TL09 */172int ncpus; /* number of active logical processors */173int ncpus_cfg; /* number of configured processors */174char description[IDENTIFIER_LENGTH]; /* processor description (type/official name) */175u_longlong_t processorHZ; /* processor speed in Hz */176u_longlong_t user; /* raw total number of clock ticks spent in user mode */177u_longlong_t sys; /* raw total number of clock ticks spent in system mode */178u_longlong_t idle; /* raw total number of clock ticks spent idle */179u_longlong_t wait; /* raw total number of clock ticks spent waiting for I/O */180u_longlong_t pswitch; /* number of process switches (change in currently running process) */181u_longlong_t syscall; /* number of system calls executed */182u_longlong_t sysread; /* number of read system calls executed */183u_longlong_t syswrite; /* number of write system calls executed */184u_longlong_t sysfork; /* number of forks system calls executed */185u_longlong_t sysexec; /* number of execs system calls executed */186u_longlong_t readch; /* number of characters tranferred with read system call */187u_longlong_t writech; /* number of characters tranferred with write system call */188u_longlong_t devintrs; /* number of device interrupts */189u_longlong_t softintrs; /* number of software interrupts */190time_t lbolt; /* number of ticks since last reboot */191u_longlong_t loadavg[3]; /* (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes.192* To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. */193u_longlong_t runque; /* length of the run queue (processes ready) */194u_longlong_t swpque; /* length of the swap queue (processes waiting to be paged in) */195u_longlong_t bread; /* number of blocks read */196u_longlong_t bwrite; /* number of blocks written */197u_longlong_t lread; /* number of logical read requests */198u_longlong_t lwrite; /* number of logical write requests */199u_longlong_t phread; /* number of physical reads (reads on raw devices) */200u_longlong_t phwrite; /* number of physical writes (writes on raw devices) */201u_longlong_t runocc; /* updated whenever runque is updated, i.e. the runqueue is occupied.202* This can be used to compute the simple average of ready processes */203u_longlong_t swpocc; /* updated whenever swpque is updated. i.e. the swpqueue is occupied.204* This can be used to compute the simple average processes waiting to be paged in */205u_longlong_t iget; /* number of inode lookups */206u_longlong_t namei; /* number of vnode lookup from a path name */207u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */208u_longlong_t msg; /* number of IPC message operations */209u_longlong_t sema; /* number of IPC semaphore operations */210u_longlong_t rcvint; /* number of tty receive interrupts */211u_longlong_t xmtint; /* number of tyy transmit interrupts */212u_longlong_t mdmint; /* number of modem interrupts */213u_longlong_t tty_rawinch; /* number of raw input characters */214u_longlong_t tty_caninch; /* number of canonical input characters (always zero) */215u_longlong_t tty_rawoutch; /* number of raw output characters */216u_longlong_t ksched; /* number of kernel processes created */217u_longlong_t koverf; /* kernel process creation attempts where:218* -the user has forked to their maximum limit219* -the configuration limit of processes has been reached */220u_longlong_t kexit; /* number of kernel processes that became zombies */221u_longlong_t rbread; /* number of remote read requests */222u_longlong_t rcread; /* number of cached remote reads */223u_longlong_t rbwrt; /* number of remote writes */224u_longlong_t rcwrt; /* number of cached remote writes */225u_longlong_t traps; /* number of traps */226int ncpus_high; /* index of highest processor online */227u_longlong_t puser; /* raw number of physical processor tics in user mode */228u_longlong_t psys; /* raw number of physical processor tics in system mode */229u_longlong_t pidle; /* raw number of physical processor tics idle */230u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */231u_longlong_t decrintrs; /* number of decrementer tics interrupts */232u_longlong_t mpcrintrs; /* number of mpc's received interrupts */233u_longlong_t mpcsintrs; /* number of mpc's sent interrupts */234u_longlong_t phantintrs; /* number of phantom interrupts */235u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */236u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */237u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */238u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */239u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */240u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */241u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */242u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */243short iowait; /* number of processes that are asleep waiting for buffered I/O */244short physio; /* number of processes waiting for raw I/O */245longlong_t twait; /* number of threads that are waiting for filesystem direct(cio) */246u_longlong_t hpi; /* number of hypervisor page-ins */247u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds) */248u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */249u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */250u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */251u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */252int spurrflag; /* set if running in spurr mode */253} perfstat_cpu_total_t_61;254255typedef struct { /* global cpu information AIX 7.1 */256int ncpus; /* number of active logical processors */257int ncpus_cfg; /* number of configured processors */258char description[IDENTIFIER_LENGTH]; /* processor description (type/official name) */259u_longlong_t processorHZ; /* processor speed in Hz */260u_longlong_t user; /* raw total number of clock ticks spent in user mode */261u_longlong_t sys; /* raw total number of clock ticks spent in system mode */262u_longlong_t idle; /* raw total number of clock ticks spent idle */263u_longlong_t wait; /* raw total number of clock ticks spent waiting for I/O */264u_longlong_t pswitch; /* number of process switches (change in currently running process) */265u_longlong_t syscall; /* number of system calls executed */266u_longlong_t sysread; /* number of read system calls executed */267u_longlong_t syswrite; /* number of write system calls executed */268u_longlong_t sysfork; /* number of forks system calls executed */269u_longlong_t sysexec; /* number of execs system calls executed */270u_longlong_t readch; /* number of characters tranferred with read system call */271u_longlong_t writech; /* number of characters tranferred with write system call */272u_longlong_t devintrs; /* number of device interrupts */273u_longlong_t softintrs; /* number of software interrupts */274time_t lbolt; /* number of ticks since last reboot */275u_longlong_t loadavg[3]; /* (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes.276* To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. */277u_longlong_t runque; /* length of the run queue (processes ready) */278u_longlong_t swpque; /* ength of the swap queue (processes waiting to be paged in) */279u_longlong_t bread; /* number of blocks read */280u_longlong_t bwrite; /* number of blocks written */281u_longlong_t lread; /* number of logical read requests */282u_longlong_t lwrite; /* number of logical write requests */283u_longlong_t phread; /* number of physical reads (reads on raw devices) */284u_longlong_t phwrite; /* number of physical writes (writes on raw devices) */285u_longlong_t runocc; /* updated whenever runque is updated, i.e. the runqueue is occupied.286* This can be used to compute the simple average of ready processes */287u_longlong_t swpocc; /* updated whenever swpque is updated. i.e. the swpqueue is occupied.288* This can be used to compute the simple average processes waiting to be paged in */289u_longlong_t iget; /* number of inode lookups */290u_longlong_t namei; /* number of vnode lookup from a path name */291u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */292u_longlong_t msg; /* number of IPC message operations */293u_longlong_t sema; /* number of IPC semaphore operations */294u_longlong_t rcvint; /* number of tty receive interrupts */295u_longlong_t xmtint; /* number of tyy transmit interrupts */296u_longlong_t mdmint; /* number of modem interrupts */297u_longlong_t tty_rawinch; /* number of raw input characters */298u_longlong_t tty_caninch; /* number of canonical input characters (always zero) */299u_longlong_t tty_rawoutch; /* number of raw output characters */300u_longlong_t ksched; /* number of kernel processes created */301u_longlong_t koverf; /* kernel process creation attempts where:302* -the user has forked to their maximum limit303* -the configuration limit of processes has been reached */304u_longlong_t kexit; /* number of kernel processes that became zombies */305u_longlong_t rbread; /* number of remote read requests */306u_longlong_t rcread; /* number of cached remote reads */307u_longlong_t rbwrt; /* number of remote writes */308u_longlong_t rcwrt; /* number of cached remote writes */309u_longlong_t traps; /* number of traps */310int ncpus_high; /* index of highest processor online */311u_longlong_t puser; /* raw number of physical processor tics in user mode */312u_longlong_t psys; /* raw number of physical processor tics in system mode */313u_longlong_t pidle; /* raw number of physical processor tics idle */314u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */315u_longlong_t decrintrs; /* number of decrementer tics interrupts */316u_longlong_t mpcrintrs; /* number of mpc's received interrupts */317u_longlong_t mpcsintrs; /* number of mpc's sent interrupts */318u_longlong_t phantintrs; /* number of phantom interrupts */319u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */320u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */321u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */322u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */323u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */324u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */325u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */326u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */327short iowait; /* number of processes that are asleep waiting for buffered I/O */328short physio; /* number of processes waiting for raw I/O */329longlong_t twait; /* number of threads that are waiting for filesystem direct(cio) */330u_longlong_t hpi; /* number of hypervisor page-ins */331u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds) */332u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */333u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */334u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */335u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */336int spurrflag; /* set if running in spurr mode */337u_longlong_t version; /* version number (1, 2, etc.,) */338/* >>>>> END OF STRUCTURE DEFINITION <<<<< */339/* #define CURR_VERSION_CPU_TOTAL 1 Incremented by one for every new release *340* of perfstat_cpu_total_t data structure */341} perfstat_cpu_total_t_71;342343typedef struct { /* global cpu information AIX 7.2 / 6.1 TL6 (see oslevel -r) */344int ncpus; /* number of active logical processors */345int ncpus_cfg; /* number of configured processors */346char description[IDENTIFIER_LENGTH]; /* processor description (type/official name) */347u_longlong_t processorHZ; /* processor speed in Hz */348u_longlong_t user; /* raw total number of clock ticks spent in user mode */349u_longlong_t sys; /* raw total number of clock ticks spent in system mode */350u_longlong_t idle; /* raw total number of clock ticks spent idle */351u_longlong_t wait; /* raw total number of clock ticks spent waiting for I/O */352u_longlong_t pswitch; /* number of process switches (change in currently running process) */353u_longlong_t syscall; /* number of system calls executed */354u_longlong_t sysread; /* number of read system calls executed */355u_longlong_t syswrite; /* number of write system calls executed */356u_longlong_t sysfork; /* number of forks system calls executed */357u_longlong_t sysexec; /* number of execs system calls executed */358u_longlong_t readch; /* number of characters tranferred with read system call */359u_longlong_t writech; /* number of characters tranferred with write system call */360u_longlong_t devintrs; /* number of device interrupts */361u_longlong_t softintrs; /* number of software interrupts */362time_t lbolt; /* number of ticks since last reboot */363u_longlong_t loadavg[3]; /* (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes. */364/* To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. */365u_longlong_t runque; /* length of the run queue (processes ready) */366u_longlong_t swpque; /* ength of the swap queue (processes waiting to be paged in) */367u_longlong_t bread; /* number of blocks read */368u_longlong_t bwrite; /* number of blocks written */369u_longlong_t lread; /* number of logical read requests */370u_longlong_t lwrite; /* number of logical write requests */371u_longlong_t phread; /* number of physical reads (reads on raw devices) */372u_longlong_t phwrite; /* number of physical writes (writes on raw devices) */373u_longlong_t runocc; /* updated whenever runque is updated, i.e. the runqueue is occupied.374* This can be used to compute the simple average of ready processes */375u_longlong_t swpocc; /* updated whenever swpque is updated. i.e. the swpqueue is occupied.376* This can be used to compute the simple average processes waiting to be paged in */377u_longlong_t iget; /* number of inode lookups */378u_longlong_t namei; /* number of vnode lookup from a path name */379u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */380u_longlong_t msg; /* number of IPC message operations */381u_longlong_t sema; /* number of IPC semaphore operations */382u_longlong_t rcvint; /* number of tty receive interrupts */383u_longlong_t xmtint; /* number of tyy transmit interrupts */384u_longlong_t mdmint; /* number of modem interrupts */385u_longlong_t tty_rawinch; /* number of raw input characters */386u_longlong_t tty_caninch; /* number of canonical input characters (always zero) */387u_longlong_t tty_rawoutch;/* number of raw output characters */388u_longlong_t ksched; /* number of kernel processes created */389u_longlong_t koverf; /* kernel process creation attempts where:390* -the user has forked to their maximum limit391* -the configuration limit of processes has been reached */392u_longlong_t kexit; /* number of kernel processes that became zombies */393u_longlong_t rbread; /* number of remote read requests */394u_longlong_t rcread; /* number of cached remote reads */395u_longlong_t rbwrt; /* number of remote writes */396u_longlong_t rcwrt; /* number of cached remote writes */397u_longlong_t traps; /* number of traps */398int ncpus_high; /* index of highest processor online */399u_longlong_t puser; /* raw number of physical processor tics in user mode */400u_longlong_t psys; /* raw number of physical processor tics in system mode */401u_longlong_t pidle; /* raw number of physical processor tics idle */402u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */403u_longlong_t decrintrs; /* number of decrementer tics interrupts */404u_longlong_t mpcrintrs; /* number of mpc's received interrupts */405u_longlong_t mpcsintrs; /* number of mpc's sent interrupts */406u_longlong_t phantintrs; /* number of phantom interrupts */407u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */408u_longlong_t idle_donated_spurr;/* number of idle spurr cycles donated by a dedicated partition enabled for donation */409u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */410u_longlong_t busy_donated_spurr;/* number of busy spurr cycles donated by a dedicated partition enabled for donation */411u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */412u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */413u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */414u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */415short iowait; /* number of processes that are asleep waiting for buffered I/O */416short physio; /* number of processes waiting for raw I/O */417longlong_t twait; /* number of threads that are waiting for filesystem direct(cio) */418u_longlong_t hpi; /* number of hypervisor page-ins */419u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds) */420u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */421u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */422u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */423u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */424int spurrflag; /* set if running in spurr mode */425u_longlong_t version; /* version number (1, 2, etc.,) */426u_longlong_t tb_last; /*time base counter */427u_longlong_t purr_coalescing; /* If the calling partition is428* authorized to see pool wide statistics then429* PURR cycles consumed to coalesce data430* else set to zero.*/431u_longlong_t spurr_coalescing; /* If the calling partition is432* authorized to see pool wide statistics then433* SPURR cycles consumed to coalesce data434* else set to zero.*/435436/* >>>>> END OF STRUCTURE DEFINITION <<<<< */437#define CURR_VERSION_CPU_TOTAL 2 /* Incremented by one for every new release *438* of perfstat_cpu_total_t data structure */439} perfstat_cpu_total_t_72;440441442typedef union {443uint w;444struct {445unsigned smt_capable :1; /* OS supports SMT mode */446unsigned smt_enabled :1; /* SMT mode is on */447unsigned lpar_capable :1; /* OS supports logical partitioning */448unsigned lpar_enabled :1; /* logical partitioning is on */449unsigned shared_capable :1; /* OS supports shared processor LPAR */450unsigned shared_enabled :1; /* partition runs in shared mode */451unsigned dlpar_capable :1; /* OS supports dynamic LPAR */452unsigned capped :1; /* partition is capped */453unsigned kernel_is_64 :1; /* kernel is 64 bit */454unsigned pool_util_authority :1; /* pool utilization available */455unsigned donate_capable :1; /* capable of donating cycles */456unsigned donate_enabled :1; /* enabled for donating cycles */457unsigned ams_capable:1; /* 1 = AMS(Active Memory Sharing) capable, 0 = Not AMS capable */458unsigned ams_enabled:1; /* 1 = AMS(Active Memory Sharing) enabled, 0 = Not AMS enabled */459unsigned power_save:1; /* 1 = Power saving mode is enabled */460unsigned ame_enabled:1; /* Active Memory Expansion is enabled */461unsigned shared_extended :1;462unsigned spare :15; /* reserved for future usage */463} b;464} perfstat_partition_type_t;465466typedef struct { /* partition total information AIX 5.3 < TL6 */467char name[IDENTIFIER_LENGTH]; /* name of the logical partition */468perfstat_partition_type_t type; /* set of bits describing the partition */469int lpar_id; /* logical partition identifier */470int group_id; /* identifier of the LPAR group this partition is a member of */471int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */472int online_cpus; /* number of virtual CPUs currently online on the partition */473int max_cpus; /* maximum number of virtual CPUs this parition can ever have */474int min_cpus; /* minimum number of virtual CPUs this partition must have */475u_longlong_t online_memory; /* amount of memory currently online */476u_longlong_t max_memory; /* maximum amount of memory this partition can ever have */477u_longlong_t min_memory; /* minimum amount of memory this partition must have */478int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */479int max_proc_capacity; /* maximum number of processor units this partition can ever have */480int min_proc_capacity; /* minimum number of processor units this partition must have */481int proc_capacity_increment; /* increment value to the entitled capacity */482int unalloc_proc_capacity; /* number of processor units currently unallocated in the shared processor pool this partition belongs to */483int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */484int unalloc_var_proc_capacity_weight; /* number of variable processor capacity weight units currently unallocated in the shared processor pool this partition belongs to */485int online_phys_cpus_sys; /* number of physical CPUs currently active in the system containing this partition */486int max_phys_cpus_sys; /* maximum possible number of physical CPUs in the system containing this partition */487int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */488u_longlong_t puser; /* raw number of physical processor tics in user mode */489u_longlong_t psys; /* raw number of physical processor tics in system mode */490u_longlong_t pidle; /* raw number of physical processor tics idle */491u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */492u_longlong_t pool_idle_time; /* number of clock tics a processor in the shared pool was idle */493u_longlong_t phantintrs; /* number of phantom interrupts received by the partition */494u_longlong_t invol_virt_cswitch; /* number involuntary virtual CPU context switches */495u_longlong_t vol_virt_cswitch; /* number voluntary virtual CPU context switches */496u_longlong_t timebase_last; /* most recently cpu time base */497u_longlong_t reserved_pages; /* Currenlty number of 16GB pages. Cannot participate in DR operations */498u_longlong_t reserved_pagesize; /* Currently 16GB pagesize Cannot participate in DR operations */499} perfstat_partition_total_t_53_5;500501typedef struct { /* partition total information AIX 5.3 < TL10 */502char name[IDENTIFIER_LENGTH]; /* name of the logical partition */503perfstat_partition_type_t type; /* set of bits describing the partition */504int lpar_id; /* logical partition identifier */505int group_id; /* identifier of the LPAR group this partition is a member of */506int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */507int online_cpus; /* number of virtual CPUs currently online on the partition */508int max_cpus; /* maximum number of virtual CPUs this parition can ever have */509int min_cpus; /* minimum number of virtual CPUs this partition must have */510u_longlong_t online_memory; /* amount of memory currently online */511u_longlong_t max_memory; /* maximum amount of memory this partition can ever have */512u_longlong_t min_memory; /* minimum amount of memory this partition must have */513int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */514int max_proc_capacity; /* maximum number of processor units this partition can ever have */515int min_proc_capacity; /* minimum number of processor units this partition must have */516int proc_capacity_increment; /* increment value to the entitled capacity */517int unalloc_proc_capacity; /* number of processor units currently unallocated in the shared processor pool this partition belongs to */518int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */519int unalloc_var_proc_capacity_weight; /* number of variable processor capacity weight units currently unallocated in the shared processor pool this partition belongs to */520int online_phys_cpus_sys; /* number of physical CPUs currently active in the system containing this partition */521int max_phys_cpus_sys; /* maximum possible number of physical CPUs in the system containing this partition */522int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */523u_longlong_t puser; /* raw number of physical processor tics in user mode */524u_longlong_t psys; /* raw number of physical processor tics in system mode */525u_longlong_t pidle; /* raw number of physical processor tics idle */526u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */527u_longlong_t pool_idle_time; /* number of clock tics a processor in the shared pool was idle */528u_longlong_t phantintrs; /* number of phantom interrupts received by the partition */529u_longlong_t invol_virt_cswitch; /* number involuntary virtual CPU context switches */530u_longlong_t vol_virt_cswitch; /* number voluntary virtual CPU context switches */531u_longlong_t timebase_last; /* most recently cpu time base */532u_longlong_t reserved_pages; /* Currenlty number of 16GB pages. Cannot participate in DR operations */533u_longlong_t reserved_pagesize; /* Currently 16GB pagesize Cannot participate in DR operations */534u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */535u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */536u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */537u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */538u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */539u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */540u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */541u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */542u_longlong_t shcpus_in_sys; /* Number of physical processors allocated for shared processor use */543u_longlong_t max_pool_capacity; /* Maximum processor capacity of partitions pool */544u_longlong_t entitled_pool_capacity; /* Entitled processor capacity of partitions pool */545u_longlong_t pool_max_time; /* Summation of maximum time that could be consumed by the pool (nano seconds) */546u_longlong_t pool_busy_time; /* Summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */547u_longlong_t pool_scaled_busy_time; /* Scaled summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */548u_longlong_t shcpu_tot_time; /* Summation of total time across all physical processors allocated for shared processor use (nano seconds) */549u_longlong_t shcpu_busy_time; /* Summation of busy (non-idle) time accumulated across all shared processor partitions (nano seconds) */550u_longlong_t shcpu_scaled_busy_time; /* Scaled summation of busy time accumulated across all shared processor partitions (nano seconds) */551int ams_pool_id; /* AMS pool id of the pool the LPAR belongs to */552int var_mem_weight; /* variable memory capacity weight */553u_longlong_t iome; /* I/O memory entitlement of the partition in bytes*/554u_longlong_t pmem; /* Physical memory currently backing the partition's logical memory in bytes*/555u_longlong_t hpi; /* number of hypervisor page-ins */556u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds)*/557u_longlong_t hypv_pagesize; /* Hypervisor page size in KB*/558} perfstat_partition_total_t_53;559560typedef struct { /* partition total information AIX 6.1|5.3 > TL09 */561char name[IDENTIFIER_LENGTH]; /* name of the logical partition */562perfstat_partition_type_t type; /* set of bits describing the partition */563int lpar_id; /* logical partition identifier */564int group_id; /* identifier of the LPAR group this partition is a member of */565int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */566int online_cpus; /* number of virtual CPUs currently online on the partition */567int max_cpus; /* maximum number of virtual CPUs this parition can ever have */568int min_cpus; /* minimum number of virtual CPUs this partition must have */569u_longlong_t online_memory; /* amount of memory currently online */570u_longlong_t max_memory; /* maximum amount of memory this partition can ever have */571u_longlong_t min_memory; /* minimum amount of memory this partition must have */572int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */573int max_proc_capacity; /* maximum number of processor units this partition can ever have */574int min_proc_capacity; /* minimum number of processor units this partition must have */575int proc_capacity_increment; /* increment value to the entitled capacity */576int unalloc_proc_capacity; /* number of processor units currently unallocated in the shared processor pool this partition belongs to */577int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */578int unalloc_var_proc_capacity_weight; /* number of variable processor capacity weight units currently unallocated in the shared processor pool this partition belongs to */579int online_phys_cpus_sys; /* number of physical CPUs currently active in the system containing this partition */580int max_phys_cpus_sys; /* maximum possible number of physical CPUs in the system containing this partition */581int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */582u_longlong_t puser; /* raw number of physical processor tics in user mode */583u_longlong_t psys; /* raw number of physical processor tics in system mode */584u_longlong_t pidle; /* raw number of physical processor tics idle */585u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */586u_longlong_t pool_idle_time; /* number of clock tics a processor in the shared pool was idle */587u_longlong_t phantintrs; /* number of phantom interrupts received by the partition */588u_longlong_t invol_virt_cswitch; /* number involuntary virtual CPU context switches */589u_longlong_t vol_virt_cswitch; /* number voluntary virtual CPU context switches */590u_longlong_t timebase_last; /* most recently cpu time base */591u_longlong_t reserved_pages; /* Currenlty number of 16GB pages. Cannot participate in DR operations */592u_longlong_t reserved_pagesize; /* Currently 16GB pagesize Cannot participate in DR operations */593u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */594u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */595u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */596u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */597u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */598u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */599u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */600u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */601u_longlong_t shcpus_in_sys; /* Number of physical processors allocated for shared processor use */602u_longlong_t max_pool_capacity; /* Maximum processor capacity of partitions pool */603u_longlong_t entitled_pool_capacity; /* Entitled processor capacity of partitions pool */604u_longlong_t pool_max_time; /* Summation of maximum time that could be consumed by the pool (nano seconds) */605u_longlong_t pool_busy_time; /* Summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */606u_longlong_t pool_scaled_busy_time; /* Scaled summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */607u_longlong_t shcpu_tot_time; /* Summation of total time across all physical processors allocated for shared processor use (nano seconds) */608u_longlong_t shcpu_busy_time; /* Summation of busy (non-idle) time accumulated across all shared processor partitions (nano seconds) */609u_longlong_t shcpu_scaled_busy_time; /* Scaled summation of busy time accumulated across all shared processor partitions (nano seconds) */610int ams_pool_id; /* AMS pool id of the pool the LPAR belongs to */611int var_mem_weight; /* variable memory capacity weight */612u_longlong_t iome; /* I/O memory entitlement of the partition in bytes*/613u_longlong_t pmem; /* Physical memory currently backing the partition's logical memory in bytes*/614u_longlong_t hpi; /* number of hypervisor page-ins */615u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds)*/616u_longlong_t hypv_pagesize; /* Hypervisor page size in KB*/617uint online_lcpus; /* number of online logical cpus */618uint smt_thrds; /* number of hardware threads that are running */619u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */620u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */621u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */622u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */623int spurrflag; /* set if running in spurr mode */624} perfstat_partition_total_t_61;625626typedef struct { /* partition total information AIX 7.1 */627char name[IDENTIFIER_LENGTH]; /* name of the logical partition */628perfstat_partition_type_t type; /* set of bits describing the partition */629int lpar_id; /* logical partition identifier */630int group_id; /* identifier of the LPAR group this partition is a member of */631int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */632int online_cpus; /* number of virtual CPUs currently online on the partition */633int max_cpus; /* maximum number of virtual CPUs this parition can ever have */634int min_cpus; /* minimum number of virtual CPUs this partition must have */635u_longlong_t online_memory; /* amount of memory currently online */636u_longlong_t max_memory; /* maximum amount of memory this partition can ever have */637u_longlong_t min_memory; /* minimum amount of memory this partition must have */638int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */639int max_proc_capacity; /* maximum number of processor units this partition can ever have */640int min_proc_capacity; /* minimum number of processor units this partition must have */641int proc_capacity_increment; /* increment value to the entitled capacity */642int unalloc_proc_capacity; /* number of processor units currently unallocated in the shared processor pool this partition belongs to */643int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */644int unalloc_var_proc_capacity_weight; /* number of variable processor capacity weight units currently unallocated in the shared processor pool this partition belongs to */645int online_phys_cpus_sys; /* number of physical CPUs currently active in the system containing this partition */646int max_phys_cpus_sys; /* maximum possible number of physical CPUs in the system containing this partition */647int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */648u_longlong_t puser; /* raw number of physical processor tics in user mode */649u_longlong_t psys; /* raw number of physical processor tics in system mode */650u_longlong_t pidle; /* raw number of physical processor tics idle */651u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */652u_longlong_t pool_idle_time; /* number of clock tics a processor in the shared pool was idle */653u_longlong_t phantintrs; /* number of phantom interrupts received by the partition */654u_longlong_t invol_virt_cswitch; /* number involuntary virtual CPU context switches */655u_longlong_t vol_virt_cswitch; /* number voluntary virtual CPU context switches */656u_longlong_t timebase_last; /* most recently cpu time base */657u_longlong_t reserved_pages; /* Currenlty number of 16GB pages. Cannot participate in DR operations */658u_longlong_t reserved_pagesize; /* Currently 16GB pagesize Cannot participate in DR operations */659u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */660u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */661u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */662u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */663u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */664u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */665u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */666u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */667u_longlong_t shcpus_in_sys; /* Number of physical processors allocated for shared processor use */668u_longlong_t max_pool_capacity; /* Maximum processor capacity of partitions pool */669u_longlong_t entitled_pool_capacity; /* Entitled processor capacity of partitions pool */670u_longlong_t pool_max_time; /* Summation of maximum time that could be consumed by the pool (nano seconds) */671u_longlong_t pool_busy_time; /* Summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */672u_longlong_t pool_scaled_busy_time; /* Scaled summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */673u_longlong_t shcpu_tot_time; /* Summation of total time across all physical processors allocated for shared processor use (nano seconds) */674u_longlong_t shcpu_busy_time; /* Summation of busy (non-idle) time accumulated across all shared processor partitions (nano seconds) */675u_longlong_t shcpu_scaled_busy_time; /* Scaled summation of busy time accumulated across all shared processor partitions (nano seconds) */676int ams_pool_id; /* AMS pool id of the pool the LPAR belongs to */677int var_mem_weight; /* variable memory capacity weight */678u_longlong_t iome; /* I/O memory entitlement of the partition in bytes*/679u_longlong_t pmem; /* Physical memory currently backing the partition's logical memory in bytes*/680u_longlong_t hpi; /* number of hypervisor page-ins */681u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds)*/682u_longlong_t hypv_pagesize; /* Hypervisor page size in KB*/683uint online_lcpus; /* number of online logical cpus */684uint smt_thrds; /* number of hardware threads that are running */685u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */686u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */687u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */688u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */689int spurrflag; /* set if running in spurr mode */690char hardwareid[CEC_ID_LEN]; /* CEC Identifier */691uint power_save_mode; /* Power save mode for the LPAR. Introduced through LI 53K PRF : Feature 728 292*/692ushort ame_version; /* AME Version */693u_longlong_t true_memory; /* True Memory Size in 4KB pages */694u_longlong_t expanded_memory; /* Expanded Memory Size in 4KB pages */695u_longlong_t target_memexp_factr; /* Target Memory Expansion Factor scaled by 100 */696u_longlong_t current_memexp_factr; /* Current Memory Expansion Factor scaled by 100 */697u_longlong_t target_cpool_size; /* Target Compressed Pool Size in bytes */698u_longlong_t max_cpool_size; /* Max Size of Compressed Pool in bytes */699u_longlong_t min_ucpool_size; /* Min Size of Uncompressed Pool in bytes */700u_longlong_t ame_deficit_size; /*Deficit memory size in bytes */701u_longlong_t version; /* version number (1, 2, etc.,) */702u_longlong_t cmcs_total_time; /* Total CPU time spent due to active memory expansion */703} perfstat_partition_total_t_71;704705typedef struct { /* partition total information AIX 7.1 >= TL1*/706char name[IDENTIFIER_LENGTH]; /* name of the logical partition */707perfstat_partition_type_t type; /* set of bits describing the partition */708int lpar_id; /* logical partition identifier */709int group_id; /* identifier of the LPAR group this partition is a member of */710int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */711int online_cpus; /* number of virtual CPUs currently online on the partition */712int max_cpus; /* maximum number of virtual CPUs this parition can ever have */713int min_cpus; /* minimum number of virtual CPUs this partition must have */714u_longlong_t online_memory; /* amount of memory currently online */715u_longlong_t max_memory; /* maximum amount of memory this partition can ever have */716u_longlong_t min_memory; /* minimum amount of memory this partition must have */717int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */718int max_proc_capacity; /* maximum number of processor units this partition can ever have */719int min_proc_capacity; /* minimum number of processor units this partition must have */720int proc_capacity_increment; /* increment value to the entitled capacity */721int unalloc_proc_capacity; /* number of processor units currently unallocated in the shared processor pool this partition belongs to */722int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */723int unalloc_var_proc_capacity_weight; /* number of variable processor capacity weight units currently unallocated in the shared processor pool this partition belongs to */724int online_phys_cpus_sys; /* number of physical CPUs currently active in the system containing this partition */725int max_phys_cpus_sys; /* maximum possible number of physical CPUs in the system containing this partition */726int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */727u_longlong_t puser; /* raw number of physical processor tics in user mode */728u_longlong_t psys; /* raw number of physical processor tics in system mode */729u_longlong_t pidle; /* raw number of physical processor tics idle */730u_longlong_t pwait; /* raw number of physical processor tics waiting for I/O */731u_longlong_t pool_idle_time; /* number of clock tics a processor in the shared pool was idle */732u_longlong_t phantintrs; /* number of phantom interrupts received by the partition */733u_longlong_t invol_virt_cswitch; /* number involuntary virtual CPU context switches */734u_longlong_t vol_virt_cswitch; /* number voluntary virtual CPU context switches */735u_longlong_t timebase_last; /* most recently cpu time base */736u_longlong_t reserved_pages; /* Currenlty number of 16GB pages. Cannot participate in DR operations */737u_longlong_t reserved_pagesize; /* Currently 16GB pagesize Cannot participate in DR operations */738u_longlong_t idle_donated_purr; /* number of idle cycles donated by a dedicated partition enabled for donation */739u_longlong_t idle_donated_spurr; /* number of idle spurr cycles donated by a dedicated partition enabled for donation */740u_longlong_t busy_donated_purr; /* number of busy cycles donated by a dedicated partition enabled for donation */741u_longlong_t busy_donated_spurr; /* number of busy spurr cycles donated by a dedicated partition enabled for donation */742u_longlong_t idle_stolen_purr; /* number of idle cycles stolen by the hypervisor from a dedicated partition */743u_longlong_t idle_stolen_spurr; /* number of idle spurr cycles stolen by the hypervisor from a dedicated partition */744u_longlong_t busy_stolen_purr; /* number of busy cycles stolen by the hypervisor from a dedicated partition */745u_longlong_t busy_stolen_spurr; /* number of busy spurr cycles stolen by the hypervisor from a dedicated partition */746u_longlong_t shcpus_in_sys; /* Number of physical processors allocated for shared processor use */747u_longlong_t max_pool_capacity; /* Maximum processor capacity of partitions pool */748u_longlong_t entitled_pool_capacity; /* Entitled processor capacity of partitions pool */749u_longlong_t pool_max_time; /* Summation of maximum time that could be consumed by the pool (nano seconds) */750u_longlong_t pool_busy_time; /* Summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */751u_longlong_t pool_scaled_busy_time; /* Scaled summation of busy (non-idle) time accumulated across all partitions in the pool (nano seconds) */752u_longlong_t shcpu_tot_time; /* Summation of total time across all physical processors allocated for shared processor use (nano seconds) */753u_longlong_t shcpu_busy_time; /* Summation of busy (non-idle) time accumulated across all shared processor partitions (nano seconds) */754u_longlong_t shcpu_scaled_busy_time; /* Scaled summation of busy time accumulated across all shared processor partitions (nano seconds) */755int ams_pool_id; /* AMS pool id of the pool the LPAR belongs to */756int var_mem_weight; /* variable memory capacity weight */757u_longlong_t iome; /* I/O memory entitlement of the partition in bytes*/758u_longlong_t pmem; /* Physical memory currently backing the partition's logical memory in bytes*/759u_longlong_t hpi; /* number of hypervisor page-ins */760u_longlong_t hpit; /* Time spent in hypervisor page-ins (in nanoseconds)*/761u_longlong_t hypv_pagesize; /* Hypervisor page size in KB*/762uint online_lcpus; /* number of online logical cpus */763uint smt_thrds; /* number of hardware threads that are running */764u_longlong_t puser_spurr; /* number of spurr cycles spent in user mode */765u_longlong_t psys_spurr; /* number of spurr cycles spent in kernel mode */766u_longlong_t pidle_spurr; /* number of spurr cycles spent in idle mode */767u_longlong_t pwait_spurr; /* number of spurr cycles spent in wait mode */768int spurrflag; /* set if running in spurr mode */769char hardwareid[CEC_ID_LEN]; /* CEC Identifier */770uint power_save_mode; /* Power save mode for the LPAR. Introduced through LI 53K PRF : Feature 728 292*/771ushort ame_version; /* AME Version */772u_longlong_t true_memory; /* True Memory Size in 4KB pages */773u_longlong_t expanded_memory; /* Expanded Memory Size in 4KB pages */774u_longlong_t target_memexp_factr; /* Target Memory Expansion Factor scaled by 100 */775u_longlong_t current_memexp_factr; /* Current Memory Expansion Factor scaled by 100 */776u_longlong_t target_cpool_size; /* Target Compressed Pool Size in bytes */777u_longlong_t max_cpool_size; /* Max Size of Compressed Pool in bytes */778u_longlong_t min_ucpool_size; /* Min Size of Uncompressed Pool in bytes */779u_longlong_t ame_deficit_size; /*Deficit memory size in bytes */780u_longlong_t version; /* version number (1, 2, etc.,) */781u_longlong_t cmcs_total_time; /* Total CPU time spent due to active memory expansion */782u_longlong_t purr_coalescing; /* If the calling partition is authorized to see pool wide statistics then PURR cycles consumed to coalesce data else set to zero.*/783u_longlong_t spurr_coalescing; /* If the calling partition is authorized to see pool wide statistics then SPURR cycles consumed to coalesce data else set to zero.*/784u_longlong_t MemPoolSize; /* Indicates the memory pool size of the pool that the partition belongs to (in bytes)., mpsz */785u_longlong_t IOMemEntInUse; /* I/O memory entitlement of the LPAR in use in bytes. iomu */786u_longlong_t IOMemEntFree; /* free I/O memory entitlement in bytes. iomf */787u_longlong_t IOHighWaterMark; /* high water mark of I/O memory entitlement usage in bytes. iohwn */788u_longlong_t purr_counter; /* number of purr cycles spent in user + kernel mode */789u_longlong_t spurr_counter; /* number of spurr cycles spent in user + kernel mode */790791/* Marketing Requirement(MR): MR1124083744 */792u_longlong_t real_free; /* free real memory (in 4KB pages) */793u_longlong_t real_avail; /* number of pages available for user application (memfree + numperm - minperm - minfree) */794/* >>>>> END OF STRUCTURE DEFINITION <<<<< */795#define CURR_VERSION_PARTITION_TOTAL 5 /* Incremented by one for every new release *796* of perfstat_partition_total_t data structure */797} perfstat_partition_total_t_71_1;798799typedef union { /* WPAR Type & Flags */800uint w;801struct {802unsigned app_wpar :1; /* Application WPAR */803unsigned cpu_rset :1; /* WPAR restricted to CPU resource set */804unsigned cpu_xrset:1; /* WPAR restricted to CPU Exclusive resource set */805unsigned cpu_limits :1; /* CPU resource limits enforced */806unsigned mem_limits :1; /* Memory resource limits enforced */807unsigned spare :27; /* reserved for future usage */808} b;809} perfstat_wpar_type_t;810811typedef struct { /* Workload partition Information AIX 5.3 & 6.1*/812char name[MAXCORRALNAMELEN+1]; /* name of the Workload Partition */813perfstat_wpar_type_t type; /* set of bits describing the wpar */814cid_t wpar_id; /* workload partition identifier */815uint online_cpus; /* Number of Virtual CPUs in partition rset or number of virtual CPUs currently online on the Global partition*/816int cpu_limit; /* CPU limit in 100ths of % - 1..10000 */817int mem_limit; /* Memory limit in 100ths of % - 1..10000 */818u_longlong_t online_memory; /* amount of memory currently online in Global Partition */819int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */820} perfstat_wpar_total_t_61;821822typedef struct { /* Workload partition Information AIX 7.1*/823char name[MAXCORRALNAMELEN+1]; /* name of the Workload Partition */824perfstat_wpar_type_t type; /* set of bits describing the wpar */825cid_t wpar_id; /* workload partition identifier */826uint online_cpus; /* Number of Virtual CPUs in partition rset or number of virtual CPUs currently online on the Global partition*/827int cpu_limit; /* CPU limit in 100ths of % - 1..10000 */828int mem_limit; /* Memory limit in 100ths of % - 1..10000 */829u_longlong_t online_memory; /* amount of memory currently online in Global Partition */830int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */831u_longlong_t version; /* version number (1, 2, etc.,) */832/* >>>>> END OF STRUCTURE DEFINITION <<<<< */833#define CURR_VERSION_WPAR_TOTAL 1 /* Incremented by one for every new release *834* of perfstat_wpar_total_t data structure */835} perfstat_wpar_total_t_71;836837typedef void * rsethandle_t; /* Type to identify a resource set handle: rsethandle_t */838839typedef enum { WPARNAME, WPARID, RSETHANDLE } wparid_specifier; /* Type of wparid_specifier */840841typedef struct { /* WPAR identifier */842wparid_specifier spec; /* Specifier to choose wpar id or name */843union {844cid_t wpar_id; /* WPAR ID */845rsethandle_t rset; /* Rset Handle */846char wparname[MAXCORRALNAMELEN+1]; /* WPAR NAME */847} u;848char name[IDENTIFIER_LENGTH]; /* name of the structure element identifier */849} perfstat_id_wpar_t;850851852853// end: libperfstat.h (AIX 5.2, 5.3, 6.1, 7.1)854//////////////////////////////////////////////////////////////////////////////////////////////////////////////855856#define PERFSTAT_PARTITON_TOTAL_T_LATEST perfstat_partition_total_t_71_1/* latest perfstat_partition_total_t structure */857#define PERFSTAT_CPU_TOTAL_T_LATEST perfstat_cpu_total_t_72 /* latest perfstat_cpu_total_t structure */858#define PERFSTAT_WPAR_TOTAL_T_LATEST perfstat_wpar_total_t_71 /* latest perfstat_wpar_total_t structure */859860class libperfstat {861862public:863864// Load the libperfstat library (must be in LIBPATH).865// Returns true if succeeded, false if error.866static bool init();867static void cleanup();868869// Direct wrappers for the libperfstat functionality. All they do is870// to call the functions with the same name via function pointers.871// Get all available data also on newer AIX versions (PERFSTAT_CPU_TOTAL_T_LATEST).872static int perfstat_cpu_total(perfstat_id_t *name, PERFSTAT_CPU_TOTAL_T_LATEST* userbuff,873int sizeof_userbuff, int desired_number);874875static int perfstat_memory_total(perfstat_id_t *name, perfstat_memory_total_t* userbuff,876int sizeof_userbuff, int desired_number);877878static int perfstat_partition_total(perfstat_id_t *name, PERFSTAT_PARTITON_TOTAL_T_LATEST* userbuff,879int sizeof_userbuff, int desired_number);880881static void perfstat_reset();882883static int perfstat_wpar_total(perfstat_id_wpar_t *name, PERFSTAT_WPAR_TOTAL_T_LATEST* userbuff,884int sizeof_userbuff, int desired_number);885886static cid_t wpar_getcid();887888889////////////////////////////////////////////////////////////////890// The convenience functions get_partitioninfo(), get_cpuinfo(), get_wparinfo() return891// information about partition, cpu and wpars, respectivly. They can be used without892// regard for which OS release we are on. On older AIX release, some output structure893// members will be 0.894895// Result struct for get_partitioninfo().896struct partitioninfo_t {897// partition type info898unsigned smt_capable :1; /* OS supports SMT mode */899unsigned smt_enabled :1; /* SMT mode is on */900unsigned lpar_capable :1; /* OS supports logical partitioning */901unsigned lpar_enabled :1; /* logical partitioning is on */902unsigned shared_capable :1; /* OS supports shared processor LPAR */903unsigned shared_enabled :1; /* partition runs in shared mode */904unsigned dlpar_capable :1; /* OS supports dynamic LPAR */905unsigned capped :1; /* partition is capped */906unsigned kernel_is_64 :1; /* kernel is 64 bit */907unsigned pool_util_authority :1; /* pool utilization available */908unsigned donate_capable :1; /* capable of donating cycles */909unsigned donate_enabled :1; /* enabled for donating cycles */910unsigned ams_capable:1; /* 1 = AMS(Active Memory Sharing) capable, 0 = Not AMS capable */911unsigned ams_enabled:1; /* 1 = AMS(Active Memory Sharing) enabled, 0 = Not AMS enabled */912unsigned power_save:1; /* 1 = Power saving mode is enabled */913unsigned ame_enabled:1; /* Active Memory Expansion is enabled */914// partition total info915int online_cpus; /* number of virtual CPUs currently online on the partition */916int entitled_proc_capacity; /* number of processor units this partition is entitled to receive */917int var_proc_capacity_weight; /* partition priority weight to receive extra capacity */918int phys_cpus_pool; /* number of the physical CPUs currently in the shared processor pool this partition belong to */919int pool_id; /* identifier of the shared pool of physical processors this partition is a member of */920u_longlong_t entitled_pool_capacity; /* Entitled processor capacity of partitions pool */921char name[IDENTIFIER_LENGTH]; /* name of the logical partition */922923u_longlong_t timebase_last; /* most recently cpu time base (an incremented long int on PowerPC) */924u_longlong_t pool_idle_time; /* pool idle time = number of clock tics a processor in the shared pool was idle */925u_longlong_t pcpu_tics_user; /* raw number of physical processor tics in user mode */926u_longlong_t pcpu_tics_sys; /* raw number of physical processor tics in system mode */927u_longlong_t pcpu_tics_idle; /* raw number of physical processor tics idle */928u_longlong_t pcpu_tics_wait; /* raw number of physical processor tics waiting for I/O */929930u_longlong_t true_memory; /* True Memory Size in 4KB pages */931u_longlong_t expanded_memory; /* Expanded Memory Size in 4KB pages */932u_longlong_t target_memexp_factr; /* Target Memory Expansion Factor scaled by 100 */933u_longlong_t current_memexp_factr; /* Current Memory Expansion Factor scaled by 100 */934u_longlong_t cmcs_total_time; /* Total CPU time spent due to active memory expansion */935};936937// Result struct for get_cpuinfo().938struct cpuinfo_t {939char description[IDENTIFIER_LENGTH]; // processor description (type/official name)940u_longlong_t processorHZ; // processor speed in Hz941int ncpus; // number of active logical processors942double loadavg[3]; // (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes.943// To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>.944unsigned long long user_clock_ticks; // raw total number of clock ticks spent in user mode945unsigned long long sys_clock_ticks; // raw total number of clock ticks spent in system mode946unsigned long long idle_clock_ticks; // raw total number of clock ticks spent idle947unsigned long long wait_clock_ticks; // raw total number of clock ticks spent waiting for I/O948};949950// Result struct for get_wparinfo().951struct wparinfo_t {952char name[MAXCORRALNAMELEN+1]; /* name of the Workload Partition */953unsigned short wpar_id; /* workload partition identifier */954unsigned app_wpar :1; /* Application WPAR */955unsigned cpu_rset :1; /* WPAR restricted to CPU resource set */956unsigned cpu_xrset:1; /* WPAR restricted to CPU Exclusive resource set */957unsigned cpu_limits :1; /* CPU resource limits enforced */958unsigned mem_limits :1; /* Memory resource limits enforced */959int cpu_limit; /* CPU limit in 100ths of % - 1..10000 */960int mem_limit; /* Memory limit in 100ths of % - 1..10000 */961};962963static bool get_partitioninfo(partitioninfo_t* ppi);964static bool get_cpuinfo(cpuinfo_t* pci);965static bool get_wparinfo(wparinfo_t* pwi);966};967968#endif // OS_AIX_LIBPERFSTAT_AIX_HPP969970971