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