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