~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/cpumap.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/util/cpumap.h (Version linux-6.12-rc7) and /tools/perf/util/cpumap.h (Version linux-6.5.13)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __PERF_CPUMAP_H                             2 #ifndef __PERF_CPUMAP_H
  3 #define __PERF_CPUMAP_H                             3 #define __PERF_CPUMAP_H
  4                                                     4 
  5 #include <stdbool.h>                                5 #include <stdbool.h>
  6 #include <stdio.h>                                  6 #include <stdio.h>
  7 #include <perf/cpumap.h>                            7 #include <perf/cpumap.h>
                                                   >>   8 #include <linux/refcount.h>
  8                                                     9 
  9 /** Identify where counts are aggregated, -1 i     10 /** Identify where counts are aggregated, -1 implies not to aggregate. */
 10 struct aggr_cpu_id {                               11 struct aggr_cpu_id {
 11         /** A value in the range 0 to number o     12         /** A value in the range 0 to number of threads. */
 12         int thread_idx;                            13         int thread_idx;
 13         /** The numa node X as read from /sys/     14         /** The numa node X as read from /sys/devices/system/node/nodeX. */
 14         int node;                                  15         int node;
 15         /**                                        16         /**
 16          * The socket number as read from          17          * The socket number as read from
 17          * /sys/devices/system/cpu/cpuX/topolo     18          * /sys/devices/system/cpu/cpuX/topology/physical_package_id.
 18          */                                        19          */
 19         int socket;                                20         int socket;
 20         /** The die id as read from /sys/devic     21         /** The die id as read from /sys/devices/system/cpu/cpuX/topology/die_id. */
 21         int die;                                   22         int die;
 22         /** The cluster id as read from /sys/d << 
 23         int cluster;                           << 
 24         /** The cache level as read from /sys/     23         /** The cache level as read from /sys/devices/system/cpu/cpuX/cache/indexY/level */
 25         int cache_lvl;                             24         int cache_lvl;
 26         /**                                        25         /**
 27          * The cache instance ID, which is the     26          * The cache instance ID, which is the first CPU in the
 28          * /sys/devices/system/cpu/cpuX/cache/     27          * /sys/devices/system/cpu/cpuX/cache/indexY/shared_cpu_list
 29          */                                        28          */
 30         int cache;                                 29         int cache;
 31         /** The core id as read from /sys/devi     30         /** The core id as read from /sys/devices/system/cpu/cpuX/topology/core_id. */
 32         int core;                                  31         int core;
 33         /** CPU aggregation, note there is one     32         /** CPU aggregation, note there is one CPU for each SMT thread. */
 34         struct perf_cpu cpu;                       33         struct perf_cpu cpu;
 35 };                                                 34 };
 36                                                    35 
 37 /** A collection of aggr_cpu_id values, the "b     36 /** A collection of aggr_cpu_id values, the "built" version is sorted and uniqued. */
 38 struct cpu_aggr_map {                              37 struct cpu_aggr_map {
                                                   >>  38         refcount_t refcnt;
 39         /** Number of valid entries. */            39         /** Number of valid entries. */
 40         int nr;                                    40         int nr;
 41         /** The entries. */                        41         /** The entries. */
 42         struct aggr_cpu_id map[];                  42         struct aggr_cpu_id map[];
 43 };                                                 43 };
 44                                                    44 
 45 #define cpu_aggr_map__for_each_idx(idx, aggr_m     45 #define cpu_aggr_map__for_each_idx(idx, aggr_map)                               \
 46         for ((idx) = 0; (idx) < aggr_map->nr;      46         for ((idx) = 0; (idx) < aggr_map->nr; (idx)++)
 47                                                    47 
 48 struct perf_record_cpu_map_data;                   48 struct perf_record_cpu_map_data;
 49                                                    49 
 50 bool perf_record_cpu_map_data__test_bit(int i,     50 bool perf_record_cpu_map_data__test_bit(int i, const struct perf_record_cpu_map_data *data);
 51                                                    51 
 52 struct perf_cpu_map *perf_cpu_map__empty_new(i     52 struct perf_cpu_map *perf_cpu_map__empty_new(int nr);
 53                                                    53 
 54 struct perf_cpu_map *cpu_map__new_data(const s     54 struct perf_cpu_map *cpu_map__new_data(const struct perf_record_cpu_map_data *data);
 55 size_t cpu_map__snprint(struct perf_cpu_map *m     55 size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size);
 56 size_t cpu_map__snprint_mask(struct perf_cpu_m     56 size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size);
 57 size_t cpu_map__fprintf(struct perf_cpu_map *m     57 size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp);
 58 struct perf_cpu_map *cpu_map__online(void); /*     58 struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */
 59                                                    59 
 60 int cpu__setup_cpunode_map(void);                  60 int cpu__setup_cpunode_map(void);
 61                                                    61 
 62 int cpu__max_node(void);                           62 int cpu__max_node(void);
 63 struct perf_cpu cpu__max_cpu(void);                63 struct perf_cpu cpu__max_cpu(void);
 64 struct perf_cpu cpu__max_present_cpu(void);        64 struct perf_cpu cpu__max_present_cpu(void);
 65                                                    65 
 66 /**                                                66 /**
 67  * cpu_map__is_dummy - Events associated with      67  * cpu_map__is_dummy - Events associated with a pid, rather than a CPU, use a single dummy map with an entry of -1.
 68  */                                                68  */
 69 static inline bool cpu_map__is_dummy(const str     69 static inline bool cpu_map__is_dummy(const struct perf_cpu_map *cpus)
 70 {                                                  70 {
 71         return perf_cpu_map__nr(cpus) == 1 &&      71         return perf_cpu_map__nr(cpus) == 1 && perf_cpu_map__cpu(cpus, 0).cpu == -1;
 72 }                                                  72 }
 73                                                    73 
 74 /**                                                74 /**
 75  * cpu__get_node - Returns the numa node X as      75  * cpu__get_node - Returns the numa node X as read from
 76  * /sys/devices/system/node/nodeX for the give     76  * /sys/devices/system/node/nodeX for the given CPU.
 77  */                                                77  */
 78 int cpu__get_node(struct perf_cpu cpu);            78 int cpu__get_node(struct perf_cpu cpu);
 79 /**                                                79 /**
 80  * cpu__get_socket_id - Returns the socket num     80  * cpu__get_socket_id - Returns the socket number as read from
 81  * /sys/devices/system/cpu/cpuX/topology/physi     81  * /sys/devices/system/cpu/cpuX/topology/physical_package_id for the given CPU.
 82  */                                                82  */
 83 int cpu__get_socket_id(struct perf_cpu cpu);       83 int cpu__get_socket_id(struct perf_cpu cpu);
 84 /**                                                84 /**
 85  * cpu__get_die_id - Returns the die id as rea     85  * cpu__get_die_id - Returns the die id as read from
 86  * /sys/devices/system/cpu/cpuX/topology/die_i     86  * /sys/devices/system/cpu/cpuX/topology/die_id for the given CPU.
 87  */                                                87  */
 88 int cpu__get_die_id(struct perf_cpu cpu);          88 int cpu__get_die_id(struct perf_cpu cpu);
 89 /**                                                89 /**
 90  * cpu__get_cluster_id - Returns the cluster i << 
 91  * /sys/devices/system/cpu/cpuX/topology/clust << 
 92  */                                            << 
 93 int cpu__get_cluster_id(struct perf_cpu cpu);  << 
 94 /**                                            << 
 95  * cpu__get_core_id - Returns the core id as r     90  * cpu__get_core_id - Returns the core id as read from
 96  * /sys/devices/system/cpu/cpuX/topology/core_     91  * /sys/devices/system/cpu/cpuX/topology/core_id for the given CPU.
 97  */                                                92  */
 98 int cpu__get_core_id(struct perf_cpu cpu);         93 int cpu__get_core_id(struct perf_cpu cpu);
 99                                                    94 
100 /**                                                95 /**
101  * cpu_aggr_map__empty_new - Create a cpu_aggr     96  * cpu_aggr_map__empty_new - Create a cpu_aggr_map of size nr with every entry
102  * being empty.                                    97  * being empty.
103  */                                                98  */
104 struct cpu_aggr_map *cpu_aggr_map__empty_new(i     99 struct cpu_aggr_map *cpu_aggr_map__empty_new(int nr);
105                                                   100 
106 typedef struct aggr_cpu_id (*aggr_cpu_id_get_t    101 typedef struct aggr_cpu_id (*aggr_cpu_id_get_t)(struct perf_cpu cpu, void *data);
107                                                   102 
108 /**                                               103 /**
109  * cpu_aggr_map__new - Create a cpu_aggr_map w    104  * cpu_aggr_map__new - Create a cpu_aggr_map with an aggr_cpu_id for each cpu in
110  * cpus. The aggr_cpu_id is created with 'get_    105  * cpus. The aggr_cpu_id is created with 'get_id' that may have a data value
111  * passed to it. The cpu_aggr_map is sorted wi    106  * passed to it. The cpu_aggr_map is sorted with duplicate values removed.
112  */                                               107  */
113 struct cpu_aggr_map *cpu_aggr_map__new(const s    108 struct cpu_aggr_map *cpu_aggr_map__new(const struct perf_cpu_map *cpus,
114                                        aggr_cp    109                                        aggr_cpu_id_get_t get_id,
115                                        void *d    110                                        void *data, bool needs_sort);
116                                                   111 
117 bool aggr_cpu_id__equal(const struct aggr_cpu_    112 bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b);
118 bool aggr_cpu_id__is_empty(const struct aggr_c    113 bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a);
119 struct aggr_cpu_id aggr_cpu_id__empty(void);      114 struct aggr_cpu_id aggr_cpu_id__empty(void);
120                                                   115 
121                                                   116 
122 /**                                               117 /**
123  * aggr_cpu_id__socket - Create an aggr_cpu_id    118  * aggr_cpu_id__socket - Create an aggr_cpu_id with the socket populated with
124  * the socket for cpu. The function signature     119  * the socket for cpu. The function signature is compatible with
125  * aggr_cpu_id_get_t.                             120  * aggr_cpu_id_get_t.
126  */                                               121  */
127 struct aggr_cpu_id aggr_cpu_id__socket(struct     122 struct aggr_cpu_id aggr_cpu_id__socket(struct perf_cpu cpu, void *data);
128 /**                                               123 /**
129  * aggr_cpu_id__die - Create an aggr_cpu_id wi    124  * aggr_cpu_id__die - Create an aggr_cpu_id with the die and socket populated
130  * with the die and socket for cpu. The functi    125  * with the die and socket for cpu. The function signature is compatible with
131  * aggr_cpu_id_get_t.                             126  * aggr_cpu_id_get_t.
132  */                                               127  */
133 struct aggr_cpu_id aggr_cpu_id__die(struct per    128 struct aggr_cpu_id aggr_cpu_id__die(struct perf_cpu cpu, void *data);
134 /**                                               129 /**
135  * aggr_cpu_id__cluster - Create an aggr_cpu_i !! 130  * aggr_cpu_id__core - Create an aggr_cpu_id with the core, die and socket
136  * populated with the cluster, die and socket  !! 131  * populated with the core, die and socket for cpu. The function signature is
137  * is compatible with aggr_cpu_id_get_t.       !! 132  * compatible with aggr_cpu_id_get_t.
138  */                                            << 
139 struct aggr_cpu_id aggr_cpu_id__cluster(struct << 
140 /**                                            << 
141  * aggr_cpu_id__core - Create an aggr_cpu_id w << 
142  * socket populated with the core, die and soc << 
143  * signature is compatible with aggr_cpu_id_ge << 
144  */                                               133  */
145 struct aggr_cpu_id aggr_cpu_id__core(struct pe    134 struct aggr_cpu_id aggr_cpu_id__core(struct perf_cpu cpu, void *data);
146 /**                                               135 /**
147  * aggr_cpu_id__core - Create an aggr_cpu_id w    136  * aggr_cpu_id__core - Create an aggr_cpu_id with the cpu, core, die and socket
148  * populated with the cpu, core, die and socke    137  * populated with the cpu, core, die and socket for cpu. The function signature
149  * is compatible with aggr_cpu_id_get_t.          138  * is compatible with aggr_cpu_id_get_t.
150  */                                               139  */
151 struct aggr_cpu_id aggr_cpu_id__cpu(struct per    140 struct aggr_cpu_id aggr_cpu_id__cpu(struct perf_cpu cpu, void *data);
152 /**                                               141 /**
153  * aggr_cpu_id__node - Create an aggr_cpu_id w    142  * aggr_cpu_id__node - Create an aggr_cpu_id with the numa node populated for
154  * cpu. The function signature is compatible w    143  * cpu. The function signature is compatible with aggr_cpu_id_get_t.
155  */                                               144  */
156 struct aggr_cpu_id aggr_cpu_id__node(struct pe    145 struct aggr_cpu_id aggr_cpu_id__node(struct perf_cpu cpu, void *data);
157 /**                                               146 /**
158  * aggr_cpu_id__global - Create an aggr_cpu_id    147  * aggr_cpu_id__global - Create an aggr_cpu_id for global aggregation.
159  * The function signature is compatible with a    148  * The function signature is compatible with aggr_cpu_id_get_t.
160  */                                               149  */
161 struct aggr_cpu_id aggr_cpu_id__global(struct     150 struct aggr_cpu_id aggr_cpu_id__global(struct perf_cpu cpu, void *data);
162 #endif /* __PERF_CPUMAP_H */                      151 #endif /* __PERF_CPUMAP_H */
163                                                   152 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php