1 /* Copyright (c) 2020 Daniel Widdis, All Rights Reserved 2 * 3 * The contents of this file is dual-licensed under 2 4 * alternative Open Source/Free licenses: LGPL 2.1 or later and 5 * Apache License 2.0. (starting with JNA version 4.0.0). 6 * 7 * You can freely decide which license you want to apply to 8 * the project. 9 * 10 * You may obtain a copy of the LGPL License at: 11 * 12 * http://www.gnu.org/licenses/licenses.html 13 * 14 * A copy is also included in the downloadable source code package 15 * containing JNA, in file "LGPL2.1". 16 * 17 * You may obtain a copy of the Apache License at: 18 * 19 * http://www.apache.org/licenses/ 20 * 21 * A copy is also included in the downloadable source code package 22 * containing JNA, in file "AL2.0". 23 */ 24 package com.sun.jna.platform.unix.aix; 25 26 import com.sun.jna.Library; 27 import com.sun.jna.Native; 28 import com.sun.jna.NativeLong; 29 import com.sun.jna.Structure; 30 import com.sun.jna.Structure.FieldOrder; 31 import com.sun.jna.Union; 32 33 /** 34 * The perfstat API uses the perfstat kernel extension to extract various AIX® 35 * performance metrics. 36 * 37 * System component information is also retrieved from the Object Data Manager 38 * (ODM) and returned with the performance metrics. 39 * 40 * The perfstat API is thread–safe, and does not require root authority. 41 */ 42 public interface Perfstat extends Library { 43 44 Perfstat INSTANCE = SharedObjectLoader.getPerfstatInstance(); 45 46 int IDENTIFIER_LENGTH = 64; 47 48 @FieldOrder({ "name" }) 49 class perfstat_id_t extends Structure { 50 public byte[] name = new byte[IDENTIFIER_LENGTH]; 51 } 52 53 @FieldOrder({ "ncpus", "ncpus_cfg", "description", "processorHZ", "user", "sys", "idle", "wait", "pswitch", 54 "syscall", "sysread", "syswrite", "sysfork", "sysexec", "readch", "writech", "devintrs", "softintrs", 55 "lbolt", "loadavg", "runque", "swpque", "bread", "bwrite", "lread", "lwrite", "phread", "phwrite", "runocc", 56 "swpocc", "iget", "namei", "dirblk", "msg", "sema", "rcvint", "xmtint", "mdmint", "tty_rawinch", 57 "tty_caninch", "tty_rawoutch", "ksched", "koverf", "kexit", "rbread", "rcread", "rbwrt", "rcwrt", "traps", 58 "ncpus_high", "puser", "psys", "pidle", "pwait", "decrintrs", "mpcrintrs", "mpcsintrs", "phantintrs", 59 "idle_donated_purr", "idle_donated_spurr", "busy_donated_purr", "busy_donated_spurr", "idle_stolen_purr", 60 "idle_stolen_spurr", "busy_stolen_purr", "busy_stolen_spurr", "iowait", "physio", "twait", "hpi", "hpit", 61 "puser_spurr", "psys_spurr", "pidle_spurr", "pwait_spurr", "spurrflag", "version", "tb_last", 62 "purr_coalescing", "spurr_coalescing" }) 63 class perfstat_cpu_total_t extends Structure { 64 public int ncpus; // number of active logical processors 65 public int ncpus_cfg; // number of configured processors 66 public byte[] description = new byte[IDENTIFIER_LENGTH]; // processor description (type/official name) 67 public long processorHZ; // processor speed in Hz 68 public long user; // raw total number of clock ticks spent in user mode 69 public long sys; // raw total number of clock ticks spent in system mode 70 public long idle; // raw total number of clock ticks spent idle 71 public long wait; // raw total number of clock ticks spent waiting for I/O 72 public long pswitch; // number of process switches (change in currently running process) 73 public long syscall; // number of system calls executed 74 public long sysread; // number of read system calls executed 75 public long syswrite; // number of write system calls executed 76 public long sysfork; // number of forks system calls executed 77 public long sysexec; // number of execs system calls executed 78 public long readch; // number of characters tranferred with read system call 79 public long writech; // number of characters tranferred with write system call 80 public long devintrs; // number of device interrupts 81 public long softintrs; // number of software interrupts 82 public NativeLong lbolt; // number of ticks since last reboot 83 public long[] loadavg = new long[3]; // (1<<SBITS) times the average number of runnables processes during the 84 // last 1, 5 and 15 minutes. To calculate the load average, divide the 85 // numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. 86 public long runque; // length of the run queue (processes ready) 87 public long swpque; // ength of the swap queue (processes waiting to be paged in) 88 public long bread; // number of blocks read 89 public long bwrite; // number of blocks written 90 public long lread; // number of logical read requests 91 public long lwrite; // number of logical write requests 92 public long phread; // number of physical reads (reads on raw devices) 93 public long phwrite; // number of physical writes (writes on raw devices) 94 public long runocc; // updated whenever runque is updated, i.e. the runqueue is occupied. This can 95 // be used to compute the simple average of ready processes 96 public long swpocc; // updated whenever swpque is updated. i.e. the swpqueue is occupied. This can 97 // be used to compute the simple average processes waiting to be paged in 98 public long iget; // number of inode lookups 99 public long namei; // number of vnode lookup from a path name 100 public long dirblk; // number of 512-byte block reads by the directory search routine to locate an 101 // entry for a file 102 public long msg; // number of IPC message operations 103 public long sema; // number of IPC semaphore operations 104 public long rcvint; // number of tty receive interrupts 105 public long xmtint; // number of tyy transmit interrupts 106 public long mdmint; // number of modem interrupts 107 public long tty_rawinch; // number of raw input characters 108 public long tty_caninch; // number of canonical input characters (always zero) 109 public long tty_rawoutch; // number of raw output characters 110 public long ksched; // number of kernel processes created 111 public long koverf; // kernel process creation attempts where: 112 // -the user has forked to their maximum limit 113 // -the configuration limit of processes has been reached 114 public long kexit; // number of kernel processes that became zombies 115 public long rbread; // number of remote read requests 116 public long rcread; // number of cached remote reads 117 public long rbwrt; // number of remote writes 118 public long rcwrt; // number of cached remote writes 119 public long traps; // number of traps 120 public int ncpus_high; // index of highest processor online 121 public long puser; // raw number of physical processor tics in user mode 122 public long psys; // raw number of physical processor tics in system mode 123 public long pidle; // raw number of physical processor tics idle 124 public long pwait; // raw number of physical processor tics waiting for I/O 125 public long decrintrs; // number of decrementer tics interrupts 126 public long mpcrintrs; // number of mpc's received interrupts 127 public long mpcsintrs; // number of mpc's sent interrupts 128 public long phantintrs; // number of phantom interrupts 129 public long idle_donated_purr; // number of idle cycles donated by a dedicated partition enabled for donation 130 public long idle_donated_spurr; // number of idle spurr cycles donated by a dedicated partition enabled for 131 // donation 132 public long busy_donated_purr; // number of busy cycles donated by a dedicated partition enabled for donation 133 public long busy_donated_spurr; // number of busy spurr cycles donated by a dedicated partition enabled for 134 // donation 135 public long idle_stolen_purr; // number of idle cycles stolen by the hypervisor from a dedicated partition 136 public long idle_stolen_spurr; // number of idle spurr cycles stolen by the hypervisor from a dedicated 137 // partition 138 public long busy_stolen_purr; // number of busy cycles stolen by the hypervisor from a dedicated partition 139 public long busy_stolen_spurr; // number of busy spurr cycles stolen by the hypervisor from a dedicated 140 // partition 141 public short iowait; // number of processes that are asleep waiting for buffered I/O 142 public short physio; // number of processes waiting for raw I/O 143 public long twait; // number of threads that are waiting for filesystem direct(cio) 144 public long hpi; // number of hypervisor page-ins 145 public long hpit; // Time spent in hypervisor page-ins (in nanoseconds) 146 public long puser_spurr; // number of spurr cycles spent in user mode 147 public long psys_spurr; // number of spurr cycles spent in kernel mode 148 public long pidle_spurr; // number of spurr cycles spent in idle mode 149 public long pwait_spurr; // number of spurr cycles spent in wait mode 150 public int spurrflag; // set if running in spurr mode 151 public long version; // version number (1, 2, etc.,) 152 public long tb_last; // time base counter 153 public long purr_coalescing; // If the calling partition is authorized to see pool wide statistics then PURR 154 // cycles consumed to coalesce dataelse set to zero. 155 public long spurr_coalescing; // If the calling partition isauthorized to see pool wide statistics then SPURR 156 // cycles consumed to coalesce data else set to zero. 157 } 158 159 @FieldOrder({ "name", "user", "sys", "idle", "wait", "pswitch", "syscall", "sysread", "syswrite", "sysfork", 160 "sysexec", "readch", "writech", "bread", "bwrite", "lread", "lwrite", "phread", "phwrite", "iget", "namei", 161 "dirblk", "msg", "sema", "minfaults", "majfaults", "puser", "psys", "pidle", "pwait", "redisp_sd0", 162 "redisp_sd1", "redisp_sd2", "redisp_sd3", "redisp_sd4", "redisp_sd5", "migration_push", "migration_S3grq", 163 "migration_S3pul", "invol_cswitch", "vol_cswitch", "runque", "bound", "decrintrs", "mpcrintrs", "mpcsintrs", 164 "devintrs", "softintrs", "phantintrs", "idle_donated_purr", "idle_donated_spurr", "busy_donated_purr", 165 "busy_donated_spurr", "idle_stolen_purr", "idle_stolen_spurr", "busy_stolen_purr", "busy_stolen_spurr", 166 "hpi", "hpit", "puser_spurr", "psys_spurr", "pidle_spurr", "pwait_spurr", "spurrflag", "localdispatch", 167 "neardispatch", "fardispatch", "cswitches", "version", "tb_last" }) 168 class perfstat_cpu_t extends Structure { 169 public byte[] name = new byte[IDENTIFIER_LENGTH]; // logical processor name (cpu0, cpu1, ..) 170 public long user; // raw number of clock ticks spent in user mode 171 public long sys; // raw number of clock ticks spent in system mode 172 public long idle; // raw number of clock ticks spent idle 173 public long wait; // raw number of clock ticks spent waiting for I/O 174 public long pswitch; // number of context switches (changes of currently running process) 175 public long syscall; // number of system calls executed 176 public long sysread; // number of read system calls executed 177 public long syswrite; // number of write system calls executed 178 public long sysfork; // number of fork system call executed 179 public long sysexec; // number of exec system call executed 180 public long readch; // number of characters tranferred with read system call 181 public long writech; // number of characters tranferred with write system call 182 public long bread; // number of block reads 183 public long bwrite; // number of block writes 184 public long lread; // number of logical read requests 185 public long lwrite; // number of logical write requests 186 public long phread; // number of physical reads (reads on raw device) 187 public long phwrite; // number of physical writes (writes on raw device) 188 public long iget; // number of inode lookups 189 public long namei; // number of vnode lookup from a path name 190 public long dirblk; // number of 512-byte block reads by the directory search routine to locate an 191 // entry for a file 192 public long msg; // number of IPC message operations 193 public long sema; // number of IPC semaphore operations 194 public long minfaults; // number of page faults with no I/O 195 public long majfaults; // number of page faults with disk I/O 196 public long puser; // raw number of physical processor tics in user mode 197 public long psys; // raw number of physical processor tics in system mode 198 public long pidle; // raw number of physical processor tics idle 199 public long pwait; // raw number of physical processor tics waiting for I/O 200 public long redisp_sd0; // number of thread redispatches within the scheduler affinity domain 0 201 public long redisp_sd1; // number of thread redispatches within the scheduler affinity domain 1 202 public long redisp_sd2; // number of thread redispatches within the scheduler affinity domain 2 203 public long redisp_sd3; // number of thread redispatches within the scheduler affinity domain 3 204 public long redisp_sd4; // number of thread redispatches within the scheduler affinity domain 4 205 public long redisp_sd5; // number of thread redispatches within the scheduler affinity domain 5 206 public long migration_push; // number of thread migrations from the local runque to another queue due to 207 // starvation load balancing 208 public long migration_S3grq; // number of thread migrations from the global runque to the local runque 209 // resulting in a move accross scheduling domain 3 210 public long migration_S3pul; // number of thread migrations from another processor's runque resulting in a 211 // move accross scheduling domain 3 212 public long invol_cswitch; // number of involuntary thread context switches 213 public long vol_cswitch; // number of voluntary thread context switches 214 public long runque; // number of threads on the runque 215 public long bound; // number of bound threads 216 public long decrintrs; // number of decrementer tics interrupts 217 public long mpcrintrs; // number of mpc's received interrupts 218 public long mpcsintrs; // number of mpc's sent interrupts 219 public long devintrs; // number of device interrupts 220 public long softintrs; // number of offlevel handlers called 221 public long phantintrs; // number of phantom interrupts 222 public long idle_donated_purr; // number of idle cycles donated by a dedicated partition enabled for donation 223 public long idle_donated_spurr; // number of idle spurr cycles donated by a dedicated partition enabled for 224 // donation 225 public long busy_donated_purr; // number of busy cycles donated by a dedicated partition enabled for donation 226 public long busy_donated_spurr; // number of busy spurr cycles donated by a dedicated partition enabled for 227 // donation 228 public long idle_stolen_purr; // number of idle cycles stolen by the hypervisor from a dedicated partition 229 public long idle_stolen_spurr; // number of idle spurr cycles stolen by the hypervisor from a dedicated 230 // partition 231 public long busy_stolen_purr; // number of busy cycles stolen by the hypervisor from a dedicated partition 232 public long busy_stolen_spurr; // number of busy spurr cycles stolen by the hypervisor from a dedicated 233 // partition 234 public long hpi; // number of hypervisor page-ins 235 public long hpit; // Time spent in hypervisor page-ins (in nanoseconds) 236 public long puser_spurr; // number of spurr cycles spent in user mode 237 public long psys_spurr; // number of spurr cycles spent in kernel mode 238 public long pidle_spurr; // number of spurr cycles spent in idle mode 239 public long pwait_spurr; // number of spurr cycles spent in wait mode 240 public int spurrflag; // set if running in spurr mode 241 242 public long localdispatch; // number of local thread dispatches on this logical CPU 243 public long neardispatch; // number of near thread dispatches on this logical CPU 244 public long fardispatch; // number of far thread dispatches on this logical CPU 245 public long cswitches; // Context switches 246 public long version; // version number (1, 2, etc.,) 247 public long tb_last; // timebase counter 248 } 249 250 @FieldOrder({ "virt_total", "real_total", "real_free", "real_pinned", "real_inuse", "pgbad", "pgexct", "pgins", 251 "pgouts", "pgspins", "pgspouts", "scans", "cycles", "pgsteals", "numperm", "pgsp_total", "pgsp_free", 252 "pgsp_rsvd", "real_system", "real_user", "real_process", "virt_active", "iome", "iomu", "iohwm", "pmem", 253 "comprsd_total", "comprsd_wseg_pgs", "cpgins", "cpgouts", "true_size", "expanded_memory", 254 "comprsd_wseg_size", "target_cpool_size", "max_cpool_size", "min_ucpool_size", "cpool_size", "ucpool_size", 255 "cpool_inuse", "ucpool_inuse", "version", "real_avail", "bytes_coalesced", "bytes_coalesced_mempool" }) 256 class perfstat_memory_total_t extends Structure { 257 public long virt_total; // total virtual memory (in 4KB pages) 258 public long real_total; // total real memory (in 4KB pages) 259 public long real_free; // free real memory (in 4KB pages) 260 public long real_pinned; // real memory which is pinned (in 4KB pages) 261 public long real_inuse; // real memory which is in use (in 4KB pages) 262 public long pgbad; // number of bad pages 263 public long pgexct; // number of page faults 264 public long pgins; // number of pages paged in 265 public long pgouts; // number of pages paged out 266 public long pgspins; // number of page ins from paging space 267 public long pgspouts; // number of page outs from paging space 268 public long scans; // number of page scans by clock 269 public long cycles; // number of page replacement cycles 270 public long pgsteals; // number of page steals 271 public long numperm; // number of frames used for files (in 4KB pages) 272 public long pgsp_total; // total paging space (in 4KB pages) 273 public long pgsp_free; // free paging space (in 4KB pages) 274 public long pgsp_rsvd; // reserved paging space (in 4KB pages) 275 public long real_system; // real memory used by system segments (in 4KB pages). This is the sum of all 276 // the used pages in segment marked for system usage. Since segment 277 // classifications are not always guaranteed to be accurate, this number is only 278 // an approximation. 279 public long real_user; // real memory used by non-system segments (in 4KB pages). This is the sum of 280 // all pages used in segments not marked for system usage. Since segment 281 // classifications are not always guaranteed to be accurate, this number is only 282 // an approximation. 283 public long real_process; // real memory used by process segments (in 4KB pages). This is 284 // real_total-real_free-numperm-real_system. Since real_system is an 285 // approximation, this number is too. 286 public long virt_active; // Active virtual pages. Virtual pages are considered active if they have been 287 // accessed 288 public long iome; // I/O memory entitlement of the partition in bytes 289 public long iomu; // I/O memory entitlement of the partition in use in bytes 290 public long iohwm; // High water mark of I/O memory entitlement used in bytes 291 public long pmem; // Amount of physical mmeory currently backing partition's logical memory in 292 // bytes 293 294 public long comprsd_total; // Total numbers of pages in compressed pool (in 4KB pages) 295 public long comprsd_wseg_pgs; // Number of compressed working storage pages 296 public long cpgins; // number of page ins to compressed pool 297 public long cpgouts; // number of page outs from compressed pool 298 299 public long true_size; // True Memory Size in 4KB pages 300 public long expanded_memory; // Expanded Memory Size in 4KB pages 301 public long comprsd_wseg_size; // Total size of the compressed working storage pages in the pool 302 public long target_cpool_size; // Target Compressed Pool Size in bytes 303 public long max_cpool_size; // Max Size of Compressed Pool in bytes 304 public long min_ucpool_size; // Min Size of Uncompressed Pool in bytes 305 public long cpool_size; // Compressed Pool size in bytes 306 public long ucpool_size; // Uncompressed Pool size in bytes 307 public long cpool_inuse; // Compressed Pool Used in bytes 308 public long ucpool_inuse; // Uncompressed Pool Used in bytes 309 public long version; // version number (1, 2, etc.,) 310 public long real_avail; // number of pages (in 4KB pages) of memory available without paging out working 311 // segments 312 public long bytes_coalesced; // The number of bytes of the calling partition's logical real memory coalesced 313 // because they contained duplicated data 314 public long bytes_coalesced_mempool; // If the calling partition is authorized to see pool wide statistics then 315 // the number of bytes of logical real memory coalesced because they 316 // contained duplicated data in the calling partition's memory pool else 317 // set to zero. 318 } 319 320 @FieldOrder({ "version", "pid", "proc_name", "proc_priority", "num_threads", "proc_uid", "proc_classid", 321 "proc_size", "proc_real_mem_data", "proc_real_mem_text", "proc_virt_mem_data", "proc_virt_mem_text", 322 "shared_lib_data_size", "heap_size", "real_inuse", "virt_inuse", "pinned", "pgsp_inuse", "filepages", 323 "real_inuse_map", "virt_inuse_map", "pinned_inuse_map", "ucpu_time", "scpu_time", "last_timebase", 324 "inBytes", "outBytes", "inOps", "outOps" }) 325 class perfstat_process_t extends Structure { 326 public long version; // version number (1, 2, etc.,) 327 public long pid; // Process ID 328 public byte[] proc_name = new byte[64]; // Name of The Process 329 public int proc_priority; // Process Priority 330 public long num_threads; // Thread Count 331 public long proc_uid; // Owner Info 332 public long proc_classid; // WLM Class Name 333 public long proc_size; // Virtual Size of the Process in KB(Exclusive Usage, Leaving all Shared Library 334 // Text & Shared File Pages, Shared Memory, Memory Mapped) 335 public long proc_real_mem_data; // Real Memory used for Data in KB 336 public long proc_real_mem_text; // Real Memory used for Text in KB 337 public long proc_virt_mem_data; // Virtual Memory used to Data in KB 338 public long proc_virt_mem_text; // Virtual Memory used for Text in KB 339 public long shared_lib_data_size; // Data Size from Shared Library in KB 340 public long heap_size; // Heap Size in KB 341 public long real_inuse; // The Real memory in use(in KB) by the process including all kind of segments 342 // (excluding system segments). This includes Text, Data, Shared Library Text, 343 // Shared Library Data, File Pages, Shared Memory & Memory Mapped 344 public long virt_inuse; // The Virtual memory in use(in KB) by the process including all kind of 345 // segments (excluding system segments). This includes Text, Data, Shared 346 // Library Text, Shared Library Data, File Pages, Shared Memory & Memory Mapped 347 public long pinned; // Pinned Memory(in KB) for this process inclusive of all segments 348 public long pgsp_inuse; // Paging Space used(in KB) inclusive of all segments 349 public long filepages; // File Pages used(in KB) including shared pages 350 public long real_inuse_map; // Real memory used(in KB) for Shared Memory and Memory Mapped regions 351 public long virt_inuse_map; // Virtual Memory used(in KB) for Shared Memory and Memory Mapped regions 352 public long pinned_inuse_map; // Pinned memory(in KB) for Shared Memory and Memory Mapped regions 353 public double ucpu_time; // User Mode CPU time will be in percentage or milliseconds based on, whether it 354 // is filled by perfstat_process_util or perfstat_process respectively. 355 public double scpu_time; // System Mode CPU time will be in percentage or milliseconds based on, whether 356 // it is filled by perfstat_process_util or perfstat_process respectively. 357 public long last_timebase; // Timebase Counter 358 public long inBytes; // Bytes Read from Disk 359 public long outBytes; // Bytes Written to Disk 360 public long inOps; // In Operations from Disk 361 public long outOps; // Out Operations from Disk 362 } 363 364 @FieldOrder({ "name", "description", "vgname", "size", "free", "bsize", "xrate", "xfers", "wblks", "rblks", 365 "qdepth", "time", "adapter", "paths_count", "q_full", "rserv", "rtimeout", "rfailed", "min_rserv", 366 "max_rserv", "wserv", "wtimeout", "wfailed", "min_wserv", "max_wserv", "wq_depth", "wq_sampled", "wq_time", 367 "wq_min_time", "wq_max_time", "q_sampled", "wpar_id", "version", "dk_type" }) 368 class perfstat_disk_t extends Structure { 369 public byte[] name = new byte[IDENTIFIER_LENGTH]; // name of the disk 370 public byte[] description = new byte[IDENTIFIER_LENGTH]; // disk description (from ODM) 371 public byte[] vgname = new byte[IDENTIFIER_LENGTH]; // volume group name (from ODM) 372 public long size; // size of the disk (in MB) 373 public long free; // free portion of the disk (in MB) 374 public long bsize; // disk block size (in bytes) 375 public long xrate; // OBSOLETE: xrate capability 376 public long xfers; // number of transfers to/from disk 377 public long wblks; // number of blocks written to disk 378 public long rblks; // number of blocks read from disk 379 public long qdepth; // instantaneous "service" queue depth (number of requests sent to disk and not 380 // completed yet) 381 public long time; // amount of time disk is active 382 public byte[] adapter = new byte[IDENTIFIER_LENGTH]; // disk adapter name 383 public int paths_count; // number of paths to this disk 384 public long q_full; // "service" queue full occurrence count (number of times the disk is not 385 // accepting any more request) 386 public long rserv; // read or receive service time 387 public long rtimeout; // number of read request timeouts 388 public long rfailed; // number of failed read requests 389 public long min_rserv; // min read or receive service time 390 public long max_rserv; // max read or receive service time 391 public long wserv; // write or send service time 392 public long wtimeout; // number of write request timeouts 393 public long wfailed; // number of failed write requests 394 public long min_wserv; // min write or send service time 395 public long max_wserv; // max write or send service time 396 public long wq_depth; // instantaneous wait queue depth (number of requests waiting to be sent to 397 // disk) 398 public long wq_sampled; // accumulated sampled dk_wq_depth 399 public long wq_time; // accumulated wait queueing time 400 public long wq_min_time; // min wait queueing time 401 public long wq_max_time; // max wait queueing time 402 public long q_sampled; // accumulated sampled dk_q_depth 403 public short wpar_id; // WPAR identifier. cid_t is unsigned short 404 // Pad of 3 short is available here 405 public long version; // version number (1, 2, etc.,) 406 public int dk_type; // Holds more information about the disk. 32-bit union perfstat_dktype_t 407 } 408 409 @FieldOrder({ "online", "max", "min", "desired" }) 410 class perfstat_value_t extends Structure { 411 public long online; 412 public long max; 413 public long min; 414 public long desired; 415 } 416 417 @FieldOrder({ "version", "partitionname", "nodename", "conf", "partitionnum", "groupid", "processorFamily", 418 "processorModel", "machineID", "processorMHz", "numProcessors", "OSName", "OSVersion", "OSBuild", "lcpus", 419 "smtthreads", "drives", "nw_adapters", "cpucap", "cpucap_weightage", "entitled_proc_capacity", "vcpus", 420 "processor_poolid", "activecpusinpool", "cpupool_weightage", "sharedpcpu", "maxpoolcap", "entpoolcap", 421 "mem", "mem_weightage", "totiomement", "mempoolid", "hyperpgsize", "exp_mem", "targetmemexpfactor", 422 "targetmemexpsize" }) 423 class perfstat_partition_config_t extends Structure { 424 public long version; // Version number 425 public byte[] partitionname = new byte[64]; // Partition Name 426 public byte[] nodename = new byte[64]; // Node Name 427 public int conf; // Partition Properties (perfstat_partition_type_t 32-bit union) 428 public int partitionnum; // Partition Number 429 public int groupid; // Group ID 430 431 /* Hardware Configuration */ 432 public byte[] processorFamily = new byte[64]; // Processor Type 433 public byte[] processorModel = new byte[64]; // Processor Model 434 public byte[] machineID = new byte[64]; // Machine ID 435 public double processorMHz; // Processor Clock Speed in MHz 436 public perfstat_value_t numProcessors; // Number of Configured Physical Processors in frame 437 438 /* Software Configuration */ 439 public byte[] OSName = new byte[64]; // Name of Operating System 440 public byte[] OSVersion = new byte[64]; // Version of operating System 441 public byte[] OSBuild = new byte[64]; // Build of Operating System 442 443 /* Lpar Configuration */ 444 public int lcpus; // Number of Logical CPUs 445 public int smtthreads; // Number of SMT Threads 446 public int drives; // Total Number of Drives 447 public int nw_adapters; // Total Number of Network Adapters 448 449 /* Physical CPU related Configuration */ 450 public perfstat_value_t cpucap; // Min, Max and Online CPU Capacity 451 public int cpucap_weightage; // Variable Processor Capacity Weightage 452 public int entitled_proc_capacity; // number of processor units this partition is entitled to receive 453 /* Virtual CPU related Configuration */ 454 public perfstat_value_t vcpus; // Min, Max and Online Virtual CPUs 455 456 /* Processor Pool Related Configuration */ 457 public int processor_poolid; // Shared Pool ID of physical processors, to which this partition belongs 458 public int activecpusinpool; // Count of physical CPUs in the shared processor pool, to which this partition 459 // belongs 460 public int cpupool_weightage; // Pool Weightage 461 public int sharedpcpu; // Number of physical processors allocated for shared processor use 462 public int maxpoolcap; // Maximum processor capacity of partition's pool 463 public int entpoolcap; // Entitled processor capacity of partition's pool 464 465 /* Memory Related Configuration */ 466 public perfstat_value_t mem; // Min, Max and Online Memory 467 public int mem_weightage; // Variable Memory Capacity Weightage 468 469 /* AMS Related Configuration */ 470 public long totiomement; // I/O Memory Entitlement of the partition in bytes 471 public int mempoolid; // AMS pool id of the pool the LPAR belongs to 472 public long hyperpgsize; // Hypervisor page size in KB 473 474 /* AME Related Configuration */ 475 public perfstat_value_t exp_mem; // Min, Max and Online Expanded Memory 476 public long targetmemexpfactor; // Target Memory Expansion Factor scaled by 100 477 public long targetmemexpsize; // Expanded Memory Size in MB 478 } 479 480 @FieldOrder({ "name", "description", "type", "mtu", "ipackets", "ibytes", "ierrors", "opackets", "obytes", 481 "oerrors", "collisions", "bitrate", "xmitdrops", "version", "if_iqdrops", "if_arpdrops" }) 482 class perfstat_netinterface_t extends Structure { 483 public byte[] name = new byte[IDENTIFIER_LENGTH]; // name of the interface 484 public byte[] description = new byte[IDENTIFIER_LENGTH]; // interface description 485 // (from ODM, similar to lscfg output) 486 public byte type; // ethernet, tokenring, etc. interpretation can be done using 487 // /usr/include/net/if_types.h 488 public long mtu; // network frame size 489 public long ipackets; // number of packets received on interface 490 public long ibytes; // number of bytes received on interface 491 public long ierrors; // number of input errors on interface 492 public long opackets; // number of packets sent on interface 493 public long obytes; // number of bytes sent on interface 494 public long oerrors; // number of output errors on interface 495 public long collisions; // number of collisions on csma interface 496 public long bitrate; // adapter rating in bit per second 497 public long xmitdrops; // number of packets not transmitted 498 public long version; // version number (1, 2, etc.,) 499 public long if_iqdrops; // Dropped on input, this interface 500 public long if_arpdrops; // Dropped because no arp response 501 } 502 503 @FieldOrder({ "name", "u", "version" }) 504 class perfstat_protocol_t extends Structure { 505 // One of: ip, ipv6, icmp, icmpv6, udp, tcp, rpc, nfs, nfsv2, nfsv3, nfsv4 506 public byte[] name = new byte[IDENTIFIER_LENGTH]; 507 // Relevant union field based on name field 508 public AnonymousUnionPayload u; 509 public long version; // version number (1, 2, etc.,) 510 511 @Override read()512 public void read() { 513 super.read(); 514 String type = Native.toString(this.name); 515 if (!type.isEmpty()) { 516 u.setType(type); 517 } 518 u.read(); 519 } 520 521 public static class AnonymousUnionPayload extends Union { 522 public AnonymousStructIP ip; 523 public AnonymousStructIPv6 ipv6; 524 public AnonymousStructICMP icmp; 525 public AnonymousStructICMPv6 icmpv6; 526 public AnonymousStructUDP udp; 527 public AnonymousStructTCP tcp; 528 public AnonymousStructRPC rpc; 529 public AnonymousStructNFS nfs; 530 public AnonymousStructNFSv2 nfsv2; 531 public AnonymousStructNFSv3 nfsv3; 532 public AnonymousStructNFSv4 nfsv4; 533 } 534 535 @FieldOrder({ "ipackets", "ierrors", "iqueueoverflow", "opackets", "oerrors" }) 536 public static class AnonymousStructIP extends Structure { 537 public long ipackets; // number of input packets 538 public long ierrors; // number of input errors 539 public long iqueueoverflow; // number of input queue overflows 540 public long opackets; // number of output packets 541 public long oerrors; // number of output errors 542 } 543 544 @FieldOrder({ "ipackets", "ierrors", "iqueueoverflow", "opackets", "oerrors" }) 545 public static class AnonymousStructIPv6 extends Structure { 546 public long ipackets; // number of input packets 547 public long ierrors; // number of input errors 548 public long iqueueoverflow; // number of input queue overflows 549 public long opackets; // number of output packets 550 public long oerrors; // number of output errors 551 } 552 553 @FieldOrder({ "received", "sent", "errors" }) 554 public static class AnonymousStructICMP extends Structure { 555 public long received; // number of packets received 556 public long sent; // number of packets sent 557 public long errors; // number of errors 558 } 559 560 @FieldOrder({ "received", "sent", "errors" }) 561 public static class AnonymousStructICMPv6 extends Structure { 562 public long received; // number of packets received 563 public long sent; // number of packets sent 564 public long errors; // number of errors 565 } 566 567 @FieldOrder({ "ipackets", "ierrors", "opackets", "no_socket" }) 568 public static class AnonymousStructUDP extends Structure { 569 public long ipackets; // number of input packets 570 public long ierrors; // number of input errors 571 public long opackets; // number of output packets 572 public long no_socket; // number of packets dropped due to no socket 573 } 574 575 @FieldOrder({ "ipackets", "ierrors", "opackets", "initiated", "accepted", "established", "dropped" }) 576 public static class AnonymousStructTCP extends Structure { 577 public long ipackets; // number of input packets 578 public long ierrors; // number of input errors 579 public long opackets; // number of output packets 580 public long initiated; // number of connections initiated 581 public long accepted; // number of connections accepted 582 public long established; // number of connections established 583 public long dropped; // number of connections dropped 584 } 585 586 @FieldOrder({ "client", "server" }) 587 public static class AnonymousStructRPC extends Structure { 588 public AnonymousStructRPCclient client; 589 public AnonymousStructRPCserver server; 590 } 591 592 @FieldOrder({ "stream", "dgram" }) 593 public static class AnonymousStructRPCclient extends Structure { 594 public AnonymousStructRPCclientstream stream; 595 public AnonymousStructRPCclientdgram dgram; 596 } 597 598 @FieldOrder({ "calls", "badcalls", "badxids", "timeouts", "newcreds", "badverfs", "timers", "nomem", "cantconn", 599 "interrupts" }) 600 public static class AnonymousStructRPCclientstream extends Structure { 601 public long calls; // total NFS client RPC connection-oriented calls 602 public long badcalls; // rejected NFS client RPC calls 603 public long badxids; // bad NFS client RPC call responses 604 public long timeouts; // timed out NFS client RPC calls with no reply 605 public long newcreds; // total NFS client RPC authentication refreshes 606 public long badverfs; // total NFS client RPC bad verifier in response 607 public long timers; // NFS client RPC timeout greater than timeout value 608 public long nomem; // NFS client RPC calls memory allocation failure 609 public long cantconn; // failed NFS client RPC calls 610 public long interrupts; // NFS client RPC calls fail due to interrupt 611 } 612 613 @FieldOrder({ "calls", "badcalls", "retrans", "badxids", "timeouts", "newcreds", "badverfs", "timers", "nomem", 614 "cantsend" }) 615 public static class AnonymousStructRPCclientdgram extends Structure { 616 public long calls; // total NFS client RPC connectionless calls 617 public long badcalls; // rejected NFS client RPC calls 618 public long retrans; // retransmitted NFS client RPC calls 619 public long badxids; // bad NFS client RPC call responses 620 public long timeouts; // timed out NFS client RPC calls with no reply 621 public long newcreds; // total NFS client RPC authentication refreshes 622 public long badverfs; // total NFS client RPC bad verifier in response 623 public long timers; // NFS client RPC timeout greater than timeout value 624 public long nomem; // NFS client RPC calls memory allocation failure 625 public long cantsend; // NFS client RPC calls not sent 626 } 627 628 @FieldOrder({ "stream", "dgram" }) 629 public static class AnonymousStructRPCserver extends Structure { 630 public AnonymousStructRPCserverstream stream; 631 public AnonymousStructRPCserverdgram dgram; 632 } 633 634 @FieldOrder({ "calls", "badcalls", "nullrecv", "badlen", "xdrcall", "dupchecks", "dupreqs" }) 635 public static class AnonymousStructRPCserverstream extends Structure { 636 public long calls; // total NFS server RPC connection-oriented requests 637 public long badcalls; // rejected NFS server RPC requests 638 public long nullrecv; // NFS server RPC calls failed due to unavailable packet 639 public long badlen; // NFS server RPC requests failed due to bad length 640 public long xdrcall; // NFS server RPC requests failed due to bad header 641 public long dupchecks; // NFS server RPC calls found in request cache 642 public long dupreqs; // total NFS server RPC call duplicates 643 } 644 645 @FieldOrder({ "calls", "badcalls", "nullrecv", "badlen", "xdrcall", "dupchecks", "dupreqs" }) 646 public static class AnonymousStructRPCserverdgram extends Structure { 647 public long calls; // total NFS server RPC connectionless requests 648 public long badcalls; // rejected NFS server RPC requests 649 public long nullrecv; // NFS server RPC calls failed due to unavailable packet 650 public long badlen; // NFS server RPC requests failed due to bad length 651 public long xdrcall; // NFS server RPC requests failed due to bad header 652 public long dupchecks; // NFS server RPC calls found in request cache 653 public long dupreqs; // total NFS server RPC call duplicates 654 } 655 656 @FieldOrder({ "client", "server" }) 657 public static class AnonymousStructNFS extends Structure { 658 public AnonymousStructNFSclient client; 659 public AnonymousStructNFSserver server; 660 } 661 662 @FieldOrder({ "calls", "badcalls", "clgets", "cltoomany" }) 663 public static class AnonymousStructNFSclient extends Structure { 664 public long calls; // total NFS client requests 665 public long badcalls; // total NFS client failed calls 666 public long clgets; // total number of client nfs clgets 667 public long cltoomany; // total number of client nfs cltoomany 668 } 669 670 @FieldOrder({ "calls", "badcalls", "public_v2", "public_v3" }) 671 public static class AnonymousStructNFSserver extends Structure { 672 public long calls; // total NFS server requests 673 public long badcalls; // total NFS server failed calls 674 public long public_v2; // total number of nfs version 2 server calls 675 public long public_v3; // total number of nfs version 3 server calls 676 } 677 678 @FieldOrder({ "client", "server" }) 679 public static class AnonymousStructNFSv2 extends Structure { 680 public AnonymousStructNFSv2client client; 681 public AnonymousStructNFSv2server server; 682 } 683 684 @FieldOrder({ "calls", "nullreq", "getattr", "setattr", "root", "lookup", "readlink", "read", "writecache", 685 "write", "create", "remove", "rename", "link", "symlink", "mkdir", "rmdir", "readdir", "statfs" }) 686 public static class AnonymousStructNFSv2client extends Structure { 687 public long calls; // NFS V2 client requests 688 public long nullreq; // NFS V2 client null requests 689 public long getattr; // NFS V2 client getattr requests 690 public long setattr; // NFS V2 client setattr requests 691 public long root; // NFS V2 client root requests 692 public long lookup; // NFS V2 client file name lookup requests 693 public long readlink; // NFS V2 client readlink requests 694 public long read; // NFS V2 client read requests 695 public long writecache; // NFS V2 client write cache requests 696 public long write; // NFS V2 client write requests 697 public long create; // NFS V2 client file creation requests 698 public long remove; // NFS V2 client file removal requests 699 public long rename; // NFS V2 client file rename requests 700 public long link; // NFS V2 client link creation requests 701 public long symlink; // NFS V2 client symbolic link creation requests 702 public long mkdir; // NFS V2 client directory creation requests 703 public long rmdir; // NFS V2 client directory removal requests 704 public long readdir; // NFS V2 client read-directory requests 705 public long statfs; // NFS V2 client file stat requests 706 } 707 708 @FieldOrder({ "calls", "nullreq", "getattr", "setattr", "root", "lookup", "readlink", "read", "writecache", 709 "write", "create", "remove", "rename", "link", "symlink", "mkdir", "rmdir", "readdir", "statfs" }) 710 public static class AnonymousStructNFSv2server extends Structure { 711 public long calls; // NFS V2 server requests 712 public long nullreq; // NFS V2 server null requests 713 public long getattr; // NFS V2 server getattr requests 714 public long setattr; // NFS V2 server setattr requests 715 public long root; // NFS V2 server root requests 716 public long lookup; // NFS V2 server file name lookup requests 717 public long readlink; // NFS V2 server readlink requests 718 public long read; // NFS V2 server read requests 719 public long writecache; // NFS V2 server cache requests 720 public long write; // NFS V2 server write requests 721 public long create; // NFS V2 server file creation requests 722 public long remove; // NFS V2 server file removal requests 723 public long rename; // NFS V2 server file rename requests 724 public long link; // NFS V2 server link creation requests 725 public long symlink; // NFS V2 server symbolic link creation requests 726 public long mkdir; // NFS V2 server directory creation requests 727 public long rmdir; // NFS V2 server directory removal requests 728 public long readdir; // NFS V2 server read-directory requests 729 public long statfs; // NFS V2 server file stat requests 730 } 731 732 @FieldOrder({ "client", "server" }) 733 public static class AnonymousStructNFSv3 extends Structure { 734 public AnonymousStructNFSv3client client; 735 public AnonymousStructNFSv3server server; 736 } 737 738 @FieldOrder({ "calls", "nullreq", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", 739 "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "readdirplus", 740 "fsstat", "fsinfo", "pathconf", "commit" }) 741 public static class AnonymousStructNFSv3client extends Structure { 742 public long calls; // NFS V3 client calls 743 public long nullreq; // NFS V3 client null requests 744 public long getattr; // NFS V3 client getattr requests 745 public long setattr; // NFS V3 client setattr requests 746 public long lookup; // NFS V3 client file name lookup requests 747 public long access; // NFS V3 client access requests 748 public long readlink; // NFS V3 client readlink requests 749 public long read; // NFS V3 client read requests 750 public long write; // NFS V3 client write requests 751 public long create; // NFS V3 client file creation requests 752 public long mkdir; // NFS V3 client directory creation requests 753 public long symlink; // NFS V3 client symbolic link creation requests 754 public long mknod; // NFS V3 client mknod creation requests 755 public long remove; // NFS V3 client file removal requests 756 public long rmdir; // NFS V3 client directory removal requests 757 public long rename; // NFS V3 client file rename requests 758 public long link; // NFS V3 client link creation requests 759 public long readdir; // NFS V3 client read-directory requests 760 public long readdirplus; // NFS V3 client read-directory plus requests 761 public long fsstat; // NFS V3 client file stat requests 762 public long fsinfo; // NFS V3 client file info requests 763 public long pathconf; // NFS V3 client path configure requests 764 public long commit; // NFS V3 client commit requests 765 } 766 767 @FieldOrder({ "calls", "nullreq", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", 768 "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "readdirplus", 769 "fsstat", "fsinfo", "pathconf", "commit" }) 770 public static class AnonymousStructNFSv3server extends Structure { 771 public long calls; // NFS V3 server requests 772 public long nullreq; // NFS V3 server null requests 773 public long getattr; // NFS V3 server getattr requests 774 public long setattr; // NFS V3 server setattr requests 775 public long lookup; // NFS V3 server file name lookup requests 776 public long access; // NFS V3 server file access requests 777 public long readlink; // NFS V3 server readlink requests 778 public long read; // NFS V3 server read requests 779 public long write; // NFS V3 server write requests 780 public long create; // NFS V3 server file creation requests 781 public long mkdir; // NFS V3 server director6 creation requests 782 public long symlink; // NFS V3 server symbolic link creation requests 783 public long mknod; // NFS V3 server mknode creation requests 784 public long remove; // NFS V3 server file removal requests 785 public long rmdir; // NFS V3 server directory removal requests 786 public long rename; // NFS V3 server file rename requests 787 public long link; // NFS V3 server link creation requests 788 public long readdir; // NFS V3 server read-directory requests 789 public long readdirplus; // NFS V3 server read-directory plus requests 790 public long fsstat; // NFS V3 server file stat requests 791 public long fsinfo; // NFS V3 server file info requests 792 public long pathconf; // NFS V3 server path configure requests 793 public long commit; // NFS V3 server commit requests 794 } 795 796 @FieldOrder({ "client", "server" }) 797 public static class AnonymousStructNFSv4 extends Structure { 798 public AnonymousStructNFSv4client client; 799 public AnonymousStructNFSv4server server; 800 } 801 802 @FieldOrder({ "operations", "nullreq", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", 803 "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "statfs", 804 "finfo", "commit", "open", "open_confirm", "open_downgrade", "close", "lock", "unlock", "lock_test", 805 "set_clientid", "renew", "client_confirm", "secinfo", "release_lock", "replicate", "pcl_stat", 806 "acl_stat_l", "pcl_stat_l", "acl_read", "pcl_read", "acl_write", "pcl_write", "delegreturn" }) 807 public static class AnonymousStructNFSv4client extends Structure { 808 public long operations; // NFS V4 client operations 809 public long nullreq; // NFS V4 client null operations 810 public long getattr; // NFS V4 client getattr operations 811 public long setattr; // NFS V4 client setattr operations 812 public long lookup; // NFS V4 client lookup operations 813 public long access; // NFS V4 client access operations 814 public long readlink; // NFS V4 client read link operations 815 public long read; // NFS V4 client read operations 816 public long write; // NFS V4 client write operations 817 public long create; // NFS V4 client create operations 818 public long mkdir; // NFS V4 client mkdir operations 819 public long symlink; // NFS V4 client symlink operations 820 public long mknod; // NFS V4 client mknod operations 821 public long remove; // NFS V4 client remove operations 822 public long rmdir; // NFS V4 client rmdir operations 823 public long rename; // NFS V4 client rename operations 824 public long link; // NFS V4 client link operations 825 public long readdir; // NFS V4 client readdir operations 826 public long statfs; // NFS V4 client statfs operations 827 public long finfo; // NFS V4 client file info operations 828 public long commit; // NFS V4 client commit operations 829 public long open; // NFS V4 client open operations 830 public long open_confirm; // NFS V4 client open confirm operations 831 public long open_downgrade; // NFS V4 client open downgrade operations 832 public long close; // NFS V4 client close operations 833 public long lock; // NFS V4 client lock operations 834 public long unlock; // NFS V4 client unlock operations 835 public long lock_test; // NFS V4 client lock test operations 836 public long set_clientid; // NFS V4 client set client id operations 837 public long renew; // NFS V4 client renew operations 838 public long client_confirm; // NFS V4 client confirm operations 839 public long secinfo; // NFS V4 client secinfo operations 840 public long release_lock; // NFS V4 client release lock operations 841 public long replicate; // NFS V4 client replicate operations 842 public long pcl_stat; // NFS V4 client pcl_stat operations 843 public long acl_stat_l; // NFS V4 client acl_stat long operations 844 public long pcl_stat_l; // NFS V4 client pcl_stat long operations 845 public long acl_read; // NFS V4 client acl_read operations 846 public long pcl_read; // NFS V4 client pcl_read operations 847 public long acl_write; // NFS V4 client acl_write operations 848 public long pcl_write; // NFS V4 client pcl_write operations 849 public long delegreturn; // NFS V4 client delegreturn operations 850 } 851 852 @FieldOrder({ "nullreq", "compound", "operations", "access", "close", "commit", "create", "delegpurge", 853 "delegreturn", "getattr", "getfh", "link", "lock", "lockt", "locku", "lookup", "lookupp", "nverify", 854 "open", "openattr", "open_confirm", "open_downgrade", "putfh", "putpubfh", "putrootfh", "read", 855 "readdir", "readlink", "remove", "rename", "renew", "restorefh", "savefh", "secinfo", 856 "setattr", 857 "set_clientid", "clientid_confirm", "verify", "write", "release_lock" }) 858 public static class AnonymousStructNFSv4server extends Structure { 859 public long nullreq; // NFS V4 server null calls 860 public long compound; // NFS V4 server compound calls 861 public long operations; // NFS V4 server operations 862 public long access; // NFS V4 server access operations 863 public long close; // NFS V4 server close operations 864 public long commit; // NFS V4 server commit operations 865 public long create; // NFS V4 server create operations 866 public long delegpurge; // NFS V4 server del_purge operations 867 public long delegreturn; // NFS V4 server del_ret operations 868 public long getattr; // NFS V4 server getattr operations 869 public long getfh; // NFS V4 server getfh operations 870 public long link; // NFS V4 server link operations 871 public long lock; // NFS V4 server lock operations 872 public long lockt; // NFS V4 server lockt operations 873 public long locku; // NFS V4 server locku operations 874 public long lookup; // NFS V4 server lookup operations 875 public long lookupp; // NFS V4 server lookupp operations 876 public long nverify; // NFS V4 server nverify operations 877 public long open; // NFS V4 server open operations 878 public long openattr; // NFS V4 server openattr operations 879 public long open_confirm; // NFS V4 server confirm operations 880 public long open_downgrade; // NFS V4 server downgrade operations 881 public long putfh; // NFS V4 server putfh operations 882 public long putpubfh; // NFS V4 server putpubfh operations 883 public long putrootfh; // NFS V4 server putrotfh operations 884 public long read; // NFS V4 server read operations 885 public long readdir; // NFS V4 server readdir operations 886 public long readlink; // NFS V4 server readlink operations 887 public long remove; // NFS V4 server remove operations 888 public long rename; // NFS V4 server rename operations 889 public long renew; // NFS V4 server renew operations 890 public long restorefh; // NFS V4 server restorefh operations 891 public long savefh; // NFS V4 server savefh operations 892 public long secinfo; // NFS V4 server secinfo operations 893 public long setattr; // NFS V4 server setattr operations 894 public long set_clientid; // NFS V4 server setclid operations 895 public long clientid_confirm; // NFS V4 server clid_cfm operations 896 public long verify; // NFS V4 server verify operations 897 public long write; // NFS V4 server write operations 898 public long release_lock; // NFS V4 server release_lo operations 899 } 900 } 901 902 /** 903 * Retrieves total processor usage metrics 904 * 905 * @param name 906 * Reserved for future use, must be NULL 907 * @param cpu 908 * Populated with structure 909 * @param sizeof_struct 910 * Should be set to sizeof(perfstat_cpu_total_t) 911 * @param desired_number 912 * Reserved for future use, must be set to 0 or 1 913 * @return The return value is -1 in case of errors. Otherwise, the number of 914 * structures copied is returned. This is always 1. 915 */ perfstat_cpu_total(perfstat_id_t name, perfstat_cpu_total_t cpu, int sizeof_struct, int desired_number)916 int perfstat_cpu_total(perfstat_id_t name, perfstat_cpu_total_t cpu, int sizeof_struct, int desired_number); 917 918 /** 919 * Retrieves individual processor usage metrics 920 * 921 * @param name 922 * Structure containing empty string when collecting all cpu stats, 923 * or null to count CPUs 924 * @param cpu 925 * Populated with structures, or null to count CPUs 926 * @param sizeof_struct 927 * Should be set to sizeof(perfstat_cpu_t) 928 * @param desired_number 929 * Set to 0 to count CPUs, set to number of cpus to return otherwise 930 * @return The return value is -1 in case of errors. Otherwise, the number of 931 * structures copied is returned. 932 */ perfstat_cpu(perfstat_id_t name, perfstat_cpu_t[] cpu, int sizeof_struct, int desired_number)933 int perfstat_cpu(perfstat_id_t name, perfstat_cpu_t[] cpu, int sizeof_struct, int desired_number); 934 935 /** 936 * Retrieves total memory-related metrics 937 * 938 * @param name 939 * Reserved for future use, must be NULL 940 * @param mem 941 * Populated with structure 942 * @param sizeof_struct 943 * Should be set to sizeof(perfstat_memory_total_t) 944 * @param desired_number 945 * Reserved for future use, must be set to 0 or 1 946 * @return The return value is -1 in case of errors. Otherwise, the number of 947 * structures copied is returned. This is always 1. 948 */ perfstat_memory_total(perfstat_id_t name, perfstat_memory_total_t mem, int sizeof_struct, int desired_number)949 int perfstat_memory_total(perfstat_id_t name, perfstat_memory_total_t mem, int sizeof_struct, int desired_number); 950 951 /** 952 * Retrieves process-related metrics 953 * 954 * @param name 955 * Structure containing empty string when collecting all process 956 * stats, or null to count processes 957 * @param procs 958 * Populated with structure 959 * @param sizeof_struct 960 * Should be set to sizeof(perfstat_process_t) 961 * @param desired_number 962 * Set to 0 to count processes, set to number of processes to return 963 * otherwise 964 * @return The return value is -1 in case of errors. Otherwise, the number of 965 * structures copied is returned. 966 */ perfstat_process(perfstat_id_t name, perfstat_process_t[] procs, int sizeof_struct, int desired_number)967 int perfstat_process(perfstat_id_t name, perfstat_process_t[] procs, int sizeof_struct, int desired_number); 968 969 /** 970 * Retrieves disk statistics 971 * 972 * @param name 973 * Structure containing empty string when collecting all disk stats, 974 * or null to count block disks 975 * @param disks 976 * Populated with structures, or null to count disks 977 * @param sizeof_struct 978 * Should be set to sizeof(perfstat_disk_t) 979 * @param desired_number 980 * Set to 0 to count disks, set to number of disks to return 981 * otherwise 982 * @return The return value is -1 in case of errors. Otherwise, the number of 983 * structures copied is returned. 984 */ perfstat_disk(perfstat_id_t name, perfstat_disk_t[] disks, int sizeof_struct, int desired_number)985 int perfstat_disk(perfstat_id_t name, perfstat_disk_t[] disks, int sizeof_struct, int desired_number); 986 987 /** 988 * Retrieves total memory-related metrics 989 * 990 * @param name 991 * Reserved for future use, must be NULL 992 * @param config 993 * Populated with structure 994 * @param sizeof_struct 995 * Should be set to sizeof(perfstat_partition_config_t) 996 * @param desired_number 997 * Reserved for future use, must be set to 0 or 1 998 * @return The return value is -1 in case of errors. Otherwise, the number of 999 * structures copied is returned. This is always 1. 1000 */ perfstat_partition_config(perfstat_id_t name, perfstat_partition_config_t config, int sizeof_struct, int desired_number)1001 int perfstat_partition_config(perfstat_id_t name, perfstat_partition_config_t config, int sizeof_struct, 1002 int desired_number); 1003 1004 /** 1005 * Retrieves network interfaces 1006 * 1007 * @param name 1008 * Structure containing empty string when collecting all interface 1009 * stats, or null to count interfaces 1010 * @param netints 1011 * Populated with structures, or null to count interfaces 1012 * @param sizeof_struct 1013 * Should be set to sizeof(perfstat_netinterface_t) 1014 * @param desired_number 1015 * Set to 0 to count network interfaces, set to number of interfaces 1016 * to return otherwise 1017 * @return The return value is -1 in case of errors. Otherwise, the number of 1018 * structures copied is returned. 1019 */ perfstat_netinterface(perfstat_id_t name, perfstat_netinterface_t[] netints, int sizeof_struct, int desired_number)1020 int perfstat_netinterface(perfstat_id_t name, perfstat_netinterface_t[] netints, int sizeof_struct, 1021 int desired_number); 1022 1023 /** 1024 * Retrieves protocol data 1025 * 1026 * @param name 1027 * Structure containing empty string when collecting all protocol 1028 * stats, or null to count stats 1029 * @param protocols 1030 * Populated with structures, or null to count protocols 1031 * @param sizeof_struct 1032 * Should be set to sizeof(perfstat_protocol_t) 1033 * @param desired_number 1034 * Set to 0 to count protocols, set to number of protocols to return 1035 * otherwise 1036 * @return The return value is -1 in case of errors. Otherwise, the number of 1037 * structures copied is returned. 1038 */ perfstat_protocol(perfstat_id_t name, perfstat_protocol_t[] protocols, int sizeof_struct, int desired_number)1039 int perfstat_protocol(perfstat_id_t name, perfstat_protocol_t[] protocols, int sizeof_struct, int desired_number); 1040 } 1041