]> granicus.if.org Git - sysstat/blob - mpstat.h
Merge branch 'scop-grep-E'
[sysstat] / mpstat.h
1 /*
2  * mpstat: per-processor statistics
3  * (C) 2000-2021 by Sebastien Godard (sysstat <at> orange.fr)
4  */
5
6 #ifndef _MPSTAT_H
7 #define _MPSTAT_H
8
9 #include "common.h"
10
11 /*
12  ***************************************************************************
13  * mpstat's specific system files.
14  ***************************************************************************
15  */
16
17 #define SOFTIRQS        PRE "/proc/softirqs"
18 #define PHYS_PACK_ID    "topology/physical_package_id"
19 #define THREAD_SBL_LST  "topology/thread_siblings_list"
20
21 /*
22  ***************************************************************************
23  * Activities definitions.
24  ***************************************************************************
25  */
26
27 #define M_D_CPU         0x0001
28 #define M_D_IRQ_SUM     0x0002
29 #define M_D_IRQ_CPU     0x0004
30 #define M_D_SOFTIRQS    0x0008
31 #define M_D_NODE        0x0010
32
33 #define DISPLAY_CPU(m)          (((m) & M_D_CPU) == M_D_CPU)
34 #define DISPLAY_IRQ_SUM(m)      (((m) & M_D_IRQ_SUM) == M_D_IRQ_SUM)
35 #define DISPLAY_IRQ_CPU(m)      (((m) & M_D_IRQ_CPU) == M_D_IRQ_CPU)
36 #define DISPLAY_SOFTIRQS(m)     (((m) & M_D_SOFTIRQS) == M_D_SOFTIRQS)
37 #define DISPLAY_NODE(m)         (((m) & M_D_NODE) == M_D_NODE)
38
39 /*
40  ***************************************************************************
41  * Keywords and constants.
42  ***************************************************************************
43  */
44
45 /* Indicate that option -P has been used */
46 #define F_OPTION_P      0x01
47 /* Indicate that option -A has been used */
48 #define F_OPTION_A      0x02
49 /* JSON output */
50 #define F_JSON_OUTPUT   0x04
51 /* Indicate that option -N has been used */
52 #define F_OPTION_N      0x08
53 /* Display topology */
54 #define F_TOPOLOGY      0x10
55
56 #define USE_OPTION_P(m)         (((m) & F_OPTION_P) == F_OPTION_P)
57 #define USE_OPTION_A(m)         (((m) & F_OPTION_A) == F_OPTION_A)
58 #define DISPLAY_JSON_OUTPUT(m)  (((m) & F_JSON_OUTPUT) == F_JSON_OUTPUT)
59 #define USE_OPTION_N(m)         (((m) & F_OPTION_N) == F_OPTION_N)
60 #define DISPLAY_TOPOLOGY(m)     (((m) & F_TOPOLOGY) == F_TOPOLOGY)
61
62 #define K_SUM   "SUM"
63 #define K_CPU   "CPU"
64 #define K_SCPU  "SCPU"
65
66 #define NR_IRQCPU_PREALLOC      3
67
68 #define MAX_IRQ_LEN             16
69
70 /*
71  ***************************************************************************
72  * Structures used to store statistics.
73  ***************************************************************************
74  */
75
76 /*
77  * stats_irqcpu->irq_name:  IRQ#-A
78  * stats_irqcpu->interrupt: number of IRQ#-A for proc 0
79  * stats_irqcpu->irq_name:  IRQ#-B
80  * stats_irqcpu->interrupt: number of IRQ#-B for proc 0
81  * ...
82  * stats_irqcpu->irq_name:  (undef'd)
83  * stats_irqcpu->interrupt: number of IRQ#-A for proc 1
84  * stats_irqcpu->irq_name:  (undef'd)
85  * stats_irqcpu->interrupt: number of IRQ#-B for proc 1
86  * ...
87  */
88 struct stats_irqcpu {
89         unsigned int interrupt        __attribute__ ((aligned (4)));
90         char         irq_name[MAX_IRQ_LEN];
91 };
92
93 struct cpu_topology {
94         int phys_package_id;
95         int logical_core_id;
96 };
97
98 #define STATS_IRQCPU_SIZE      (sizeof(struct stats_irqcpu))
99
100 #endif