2 * mpstat: per-processor statistics
3 * (C) 2000-2021 by Sebastien Godard (sysstat <at> orange.fr)
13 ***************************************************************************
14 * mpstat's specific system files.
15 ***************************************************************************
18 #define SOFTIRQS PRE "/proc/softirqs"
19 #define PHYS_PACK_ID "topology/physical_package_id"
20 #define THREAD_SBL_LST "topology/thread_siblings_list"
23 ***************************************************************************
24 * Activities definitions.
25 ***************************************************************************
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
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)
41 ***************************************************************************
42 * Keywords and constants.
43 ***************************************************************************
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
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
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)
67 #define NR_IRQCPU_PREALLOC 3
69 #define MAX_IRQ_LEN 16
72 ***************************************************************************
73 * Structures used to store statistics.
74 ***************************************************************************
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
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
90 unsigned int interrupt;
91 char irq_name[MAX_IRQ_LEN];
94 #define STATS_IRQCPU_SIZE (sizeof(struct stats_irqcpu))
96 struct stats_global_irq {
97 unsigned long long irq_nr;
100 #define STATS_GLOBAL_IRQ_SIZE (sizeof(struct stats_global_irq))
102 struct cpu_topology {