Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull more perf updates from Ingo Molnar:
"A second (and last) round of late coming fixes and changes, almost all
of them in perf tooling:

User visible tooling changes:

- Add period data column and make it default in 'perf script' (Jiri
Olsa)

- Add a visual cue for toggle zeroing of samples in 'perf top'
(Taeung Song)

- Improve callchains when using libunwind (Namhyung Kim)

Tooling fixes and infrastructure changes:

- Fix for double free in 'perf stat' when using some specific invalid
command line combo (Yasser Shalabi)

- Fix off-by-one bugs in map->end handling (Stephane Eranian)

- Fix off-by-one bug in maps__find(), also related to map->end
handling (Namhyung Kim)

- Make struct symbol->end be the first addr after the symbol range,
to make it match the convention used for struct map->end. (Arnaldo
Carvalho de Melo)

- Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat
live' (Jiri Olsa)

- Fix python test build by moving callchain_param to an object linked
into the python binding (Jiri Olsa)

- Document sysfs events/ interfaces (Cody P Schafer)

- Fix typos in perf/Documentation (Masanari Iida)

- Add missing 'struct option' forward declaration (Arnaldo Carvalho
de Melo)

- Add option to copy events when queuing for sorting across cpu
buffers and enable it for 'perf kvm stat live', to avoid having
events left in the queue pointing to the ring buffer be rewritten
in high volume sessions. (Alexander Yarygin, improving work done
by David Ahern):

- Do not include a struct hists per perf_evsel, untangling the
histogram code from perf_evsel, to pave the way for exporting a
minimalistic tools/lib/api/perf/ library usable by tools/perf and
initially by the rasd daemon being developed by Borislav Petkov,
Robert Richter and Jean Pihet. (Arnaldo Carvalho de Melo)

- Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and
thread maps mean syswide monitoring, reducing the boilerplate for
tools that only want system wide mode. (Arnaldo Carvalho de Melo)

- Move exit stuff from perf_evsel__delete to perf_evsel__exit, delete
should be just a front end for exit + free (Arnaldo Carvalho de
Melo)

- Add support to new style format of kernel PMU event. (Kan Liang)

and other misc fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (45 commits)
perf script: Add period as a default output column
perf script: Add period data column
perf evsel: No need to drag util/cgroup.h
perf evlist: Add missing 'struct option' forward declaration
perf evsel: Move exit stuff from __delete to __exit
kprobes/x86: Remove stale ARCH_SUPPORTS_KPROBES_ON_FTRACE define
perf kvm stat live: Enable events copying
perf session: Add option to copy events when queueing
perf Documentation: Fix typos in perf/Documentation
perf trace: Use thread_{,_set}_priv helpers
perf kvm: Use thread_{,_set}_priv helpers
perf callchain: Create an address space per thread
perf report: Set callchain_param.record_mode for future use
perf evlist: Fix for double free in tools/perf stat
perf test: Add test case for pmu event new style format
perf tools: Add support to new style format of kernel PMU event
perf tools: Parse the pmu event prefix and suffix
Revert "perf tools: Default to cpu// for events v5"
perf Documentation: Remove Ruplicated docs for powerpc cpu specific events
perf Documentation: sysfs events/ interfaces
...

+886 -914
+51 -564
Documentation/ABI/testing/sysfs-bus-event_source-devices-events
··· 27 27 "basename". 28 28 29 29 30 - What: /sys/devices/cpu/events/PM_1PLUS_PPC_CMPL 31 - /sys/devices/cpu/events/PM_BRU_FIN 32 - /sys/devices/cpu/events/PM_BR_MPRED 33 - /sys/devices/cpu/events/PM_CMPLU_STALL 34 - /sys/devices/cpu/events/PM_CMPLU_STALL_BRU 35 - /sys/devices/cpu/events/PM_CMPLU_STALL_DCACHE_MISS 36 - /sys/devices/cpu/events/PM_CMPLU_STALL_DFU 37 - /sys/devices/cpu/events/PM_CMPLU_STALL_DIV 38 - /sys/devices/cpu/events/PM_CMPLU_STALL_ERAT_MISS 39 - /sys/devices/cpu/events/PM_CMPLU_STALL_FXU 40 - /sys/devices/cpu/events/PM_CMPLU_STALL_IFU 41 - /sys/devices/cpu/events/PM_CMPLU_STALL_LSU 42 - /sys/devices/cpu/events/PM_CMPLU_STALL_REJECT 43 - /sys/devices/cpu/events/PM_CMPLU_STALL_SCALAR 44 - /sys/devices/cpu/events/PM_CMPLU_STALL_SCALAR_LONG 45 - /sys/devices/cpu/events/PM_CMPLU_STALL_STORE 46 - /sys/devices/cpu/events/PM_CMPLU_STALL_THRD 47 - /sys/devices/cpu/events/PM_CMPLU_STALL_VECTOR 48 - /sys/devices/cpu/events/PM_CMPLU_STALL_VECTOR_LONG 49 - /sys/devices/cpu/events/PM_CYC 50 - /sys/devices/cpu/events/PM_GCT_NOSLOT_BR_MPRED 51 - /sys/devices/cpu/events/PM_GCT_NOSLOT_BR_MPRED_IC_MISS 52 - /sys/devices/cpu/events/PM_GCT_NOSLOT_CYC 53 - /sys/devices/cpu/events/PM_GCT_NOSLOT_IC_MISS 54 - /sys/devices/cpu/events/PM_GRP_CMPL 55 - /sys/devices/cpu/events/PM_INST_CMPL 56 - /sys/devices/cpu/events/PM_LD_MISS_L1 57 - /sys/devices/cpu/events/PM_LD_REF_L1 58 - /sys/devices/cpu/events/PM_RUN_CYC 59 - /sys/devices/cpu/events/PM_RUN_INST_CMPL 60 - /sys/devices/cpu/events/PM_IC_DEMAND_L2_BR_ALL 61 - /sys/devices/cpu/events/PM_GCT_UTIL_7_TO_10_SLOTS 62 - /sys/devices/cpu/events/PM_PMC2_SAVED 63 - /sys/devices/cpu/events/PM_VSU0_16FLOP 64 - /sys/devices/cpu/events/PM_MRK_LSU_DERAT_MISS 65 - /sys/devices/cpu/events/PM_MRK_ST_CMPL 66 - /sys/devices/cpu/events/PM_NEST_PAIR3_ADD 67 - /sys/devices/cpu/events/PM_L2_ST_DISP 68 - /sys/devices/cpu/events/PM_L2_CASTOUT_MOD 69 - /sys/devices/cpu/events/PM_ISEG 70 - /sys/devices/cpu/events/PM_MRK_INST_TIMEO 71 - /sys/devices/cpu/events/PM_L2_RCST_DISP_FAIL_ADDR 72 - /sys/devices/cpu/events/PM_LSU1_DC_PREF_STREAM_CONFIRM 73 - /sys/devices/cpu/events/PM_IERAT_WR_64K 74 - /sys/devices/cpu/events/PM_MRK_DTLB_MISS_16M 75 - /sys/devices/cpu/events/PM_IERAT_MISS 76 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_LMEM 77 - /sys/devices/cpu/events/PM_FLOP 78 - /sys/devices/cpu/events/PM_THRD_PRIO_4_5_CYC 79 - /sys/devices/cpu/events/PM_BR_PRED_TA 80 - /sys/devices/cpu/events/PM_EXT_INT 81 - /sys/devices/cpu/events/PM_VSU_FSQRT_FDIV 82 - /sys/devices/cpu/events/PM_MRK_LD_MISS_EXPOSED_CYC 83 - /sys/devices/cpu/events/PM_LSU1_LDF 84 - /sys/devices/cpu/events/PM_IC_WRITE_ALL 85 - /sys/devices/cpu/events/PM_LSU0_SRQ_STFWD 86 - /sys/devices/cpu/events/PM_PTEG_FROM_RL2L3_MOD 87 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L31_SHR 88 - /sys/devices/cpu/events/PM_DATA_FROM_L21_MOD 89 - /sys/devices/cpu/events/PM_VSU1_SCAL_DOUBLE_ISSUED 90 - /sys/devices/cpu/events/PM_VSU0_8FLOP 91 - /sys/devices/cpu/events/PM_POWER_EVENT1 92 - /sys/devices/cpu/events/PM_DISP_CLB_HELD_BAL 93 - /sys/devices/cpu/events/PM_VSU1_2FLOP 94 - /sys/devices/cpu/events/PM_LWSYNC_HELD 95 - /sys/devices/cpu/events/PM_PTEG_FROM_DL2L3_SHR 96 - /sys/devices/cpu/events/PM_INST_FROM_L21_MOD 97 - /sys/devices/cpu/events/PM_IERAT_XLATE_WR_16MPLUS 98 - /sys/devices/cpu/events/PM_IC_REQ_ALL 99 - /sys/devices/cpu/events/PM_DSLB_MISS 100 - /sys/devices/cpu/events/PM_L3_MISS 101 - /sys/devices/cpu/events/PM_LSU0_L1_PREF 102 - /sys/devices/cpu/events/PM_VSU_SCALAR_SINGLE_ISSUED 103 - /sys/devices/cpu/events/PM_LSU1_DC_PREF_STREAM_CONFIRM_STRIDE 104 - /sys/devices/cpu/events/PM_L2_INST 105 - /sys/devices/cpu/events/PM_VSU0_FRSP 106 - /sys/devices/cpu/events/PM_FLUSH_DISP 107 - /sys/devices/cpu/events/PM_PTEG_FROM_L2MISS 108 - /sys/devices/cpu/events/PM_VSU1_DQ_ISSUED 109 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DMEM 110 - /sys/devices/cpu/events/PM_LSU_FLUSH_ULD 111 - /sys/devices/cpu/events/PM_PTEG_FROM_LMEM 112 - /sys/devices/cpu/events/PM_MRK_DERAT_MISS_16M 113 - /sys/devices/cpu/events/PM_THRD_ALL_RUN_CYC 114 - /sys/devices/cpu/events/PM_MEM0_PREFETCH_DISP 115 - /sys/devices/cpu/events/PM_MRK_STALL_CMPLU_CYC_COUNT 116 - /sys/devices/cpu/events/PM_DATA_FROM_DL2L3_MOD 117 - /sys/devices/cpu/events/PM_VSU_FRSP 118 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L21_MOD 119 - /sys/devices/cpu/events/PM_PMC1_OVERFLOW 120 - /sys/devices/cpu/events/PM_VSU0_SINGLE 121 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L3MISS 122 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L31_SHR 123 - /sys/devices/cpu/events/PM_VSU0_VECTOR_SP_ISSUED 124 - /sys/devices/cpu/events/PM_VSU1_FEST 125 - /sys/devices/cpu/events/PM_MRK_INST_DISP 126 - /sys/devices/cpu/events/PM_VSU0_COMPLEX_ISSUED 127 - /sys/devices/cpu/events/PM_LSU1_FLUSH_UST 128 - /sys/devices/cpu/events/PM_FXU_IDLE 129 - /sys/devices/cpu/events/PM_LSU0_FLUSH_ULD 130 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DL2L3_MOD 131 - /sys/devices/cpu/events/PM_LSU_LMQ_SRQ_EMPTY_ALL_CYC 132 - /sys/devices/cpu/events/PM_LSU1_REJECT_LMQ_FULL 133 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L21_MOD 134 - /sys/devices/cpu/events/PM_INST_FROM_RL2L3_MOD 135 - /sys/devices/cpu/events/PM_SHL_CREATED 136 - /sys/devices/cpu/events/PM_L2_ST_HIT 137 - /sys/devices/cpu/events/PM_DATA_FROM_DMEM 138 - /sys/devices/cpu/events/PM_L3_LD_MISS 139 - /sys/devices/cpu/events/PM_FXU1_BUSY_FXU0_IDLE 140 - /sys/devices/cpu/events/PM_DISP_CLB_HELD_RES 141 - /sys/devices/cpu/events/PM_L2_SN_SX_I_DONE 142 - /sys/devices/cpu/events/PM_STCX_CMPL 143 - /sys/devices/cpu/events/PM_VSU0_2FLOP 144 - /sys/devices/cpu/events/PM_L3_PREF_MISS 145 - /sys/devices/cpu/events/PM_LSU_SRQ_SYNC_CYC 146 - /sys/devices/cpu/events/PM_LSU_REJECT_ERAT_MISS 147 - /sys/devices/cpu/events/PM_L1_ICACHE_MISS 148 - /sys/devices/cpu/events/PM_LSU1_FLUSH_SRQ 149 - /sys/devices/cpu/events/PM_LD_REF_L1_LSU0 150 - /sys/devices/cpu/events/PM_VSU0_FEST 151 - /sys/devices/cpu/events/PM_VSU_VECTOR_SINGLE_ISSUED 152 - /sys/devices/cpu/events/PM_FREQ_UP 153 - /sys/devices/cpu/events/PM_DATA_FROM_LMEM 154 - /sys/devices/cpu/events/PM_LSU1_LDX 155 - /sys/devices/cpu/events/PM_PMC3_OVERFLOW 156 - /sys/devices/cpu/events/PM_MRK_BR_MPRED 157 - /sys/devices/cpu/events/PM_SHL_MATCH 158 - /sys/devices/cpu/events/PM_MRK_BR_TAKEN 159 - /sys/devices/cpu/events/PM_ISLB_MISS 160 - /sys/devices/cpu/events/PM_DISP_HELD_THERMAL 161 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_RL2L3_SHR 162 - /sys/devices/cpu/events/PM_LSU1_SRQ_STFWD 163 - /sys/devices/cpu/events/PM_PTEG_FROM_DMEM 164 - /sys/devices/cpu/events/PM_VSU_2FLOP 165 - /sys/devices/cpu/events/PM_GCT_FULL_CYC 166 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L3_CYC 167 - /sys/devices/cpu/events/PM_LSU_SRQ_S0_ALLOC 168 - /sys/devices/cpu/events/PM_MRK_DERAT_MISS_4K 169 - /sys/devices/cpu/events/PM_BR_MPRED_TA 170 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L2MISS 171 - /sys/devices/cpu/events/PM_DPU_HELD_POWER 172 - /sys/devices/cpu/events/PM_MRK_VSU_FIN 173 - /sys/devices/cpu/events/PM_LSU_SRQ_S0_VALID 174 - /sys/devices/cpu/events/PM_GCT_EMPTY_CYC 175 - /sys/devices/cpu/events/PM_IOPS_DISP 176 - /sys/devices/cpu/events/PM_RUN_SPURR 177 - /sys/devices/cpu/events/PM_PTEG_FROM_L21_MOD 178 - /sys/devices/cpu/events/PM_VSU0_1FLOP 179 - /sys/devices/cpu/events/PM_SNOOP_TLBIE 180 - /sys/devices/cpu/events/PM_DATA_FROM_L3MISS 181 - /sys/devices/cpu/events/PM_VSU_SINGLE 182 - /sys/devices/cpu/events/PM_DTLB_MISS_16G 183 - /sys/devices/cpu/events/PM_FLUSH 184 - /sys/devices/cpu/events/PM_L2_LD_HIT 185 - /sys/devices/cpu/events/PM_NEST_PAIR2_AND 186 - /sys/devices/cpu/events/PM_VSU1_1FLOP 187 - /sys/devices/cpu/events/PM_IC_PREF_REQ 188 - /sys/devices/cpu/events/PM_L3_LD_HIT 189 - /sys/devices/cpu/events/PM_DISP_HELD 190 - /sys/devices/cpu/events/PM_L2_LD 191 - /sys/devices/cpu/events/PM_LSU_FLUSH_SRQ 192 - /sys/devices/cpu/events/PM_BC_PLUS_8_CONV 193 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L31_MOD_CYC 194 - /sys/devices/cpu/events/PM_L2_RCST_BUSY_RC_FULL 195 - /sys/devices/cpu/events/PM_TB_BIT_TRANS 196 - /sys/devices/cpu/events/PM_THERMAL_MAX 197 - /sys/devices/cpu/events/PM_LSU1_FLUSH_ULD 198 - /sys/devices/cpu/events/PM_LSU1_REJECT_LHS 199 - /sys/devices/cpu/events/PM_LSU_LRQ_S0_ALLOC 200 - /sys/devices/cpu/events/PM_L3_CO_L31 201 - /sys/devices/cpu/events/PM_POWER_EVENT4 202 - /sys/devices/cpu/events/PM_DATA_FROM_L31_SHR 203 - /sys/devices/cpu/events/PM_BR_UNCOND 204 - /sys/devices/cpu/events/PM_LSU1_DC_PREF_STREAM_ALLOC 205 - /sys/devices/cpu/events/PM_PMC4_REWIND 206 - /sys/devices/cpu/events/PM_L2_RCLD_DISP 207 - /sys/devices/cpu/events/PM_THRD_PRIO_2_3_CYC 208 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L2MISS 209 - /sys/devices/cpu/events/PM_IC_DEMAND_L2_BHT_REDIRECT 210 - /sys/devices/cpu/events/PM_DATA_FROM_L31_SHR 211 - /sys/devices/cpu/events/PM_IC_PREF_CANCEL_L2 212 - /sys/devices/cpu/events/PM_MRK_FIN_STALL_CYC_COUNT 213 - /sys/devices/cpu/events/PM_BR_PRED_CCACHE 214 - /sys/devices/cpu/events/PM_GCT_UTIL_1_TO_2_SLOTS 215 - /sys/devices/cpu/events/PM_MRK_ST_CMPL_INT 216 - /sys/devices/cpu/events/PM_LSU_TWO_TABLEWALK_CYC 217 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L3MISS 218 - /sys/devices/cpu/events/PM_LSU_SET_MPRED 219 - /sys/devices/cpu/events/PM_FLUSH_DISP_TLBIE 220 - /sys/devices/cpu/events/PM_VSU1_FCONV 221 - /sys/devices/cpu/events/PM_DERAT_MISS_16G 222 - /sys/devices/cpu/events/PM_INST_FROM_LMEM 223 - /sys/devices/cpu/events/PM_IC_DEMAND_L2_BR_REDIRECT 224 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L2 225 - /sys/devices/cpu/events/PM_PTEG_FROM_L2 226 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L21_SHR_CYC 227 - /sys/devices/cpu/events/PM_MRK_DTLB_MISS_4K 228 - /sys/devices/cpu/events/PM_VSU0_FPSCR 229 - /sys/devices/cpu/events/PM_VSU1_VECT_DOUBLE_ISSUED 230 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_RL2L3_MOD 231 - /sys/devices/cpu/events/PM_MEM0_RQ_DISP 232 - /sys/devices/cpu/events/PM_L2_LD_MISS 233 - /sys/devices/cpu/events/PM_VMX_RESULT_SAT_1 234 - /sys/devices/cpu/events/PM_L1_PREF 235 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_LMEM_CYC 236 - /sys/devices/cpu/events/PM_GRP_IC_MISS_NONSPEC 237 - /sys/devices/cpu/events/PM_PB_NODE_PUMP 238 - /sys/devices/cpu/events/PM_SHL_MERGED 239 - /sys/devices/cpu/events/PM_NEST_PAIR1_ADD 240 - /sys/devices/cpu/events/PM_DATA_FROM_L3 241 - /sys/devices/cpu/events/PM_LSU_FLUSH 242 - /sys/devices/cpu/events/PM_LSU_SRQ_SYNC_COUNT 243 - /sys/devices/cpu/events/PM_PMC2_OVERFLOW 244 - /sys/devices/cpu/events/PM_LSU_LDF 245 - /sys/devices/cpu/events/PM_POWER_EVENT3 246 - /sys/devices/cpu/events/PM_DISP_WT 247 - /sys/devices/cpu/events/PM_IC_BANK_CONFLICT 248 - /sys/devices/cpu/events/PM_BR_MPRED_CR_TA 249 - /sys/devices/cpu/events/PM_L2_INST_MISS 250 - /sys/devices/cpu/events/PM_NEST_PAIR2_ADD 251 - /sys/devices/cpu/events/PM_MRK_LSU_FLUSH 252 - /sys/devices/cpu/events/PM_L2_LDST 253 - /sys/devices/cpu/events/PM_INST_FROM_L31_SHR 254 - /sys/devices/cpu/events/PM_VSU0_FIN 255 - /sys/devices/cpu/events/PM_VSU1_FCONV 256 - /sys/devices/cpu/events/PM_INST_FROM_RMEM 257 - /sys/devices/cpu/events/PM_DISP_CLB_HELD_TLBIE 258 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DMEM_CYC 259 - /sys/devices/cpu/events/PM_BR_PRED_CR 260 - /sys/devices/cpu/events/PM_LSU_REJECT 261 - /sys/devices/cpu/events/PM_GCT_UTIL_3_TO_6_SLOTS 262 - /sys/devices/cpu/events/PM_CMPLU_STALL_END_GCT_NOSLOT 263 - /sys/devices/cpu/events/PM_LSU0_REJECT_LMQ_FULL 264 - /sys/devices/cpu/events/PM_VSU_FEST 265 - /sys/devices/cpu/events/PM_NEST_PAIR0_AND 266 - /sys/devices/cpu/events/PM_PTEG_FROM_L3 267 - /sys/devices/cpu/events/PM_POWER_EVENT2 268 - /sys/devices/cpu/events/PM_IC_PREF_CANCEL_PAGE 269 - /sys/devices/cpu/events/PM_VSU0_FSQRT_FDIV 270 - /sys/devices/cpu/events/PM_MRK_GRP_CMPL 271 - /sys/devices/cpu/events/PM_VSU0_SCAL_DOUBLE_ISSUED 272 - /sys/devices/cpu/events/PM_GRP_DISP 273 - /sys/devices/cpu/events/PM_LSU0_LDX 274 - /sys/devices/cpu/events/PM_DATA_FROM_L2 275 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RL2L3_MOD 276 - /sys/devices/cpu/events/PM_VSU0_VECT_DOUBLE_ISSUED 277 - /sys/devices/cpu/events/PM_VSU1_2FLOP_DOUBLE 278 - /sys/devices/cpu/events/PM_THRD_PRIO_6_7_CYC 279 - /sys/devices/cpu/events/PM_BC_PLUS_8_RSLV_TAKEN 280 - /sys/devices/cpu/events/PM_BR_MPRED_CR 281 - /sys/devices/cpu/events/PM_L3_CO_MEM 282 - /sys/devices/cpu/events/PM_DATA_FROM_RL2L3_MOD 283 - /sys/devices/cpu/events/PM_LSU_SRQ_FULL_CYC 284 - /sys/devices/cpu/events/PM_TABLEWALK_CYC 285 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_RMEM 286 - /sys/devices/cpu/events/PM_LSU_SRQ_STFWD 287 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_RMEM 288 - /sys/devices/cpu/events/PM_FXU0_FIN 289 - /sys/devices/cpu/events/PM_LSU1_L1_SW_PREF 290 - /sys/devices/cpu/events/PM_PTEG_FROM_L31_MOD 291 - /sys/devices/cpu/events/PM_PMC5_OVERFLOW 292 - /sys/devices/cpu/events/PM_LD_REF_L1_LSU1 293 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L21_SHR 294 - /sys/devices/cpu/events/PM_DATA_FROM_RMEM 295 - /sys/devices/cpu/events/PM_VSU0_SCAL_SINGLE_ISSUED 296 - /sys/devices/cpu/events/PM_BR_MPRED_LSTACK 297 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RL2L3_MOD_CYC 298 - /sys/devices/cpu/events/PM_LSU0_FLUSH_UST 299 - /sys/devices/cpu/events/PM_LSU_NCST 300 - /sys/devices/cpu/events/PM_BR_TAKEN 301 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_LMEM 302 - /sys/devices/cpu/events/PM_DTLB_MISS_4K 303 - /sys/devices/cpu/events/PM_PMC4_SAVED 304 - /sys/devices/cpu/events/PM_VSU1_PERMUTE_ISSUED 305 - /sys/devices/cpu/events/PM_SLB_MISS 306 - /sys/devices/cpu/events/PM_LSU1_FLUSH_LRQ 307 - /sys/devices/cpu/events/PM_DTLB_MISS 308 - /sys/devices/cpu/events/PM_VSU1_FRSP 309 - /sys/devices/cpu/events/PM_VSU_VECTOR_DOUBLE_ISSUED 310 - /sys/devices/cpu/events/PM_L2_CASTOUT_SHR 311 - /sys/devices/cpu/events/PM_DATA_FROM_DL2L3_SHR 312 - /sys/devices/cpu/events/PM_VSU1_STF 313 - /sys/devices/cpu/events/PM_ST_FIN 314 - /sys/devices/cpu/events/PM_PTEG_FROM_L21_SHR 315 - /sys/devices/cpu/events/PM_L2_LOC_GUESS_WRONG 316 - /sys/devices/cpu/events/PM_MRK_STCX_FAIL 317 - /sys/devices/cpu/events/PM_LSU0_REJECT_LHS 318 - /sys/devices/cpu/events/PM_IC_PREF_CANCEL_HIT 319 - /sys/devices/cpu/events/PM_L3_PREF_BUSY 320 - /sys/devices/cpu/events/PM_MRK_BRU_FIN 321 - /sys/devices/cpu/events/PM_LSU1_NCLD 322 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L31_MOD 323 - /sys/devices/cpu/events/PM_LSU_NCLD 324 - /sys/devices/cpu/events/PM_LSU_LDX 325 - /sys/devices/cpu/events/PM_L2_LOC_GUESS_CORRECT 326 - /sys/devices/cpu/events/PM_THRESH_TIMEO 327 - /sys/devices/cpu/events/PM_L3_PREF_ST 328 - /sys/devices/cpu/events/PM_DISP_CLB_HELD_SYNC 329 - /sys/devices/cpu/events/PM_VSU_SIMPLE_ISSUED 330 - /sys/devices/cpu/events/PM_VSU1_SINGLE 331 - /sys/devices/cpu/events/PM_DATA_TABLEWALK_CYC 332 - /sys/devices/cpu/events/PM_L2_RC_ST_DONE 333 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L21_MOD 334 - /sys/devices/cpu/events/PM_LARX_LSU1 335 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RMEM 336 - /sys/devices/cpu/events/PM_DISP_CLB_HELD 337 - /sys/devices/cpu/events/PM_DERAT_MISS_4K 338 - /sys/devices/cpu/events/PM_L2_RCLD_DISP_FAIL_ADDR 339 - /sys/devices/cpu/events/PM_SEG_EXCEPTION 340 - /sys/devices/cpu/events/PM_FLUSH_DISP_SB 341 - /sys/devices/cpu/events/PM_L2_DC_INV 342 - /sys/devices/cpu/events/PM_PTEG_FROM_DL2L3_MOD 343 - /sys/devices/cpu/events/PM_DSEG 344 - /sys/devices/cpu/events/PM_BR_PRED_LSTACK 345 - /sys/devices/cpu/events/PM_VSU0_STF 346 - /sys/devices/cpu/events/PM_LSU_FX_FIN 347 - /sys/devices/cpu/events/PM_DERAT_MISS_16M 348 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_DL2L3_MOD 349 - /sys/devices/cpu/events/PM_GCT_UTIL_11_PLUS_SLOTS 350 - /sys/devices/cpu/events/PM_INST_FROM_L3 351 - /sys/devices/cpu/events/PM_MRK_IFU_FIN 352 - /sys/devices/cpu/events/PM_ITLB_MISS 353 - /sys/devices/cpu/events/PM_VSU_STF 354 - /sys/devices/cpu/events/PM_LSU_FLUSH_UST 355 - /sys/devices/cpu/events/PM_L2_LDST_MISS 356 - /sys/devices/cpu/events/PM_FXU1_FIN 357 - /sys/devices/cpu/events/PM_SHL_DEALLOCATED 358 - /sys/devices/cpu/events/PM_L2_SN_M_WR_DONE 359 - /sys/devices/cpu/events/PM_LSU_REJECT_SET_MPRED 360 - /sys/devices/cpu/events/PM_L3_PREF_LD 361 - /sys/devices/cpu/events/PM_L2_SN_M_RD_DONE 362 - /sys/devices/cpu/events/PM_MRK_DERAT_MISS_16G 363 - /sys/devices/cpu/events/PM_VSU_FCONV 364 - /sys/devices/cpu/events/PM_ANY_THRD_RUN_CYC 365 - /sys/devices/cpu/events/PM_LSU_LMQ_FULL_CYC 366 - /sys/devices/cpu/events/PM_MRK_LSU_REJECT_LHS 367 - /sys/devices/cpu/events/PM_MRK_LD_MISS_L1_CYC 368 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L2_CYC 369 - /sys/devices/cpu/events/PM_INST_IMC_MATCH_DISP 370 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RMEM_CYC 371 - /sys/devices/cpu/events/PM_VSU0_SIMPLE_ISSUED 372 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_RL2L3_SHR 373 - /sys/devices/cpu/events/PM_VSU_FMA_DOUBLE 374 - /sys/devices/cpu/events/PM_VSU_4FLOP 375 - /sys/devices/cpu/events/PM_VSU1_FIN 376 - /sys/devices/cpu/events/PM_NEST_PAIR1_AND 377 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_RL2L3_MOD 378 - /sys/devices/cpu/events/PM_PTEG_FROM_RMEM 379 - /sys/devices/cpu/events/PM_LSU_LRQ_S0_VALID 380 - /sys/devices/cpu/events/PM_LSU0_LDF 381 - /sys/devices/cpu/events/PM_FLUSH_COMPLETION 382 - /sys/devices/cpu/events/PM_ST_MISS_L1 383 - /sys/devices/cpu/events/PM_L2_NODE_PUMP 384 - /sys/devices/cpu/events/PM_INST_FROM_DL2L3_SHR 385 - /sys/devices/cpu/events/PM_MRK_STALL_CMPLU_CYC 386 - /sys/devices/cpu/events/PM_VSU1_DENORM 387 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L31_SHR_CYC 388 - /sys/devices/cpu/events/PM_NEST_PAIR0_ADD 389 - /sys/devices/cpu/events/PM_INST_FROM_L3MISS 390 - /sys/devices/cpu/events/PM_EE_OFF_EXT_INT 391 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_DMEM 392 - /sys/devices/cpu/events/PM_INST_FROM_DL2L3_MOD 393 - /sys/devices/cpu/events/PM_PMC6_OVERFLOW 394 - /sys/devices/cpu/events/PM_VSU_2FLOP_DOUBLE 395 - /sys/devices/cpu/events/PM_TLB_MISS 396 - /sys/devices/cpu/events/PM_FXU_BUSY 397 - /sys/devices/cpu/events/PM_L2_RCLD_DISP_FAIL_OTHER 398 - /sys/devices/cpu/events/PM_LSU_REJECT_LMQ_FULL 399 - /sys/devices/cpu/events/PM_IC_RELOAD_SHR 400 - /sys/devices/cpu/events/PM_GRP_MRK 401 - /sys/devices/cpu/events/PM_MRK_ST_NEST 402 - /sys/devices/cpu/events/PM_VSU1_FSQRT_FDIV 403 - /sys/devices/cpu/events/PM_LSU0_FLUSH_LRQ 404 - /sys/devices/cpu/events/PM_LARX_LSU0 405 - /sys/devices/cpu/events/PM_IBUF_FULL_CYC 406 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DL2L3_SHR_CYC 407 - /sys/devices/cpu/events/PM_LSU_DC_PREF_STREAM_ALLOC 408 - /sys/devices/cpu/events/PM_GRP_MRK_CYC 409 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RL2L3_SHR_CYC 410 - /sys/devices/cpu/events/PM_L2_GLOB_GUESS_CORRECT 411 - /sys/devices/cpu/events/PM_LSU_REJECT_LHS 412 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_LMEM 413 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L3 414 - /sys/devices/cpu/events/PM_FREQ_DOWN 415 - /sys/devices/cpu/events/PM_PB_RETRY_NODE_PUMP 416 - /sys/devices/cpu/events/PM_INST_FROM_RL2L3_SHR 417 - /sys/devices/cpu/events/PM_MRK_INST_ISSUED 418 - /sys/devices/cpu/events/PM_PTEG_FROM_L3MISS 419 - /sys/devices/cpu/events/PM_RUN_PURR 420 - /sys/devices/cpu/events/PM_MRK_GRP_IC_MISS 421 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L3 422 - /sys/devices/cpu/events/PM_PTEG_FROM_RL2L3_SHR 423 - /sys/devices/cpu/events/PM_LSU_FLUSH_LRQ 424 - /sys/devices/cpu/events/PM_MRK_DERAT_MISS_64K 425 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_DL2L3_MOD 426 - /sys/devices/cpu/events/PM_L2_ST_MISS 427 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L21_SHR 428 - /sys/devices/cpu/events/PM_LWSYNC 429 - /sys/devices/cpu/events/PM_LSU0_DC_PREF_STREAM_CONFIRM_STRIDE 430 - /sys/devices/cpu/events/PM_MRK_LSU_FLUSH_LRQ 431 - /sys/devices/cpu/events/PM_INST_IMC_MATCH_CMPL 432 - /sys/devices/cpu/events/PM_NEST_PAIR3_AND 433 - /sys/devices/cpu/events/PM_PB_RETRY_SYS_PUMP 434 - /sys/devices/cpu/events/PM_MRK_INST_FIN 435 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_DL2L3_SHR 436 - /sys/devices/cpu/events/PM_INST_FROM_L31_MOD 437 - /sys/devices/cpu/events/PM_MRK_DTLB_MISS_64K 438 - /sys/devices/cpu/events/PM_LSU_FIN 439 - /sys/devices/cpu/events/PM_MRK_LSU_REJECT 440 - /sys/devices/cpu/events/PM_L2_CO_FAIL_BUSY 441 - /sys/devices/cpu/events/PM_MEM0_WQ_DISP 442 - /sys/devices/cpu/events/PM_DATA_FROM_L31_MOD 443 - /sys/devices/cpu/events/PM_THERMAL_WARN 444 - /sys/devices/cpu/events/PM_VSU0_4FLOP 445 - /sys/devices/cpu/events/PM_BR_MPRED_CCACHE 446 - /sys/devices/cpu/events/PM_L1_DEMAND_WRITE 447 - /sys/devices/cpu/events/PM_FLUSH_BR_MPRED 448 - /sys/devices/cpu/events/PM_MRK_DTLB_MISS_16G 449 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_DMEM 450 - /sys/devices/cpu/events/PM_L2_RCST_DISP 451 - /sys/devices/cpu/events/PM_LSU_PARTIAL_CDF 452 - /sys/devices/cpu/events/PM_DISP_CLB_HELD_SB 453 - /sys/devices/cpu/events/PM_VSU0_FMA_DOUBLE 454 - /sys/devices/cpu/events/PM_FXU0_BUSY_FXU1_IDLE 455 - /sys/devices/cpu/events/PM_IC_DEMAND_CYC 456 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L21_SHR 457 - /sys/devices/cpu/events/PM_MRK_LSU_FLUSH_UST 458 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L3MISS 459 - /sys/devices/cpu/events/PM_VSU_DENORM 460 - /sys/devices/cpu/events/PM_MRK_LSU_PARTIAL_CDF 461 - /sys/devices/cpu/events/PM_INST_FROM_L21_SHR 462 - /sys/devices/cpu/events/PM_IC_PREF_WRITE 463 - /sys/devices/cpu/events/PM_BR_PRED 464 - /sys/devices/cpu/events/PM_INST_FROM_DMEM 465 - /sys/devices/cpu/events/PM_IC_PREF_CANCEL_ALL 466 - /sys/devices/cpu/events/PM_LSU_DC_PREF_STREAM_CONFIRM 467 - /sys/devices/cpu/events/PM_MRK_LSU_FLUSH_SRQ 468 - /sys/devices/cpu/events/PM_MRK_FIN_STALL_CYC 469 - /sys/devices/cpu/events/PM_L2_RCST_DISP_FAIL_OTHER 470 - /sys/devices/cpu/events/PM_VSU1_DD_ISSUED 471 - /sys/devices/cpu/events/PM_PTEG_FROM_L31_SHR 472 - /sys/devices/cpu/events/PM_DATA_FROM_L21_SHR 473 - /sys/devices/cpu/events/PM_LSU0_NCLD 474 - /sys/devices/cpu/events/PM_VSU1_4FLOP 475 - /sys/devices/cpu/events/PM_VSU1_8FLOP 476 - /sys/devices/cpu/events/PM_VSU_8FLOP 477 - /sys/devices/cpu/events/PM_LSU_LMQ_SRQ_EMPTY_CYC 478 - /sys/devices/cpu/events/PM_DTLB_MISS_64K 479 - /sys/devices/cpu/events/PM_THRD_CONC_RUN_INST 480 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L2 481 - /sys/devices/cpu/events/PM_PB_SYS_PUMP 482 - /sys/devices/cpu/events/PM_VSU_FIN 483 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L31_MOD 484 - /sys/devices/cpu/events/PM_THRD_PRIO_0_1_CYC 485 - /sys/devices/cpu/events/PM_DERAT_MISS_64K 486 - /sys/devices/cpu/events/PM_PMC2_REWIND 487 - /sys/devices/cpu/events/PM_INST_FROM_L2 488 - /sys/devices/cpu/events/PM_GRP_BR_MPRED_NONSPEC 489 - /sys/devices/cpu/events/PM_INST_DISP 490 - /sys/devices/cpu/events/PM_MEM0_RD_CANCEL_TOTAL 491 - /sys/devices/cpu/events/PM_LSU0_DC_PREF_STREAM_CONFIRM 492 - /sys/devices/cpu/events/PM_L1_DCACHE_RELOAD_VALID 493 - /sys/devices/cpu/events/PM_VSU_SCALAR_DOUBLE_ISSUED 494 - /sys/devices/cpu/events/PM_L3_PREF_HIT 495 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L31_MOD 496 - /sys/devices/cpu/events/PM_MRK_FXU_FIN 497 - /sys/devices/cpu/events/PM_PMC4_OVERFLOW 498 - /sys/devices/cpu/events/PM_MRK_PTEG_FROM_L3 499 - /sys/devices/cpu/events/PM_LSU0_LMQ_LHR_MERGE 500 - /sys/devices/cpu/events/PM_BTAC_HIT 501 - /sys/devices/cpu/events/PM_L3_RD_BUSY 502 - /sys/devices/cpu/events/PM_LSU0_L1_SW_PREF 503 - /sys/devices/cpu/events/PM_INST_FROM_L2MISS 504 - /sys/devices/cpu/events/PM_LSU0_DC_PREF_STREAM_ALLOC 505 - /sys/devices/cpu/events/PM_L2_ST 506 - /sys/devices/cpu/events/PM_VSU0_DENORM 507 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DL2L3_SHR 508 - /sys/devices/cpu/events/PM_BR_PRED_CR_TA 509 - /sys/devices/cpu/events/PM_VSU0_FCONV 510 - /sys/devices/cpu/events/PM_MRK_LSU_FLUSH_ULD 511 - /sys/devices/cpu/events/PM_BTAC_MISS 512 - /sys/devices/cpu/events/PM_MRK_LD_MISS_EXPOSED_CYC_COUNT 513 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L2 514 - /sys/devices/cpu/events/PM_LSU_DCACHE_RELOAD_VALID 515 - /sys/devices/cpu/events/PM_VSU_FMA 516 - /sys/devices/cpu/events/PM_LSU0_FLUSH_SRQ 517 - /sys/devices/cpu/events/PM_LSU1_L1_PREF 518 - /sys/devices/cpu/events/PM_IOPS_CMPL 519 - /sys/devices/cpu/events/PM_L2_SYS_PUMP 520 - /sys/devices/cpu/events/PM_L2_RCLD_BUSY_RC_FULL 521 - /sys/devices/cpu/events/PM_LSU_LMQ_S0_ALLOC 522 - /sys/devices/cpu/events/PM_FLUSH_DISP_SYNC 523 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_DL2L3_MOD_CYC 524 - /sys/devices/cpu/events/PM_L2_IC_INV 525 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L21_MOD_CYC 526 - /sys/devices/cpu/events/PM_L3_PREF_LDST 527 - /sys/devices/cpu/events/PM_LSU_SRQ_EMPTY_CYC 528 - /sys/devices/cpu/events/PM_LSU_LMQ_S0_VALID 529 - /sys/devices/cpu/events/PM_FLUSH_PARTIAL 530 - /sys/devices/cpu/events/PM_VSU1_FMA_DOUBLE 531 - /sys/devices/cpu/events/PM_1PLUS_PPC_DISP 532 - /sys/devices/cpu/events/PM_DATA_FROM_L2MISS 533 - /sys/devices/cpu/events/PM_SUSPENDED 534 - /sys/devices/cpu/events/PM_VSU0_FMA 535 - /sys/devices/cpu/events/PM_STCX_FAIL 536 - /sys/devices/cpu/events/PM_VSU0_FSQRT_FDIV_DOUBLE 537 - /sys/devices/cpu/events/PM_DC_PREF_DST 538 - /sys/devices/cpu/events/PM_VSU1_SCAL_SINGLE_ISSUED 539 - /sys/devices/cpu/events/PM_L3_HIT 540 - /sys/devices/cpu/events/PM_L2_GLOB_GUESS_WRONG 541 - /sys/devices/cpu/events/PM_MRK_DFU_FIN 542 - /sys/devices/cpu/events/PM_INST_FROM_L1 543 - /sys/devices/cpu/events/PM_IC_DEMAND_REQ 544 - /sys/devices/cpu/events/PM_VSU1_FSQRT_FDIV_DOUBLE 545 - /sys/devices/cpu/events/PM_VSU1_FMA 546 - /sys/devices/cpu/events/PM_MRK_LD_MISS_L1 547 - /sys/devices/cpu/events/PM_VSU0_2FLOP_DOUBLE 548 - /sys/devices/cpu/events/PM_LSU_DC_PREF_STRIDED_STREAM_CONFIRM 549 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_L31_SHR 550 - /sys/devices/cpu/events/PM_MRK_LSU_REJECT_ERAT_MISS 551 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_L2MISS 552 - /sys/devices/cpu/events/PM_DATA_FROM_RL2L3_SHR 553 - /sys/devices/cpu/events/PM_INST_FROM_PREF 554 - /sys/devices/cpu/events/PM_VSU1_SQ 555 - /sys/devices/cpu/events/PM_L2_LD_DISP 556 - /sys/devices/cpu/events/PM_L2_DISP_ALL 557 - /sys/devices/cpu/events/PM_THRD_GRP_CMPL_BOTH_CYC 558 - /sys/devices/cpu/events/PM_VSU_FSQRT_FDIV_DOUBLE 559 - /sys/devices/cpu/events/PM_INST_PTEG_FROM_DL2L3_SHR 560 - /sys/devices/cpu/events/PM_VSU_1FLOP 561 - /sys/devices/cpu/events/PM_HV_CYC 562 - /sys/devices/cpu/events/PM_MRK_LSU_FIN 563 - /sys/devices/cpu/events/PM_MRK_DATA_FROM_RL2L3_SHR 564 - /sys/devices/cpu/events/PM_DTLB_MISS_16M 565 - /sys/devices/cpu/events/PM_LSU1_LMQ_LHR_MERGE 566 - /sys/devices/cpu/events/PM_IFU_FIN 567 - /sys/devices/cpu/events/PM_1THRD_CON_RUN_INSTR 568 - /sys/devices/cpu/events/PM_CMPLU_STALL_COUNT 569 - /sys/devices/cpu/events/PM_MEM0_PB_RD_CL 570 - /sys/devices/cpu/events/PM_THRD_1_RUN_CYC 571 - /sys/devices/cpu/events/PM_THRD_2_CONC_RUN_INSTR 572 - /sys/devices/cpu/events/PM_THRD_2_RUN_CYC 573 - /sys/devices/cpu/events/PM_THRD_3_CONC_RUN_INST 574 - /sys/devices/cpu/events/PM_THRD_3_RUN_CYC 575 - /sys/devices/cpu/events/PM_THRD_4_CONC_RUN_INST 576 - /sys/devices/cpu/events/PM_THRD_4_RUN_CYC 577 - 578 - Date: 2013/01/08 579 - 30 + What: /sys/bus/event_source/devices/<pmu>/events/<event> 31 + Date: 2014/02/24 580 32 Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org> 581 - Linux Powerpc mailing list <linuxppc-dev@ozlabs.org> 33 + Description: Per-pmu performance monitoring events specific to the running system 582 34 583 - Description: POWER-systems specific performance monitoring events 35 + Each file (except for some of those with a '.' in them, '.unit' 36 + and '.scale') in the 'events' directory describes a single 37 + performance monitoring event supported by the <pmu>. The name 38 + of the file is the name of the event. 584 39 585 - A collection of performance monitoring events that may be 586 - supported by the POWER CPU. These events can be monitored 587 - using the 'perf(1)' tool. 40 + File contents: 588 41 589 - These events may not be supported by other CPUs. 42 + <term>[=<value>][,<term>[=<value>]]... 590 43 591 - The contents of each file would look like: 44 + Where <term> is one of the terms listed under 45 + /sys/bus/event_source/devices/<pmu>/format/ and <value> is 46 + a number is base-16 format with a '0x' prefix (lowercase only). 47 + If a <term> is specified alone (without an assigned value), it 48 + is implied that 0x1 is assigned to that <term>. 592 49 593 - event=0xNNNN 50 + Examples (each of these lines would be in a seperate file): 594 51 595 - where 'N' is a hex digit and the number '0xNNNN' shows the 596 - "raw code" for the perf event identified by the file's 597 - "basename". 52 + event=0x2abc 53 + event=0x423,inv,cmask=0x3 54 + domain=0x1,offset=0x8,starting_index=0xffff 598 55 599 - Further, multiple terms like 'event=0xNNNN' can be specified 600 - and separated with comma. All available terms are defined in 601 - the /sys/bus/event_source/devices/<dev>/format file. 56 + Each of the assignments indicates a value to be assigned to a 57 + particular set of bits (as defined by the format file 58 + corresponding to the <term>) in the perf_event structure passed 59 + to the perf_open syscall. 60 + 61 + What: /sys/bus/event_source/devices/<pmu>/events/<event>.unit 62 + Date: 2014/02/24 63 + Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org> 64 + Description: Perf event units 65 + 66 + A string specifying the English plural numerical unit that <event> 67 + (once multiplied by <event>.scale) represents. 68 + 69 + Example: 70 + 71 + Joules 72 + 73 + What: /sys/bus/event_source/devices/<pmu>/events/<event>.scale 74 + Date: 2014/02/24 75 + Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org> 76 + Description: Perf event scaling factors 77 + 78 + A string representing a floating point value expressed in 79 + scientific notation to be multiplied by the event count 80 + recieved from the kernel to match the unit specified in the 81 + <event>.unit file. 82 + 83 + Example: 84 + 85 + 2.3283064365386962890625e-10 86 + 87 + This is provided to avoid performing floating point arithmetic 88 + in the kernel.
-1
arch/x86/include/asm/kprobes.h
··· 27 27 #include <asm/insn.h> 28 28 29 29 #define __ARCH_WANT_KPROBES_INSN_SLOT 30 - #define ARCH_SUPPORTS_KPROBES_ON_FTRACE 31 30 32 31 struct pt_regs; 33 32 struct kprobe;
+3 -3
tools/perf/Documentation/perf-diff.txt
··· 196 196 197 197 - period being the hist entry period value 198 198 199 - - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option 199 + - WEIGHT-A/WEIGHT-B being user supplied weights in the the '-c' option 200 200 behind ':' separator like '-c wdiff:1,2'. 201 - - WIEGHT-A being the weight of the data file 202 - - WIEGHT-B being the weight of the baseline data file 201 + - WEIGHT-A being the weight of the data file 202 + - WEIGHT-B being the weight of the baseline data file 203 203 204 204 SEE ALSO 205 205 --------
+2 -2
tools/perf/Documentation/perf-kvm.txt
··· 100 100 STAT REPORT OPTIONS 101 101 ------------------- 102 102 --vcpu=<value>:: 103 - analyze events which occures on this vcpu. (default: all vcpus) 103 + analyze events which occur on this vcpu. (default: all vcpus) 104 104 105 105 --event=<value>:: 106 106 event to be analyzed. Possible values: vmexit, mmio (x86 only), ··· 134 134 Analyze events only for given process ID(s) (comma separated list). 135 135 136 136 --vcpu=<value>:: 137 - analyze events which occures on this vcpu. (default: all vcpus) 137 + analyze events which occur on this vcpu. (default: all vcpus) 138 138 139 139 140 140 --event=<value>::
+1 -1
tools/perf/Documentation/perf-list.txt
··· 19 19 EVENT MODIFIERS 20 20 --------------- 21 21 22 - Events can optionally have a modifer by appending a colon and one or 22 + Events can optionally have a modifier by appending a colon and one or 23 23 more modifiers. Modifiers allow the user to restrict the events to be 24 24 counted. The following modifiers exist: 25 25
+1 -1
tools/perf/Documentation/perf-record.txt
··· 146 146 147 147 -N:: 148 148 --no-buildid-cache:: 149 - Do not update the builid cache. This saves some overhead in situations 149 + Do not update the buildid cache. This saves some overhead in situations 150 150 where the information in the perf.data file (which includes buildids) 151 151 is sufficient. 152 152
+2 -2
tools/perf/Documentation/perf-script-perl.txt
··· 181 181 and values parsed from the 'print fmt' fields of the event format 182 182 files: 183 183 184 - flag_str($event_name, $field_name, $field_value) - returns the string represention corresponding to $field_value for the flag field $field_name of event $event_name 185 - symbol_str($event_name, $field_name, $field_value) - returns the string represention corresponding to $field_value for the symbolic field $field_name of event $event_name 184 + flag_str($event_name, $field_name, $field_value) - returns the string representation corresponding to $field_value for the flag field $field_name of event $event_name 185 + symbol_str($event_name, $field_name, $field_value) - returns the string representation corresponding to $field_value for the symbolic field $field_name of event $event_name 186 186 187 187 Perf::Trace::Context Module 188 188 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3 -3
tools/perf/Documentation/perf-script-python.txt
··· 263 263 264 264 The print_syscall_totals() function iterates over the entries in the 265 265 dictionary and displays a line for each entry containing the syscall 266 - name (the dictonary keys contain the syscall ids, which are passed to 266 + name (the dictionary keys contain the syscall ids, which are passed to 267 267 the Util function syscall_name(), which translates the raw syscall 268 268 numbers to the corresponding syscall name strings). The output is 269 269 displayed after all the events in the trace have been processed, by ··· 576 576 and values parsed from the 'print fmt' fields of the event format 577 577 files: 578 578 579 - flag_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the flag field field_name of event event_name 580 - symbol_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the symbolic field field_name of event event_name 579 + flag_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the flag field field_name of event event_name 580 + symbol_str(event_name, field_name, field_value) - returns the string representation corresponding to field_value for the symbolic field field_name of event event_name 581 581 582 582 The *autodict* function returns a special kind of Python 583 583 dictionary that implements Perl's 'autovivifying' hashes in Python
+2 -2
tools/perf/Documentation/perf-script.txt
··· 115 115 -f:: 116 116 --fields:: 117 117 Comma separated list of fields to print. Options are: 118 - comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline. 118 + comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline, period. 119 119 Field list can be prepended with the type, trace, sw or hw, 120 120 to indicate to which event type the field list applies. 121 121 e.g., -f sw:comm,tid,time,ip,sym and -f trace:time,cpu,trace ··· 140 140 141 141 "Overriding previous field request for all events." 142 142 143 - Alternativey, consider the order: 143 + Alternatively, consider the order: 144 144 145 145 -f comm,tid,time,ip,sym -f trace: 146 146
+1 -1
tools/perf/Documentation/perf-test.txt
··· 25 25 ------- 26 26 -s:: 27 27 --skip:: 28 - Tests to skip (comma separater numeric list). 28 + Tests to skip (comma separated numeric list). 29 29 30 30 -v:: 31 31 --verbose::
+1 -1
tools/perf/Documentation/perf-trace.txt
··· 20 20 This is a live mode tool in addition to working with perf.data files like 21 21 the other perf tools. Files can be generated using the 'perf record' command 22 22 but the session needs to include the raw_syscalls events (-e 'raw_syscalls:*'). 23 - Alernatively, the 'perf trace record' can be used as a shortcut to 23 + Alternatively, 'perf trace record' can be used as a shortcut to 24 24 automatically include the raw_syscalls events when writing events to a file. 25 25 26 26 The following options apply to perf trace; options to perf trace record are
+9 -5
tools/perf/builtin-annotate.c
··· 51 51 struct addr_location *al, 52 52 struct perf_annotate *ann) 53 53 { 54 + struct hists *hists = evsel__hists(evsel); 54 55 struct hist_entry *he; 55 56 int ret; 56 57 ··· 67 66 return 0; 68 67 } 69 68 70 - he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0, 71 - true); 69 + he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true); 72 70 if (he == NULL) 73 71 return -ENOMEM; 74 72 75 73 ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); 76 - hists__inc_nr_samples(&evsel->hists, true); 74 + hists__inc_nr_samples(hists, true); 77 75 return ret; 78 76 } 79 77 ··· 214 214 215 215 if (dump_trace) { 216 216 perf_session__fprintf_nr_events(session, stdout); 217 + perf_evlist__fprintf_nr_events(session->evlist, stdout); 217 218 goto out; 218 219 } 219 220 ··· 226 225 227 226 total_nr_samples = 0; 228 227 evlist__for_each(session->evlist, pos) { 229 - struct hists *hists = &pos->hists; 228 + struct hists *hists = evsel__hists(pos); 230 229 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 231 230 232 231 if (nr_samples > 0) { ··· 326 325 "Show event group information together"), 327 326 OPT_END() 328 327 }; 329 - int ret; 328 + int ret = hists__init(); 329 + 330 + if (ret < 0) 331 + return ret; 330 332 331 333 argc = parse_options(argc, argv, options, annotate_usage, 0); 332 334
+12 -9
tools/perf/builtin-diff.c
··· 327 327 struct machine *machine) 328 328 { 329 329 struct addr_location al; 330 + struct hists *hists = evsel__hists(evsel); 330 331 331 332 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { 332 333 pr_warning("problem processing %d event, skipping it.\n", ··· 335 334 return -1; 336 335 } 337 336 338 - if (hists__add_entry(&evsel->hists, &al, sample->period, 337 + if (hists__add_entry(hists, &al, sample->period, 339 338 sample->weight, sample->transaction)) { 340 339 pr_warning("problem incrementing symbol period, skipping event\n"); 341 340 return -1; ··· 347 346 * hists__output_resort() and precompute needs the total 348 347 * period in order to sort entries by percentage delta. 349 348 */ 350 - evsel->hists.stats.total_period += sample->period; 349 + hists->stats.total_period += sample->period; 351 350 if (!al.filtered) 352 - evsel->hists.stats.total_non_filtered_period += sample->period; 351 + hists->stats.total_non_filtered_period += sample->period; 353 352 354 353 return 0; 355 354 } ··· 383 382 struct perf_evsel *evsel; 384 383 385 384 evlist__for_each(evlist, evsel) { 386 - struct hists *hists = &evsel->hists; 385 + struct hists *hists = evsel__hists(evsel); 387 386 388 387 hists__collapse_resort(hists, NULL); 389 388 } ··· 632 631 bool first = true; 633 632 634 633 evlist__for_each(evlist_base, evsel_base) { 634 + struct hists *hists_base = evsel__hists(evsel_base); 635 635 struct data__file *d; 636 636 int i; 637 637 638 638 data__for_each_file_new(i, d) { 639 639 struct perf_evlist *evlist = d->session->evlist; 640 640 struct perf_evsel *evsel; 641 + struct hists *hists; 641 642 642 643 evsel = evsel_match(evsel_base, evlist); 643 644 if (!evsel) 644 645 continue; 645 646 646 - d->hists = &evsel->hists; 647 + hists = evsel__hists(evsel); 648 + d->hists = hists; 647 649 648 - hists__match(&evsel_base->hists, &evsel->hists); 650 + hists__match(hists_base, hists); 649 651 650 652 if (!show_baseline_only) 651 - hists__link(&evsel_base->hists, 652 - &evsel->hists); 653 + hists__link(hists_base, hists); 653 654 } 654 655 655 656 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", ··· 662 659 if (verbose || data__files_cnt > 2) 663 660 data__fprintf(); 664 661 665 - hists__process(&evsel_base->hists); 662 + hists__process(hists_base); 666 663 } 667 664 } 668 665
+11 -18
tools/perf/builtin-kvm.c
··· 376 376 struct perf_sample *sample) 377 377 { 378 378 /* Only kvm_entry records vcpu id. */ 379 - if (!thread->priv && kvm_entry_event(evsel)) { 379 + if (!thread__priv(thread) && kvm_entry_event(evsel)) { 380 380 struct vcpu_event_record *vcpu_record; 381 381 382 382 vcpu_record = zalloc(sizeof(*vcpu_record)); ··· 386 386 } 387 387 388 388 vcpu_record->vcpu_id = perf_evsel__intval(evsel, sample, VCPU_ID); 389 - thread->priv = vcpu_record; 389 + thread__set_priv(thread, vcpu_record); 390 390 } 391 391 392 - return thread->priv; 392 + return thread__priv(thread); 393 393 } 394 394 395 395 static bool handle_kvm_event(struct perf_kvm_stat *kvm, ··· 896 896 897 897 static int kvm_events_live_report(struct perf_kvm_stat *kvm) 898 898 { 899 - struct pollfd *pollfds = NULL; 900 - int nr_fds, nr_stdin, ret, err = -EINVAL; 899 + int nr_stdin, ret, err = -EINVAL; 901 900 struct termios save; 902 901 903 902 /* live flag must be set first */ ··· 918 919 signal(SIGINT, sig_handler); 919 920 signal(SIGTERM, sig_handler); 920 921 921 - /* use pollfds -- need to add timerfd and stdin */ 922 - nr_fds = kvm->evlist->pollfd.nr; 923 - 924 922 /* add timer fd */ 925 923 if (perf_kvm__timerfd_create(kvm) < 0) { 926 924 err = -1; 927 925 goto out; 928 926 } 929 927 930 - if (perf_evlist__add_pollfd(kvm->evlist, kvm->timerfd)) 928 + if (perf_evlist__add_pollfd(kvm->evlist, kvm->timerfd) < 0) 931 929 goto out; 932 930 933 - nr_fds++; 934 - 935 - if (perf_evlist__add_pollfd(kvm->evlist, fileno(stdin))) 931 + nr_stdin = perf_evlist__add_pollfd(kvm->evlist, fileno(stdin)); 932 + if (nr_stdin < 0) 936 933 goto out; 937 934 938 - nr_stdin = nr_fds; 939 - nr_fds++; 940 935 if (fd_set_nonblock(fileno(stdin)) != 0) 941 936 goto out; 942 - 943 - pollfds = kvm->evlist->pollfd.entries; 944 937 945 938 /* everything is good - enable the events and process */ 946 939 perf_evlist__enable(kvm->evlist); 947 940 948 941 while (!done) { 942 + struct fdarray *fda = &kvm->evlist->pollfd; 949 943 int rc; 950 944 951 945 rc = perf_kvm__mmap_read(kvm); ··· 949 957 if (err) 950 958 goto out; 951 959 952 - if (pollfds[nr_stdin].revents & POLLIN) 960 + if (fda->entries[nr_stdin].revents & POLLIN) 953 961 done = perf_kvm__handle_stdin(); 954 962 955 963 if (!rc && !done) 956 - err = poll(pollfds, nr_fds, 100); 964 + err = fdarray__poll(fda, 100); 957 965 } 958 966 959 967 perf_evlist__disable(kvm->evlist); ··· 1358 1366 } 1359 1367 kvm->session->evlist = kvm->evlist; 1360 1368 perf_session__set_id_hdr_size(kvm->session); 1369 + ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true); 1361 1370 machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target, 1362 1371 kvm->evlist->threads, false); 1363 1372 err = kvm_live_open_events(kvm);
+2
tools/perf/builtin-record.c
··· 14 14 #include "util/parse-options.h" 15 15 #include "util/parse-events.h" 16 16 17 + #include "util/callchain.h" 18 + #include "util/cgroup.h" 17 19 #include "util/header.h" 18 20 #include "util/event.h" 19 21 #include "util/evlist.h"
+22 -9
tools/perf/builtin-report.c
··· 257 257 } 258 258 } 259 259 260 + if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) { 261 + if ((sample_type & PERF_SAMPLE_REGS_USER) && 262 + (sample_type & PERF_SAMPLE_STACK_USER)) 263 + callchain_param.record_mode = CALLCHAIN_DWARF; 264 + else 265 + callchain_param.record_mode = CALLCHAIN_FP; 266 + } 260 267 return 0; 261 268 } 262 269 ··· 295 288 evname = buf; 296 289 297 290 for_each_group_member(pos, evsel) { 291 + const struct hists *pos_hists = evsel__hists(pos); 292 + 298 293 if (symbol_conf.filter_relative) { 299 - nr_samples += pos->hists.stats.nr_non_filtered_samples; 300 - nr_events += pos->hists.stats.total_non_filtered_period; 294 + nr_samples += pos_hists->stats.nr_non_filtered_samples; 295 + nr_events += pos_hists->stats.total_non_filtered_period; 301 296 } else { 302 - nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 303 - nr_events += pos->hists.stats.total_period; 297 + nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE]; 298 + nr_events += pos_hists->stats.total_period; 304 299 } 305 300 } 306 301 } ··· 327 318 struct perf_evsel *pos; 328 319 329 320 evlist__for_each(evlist, pos) { 330 - struct hists *hists = &pos->hists; 321 + struct hists *hists = evsel__hists(pos); 331 322 const char *evname = perf_evsel__name(pos); 332 323 333 324 if (symbol_conf.event_group && ··· 436 427 ui_progress__init(&prog, rep->nr_entries, "Merging related events..."); 437 428 438 429 evlist__for_each(rep->session->evlist, pos) { 439 - struct hists *hists = &pos->hists; 430 + struct hists *hists = evsel__hists(pos); 440 431 441 432 if (pos->idx == 0) 442 433 hists->symbol_filter_str = rep->symbol_filter_str; ··· 446 437 /* Non-group events are considered as leader */ 447 438 if (symbol_conf.event_group && 448 439 !perf_evsel__is_group_leader(pos)) { 449 - struct hists *leader_hists = &pos->leader->hists; 440 + struct hists *leader_hists = evsel__hists(pos->leader); 450 441 451 442 hists__match(leader_hists, hists); 452 443 hists__link(leader_hists, hists); ··· 494 485 495 486 if (dump_trace) { 496 487 perf_session__fprintf_nr_events(session, stdout); 488 + perf_evlist__fprintf_nr_events(session->evlist, stdout); 497 489 return 0; 498 490 } 499 491 } ··· 510 500 } 511 501 512 502 evlist__for_each(session->evlist, pos) 513 - hists__output_resort(&pos->hists); 503 + hists__output_resort(evsel__hists(pos)); 514 504 515 505 return report__browse_hists(rep); 516 506 } ··· 575 565 struct stat st; 576 566 bool has_br_stack = false; 577 567 int branch_mode = -1; 578 - int ret = -1; 579 568 char callchain_default_opt[] = "fractal,0.5,callee"; 580 569 const char * const report_usage[] = { 581 570 "perf report [<options>]", ··· 701 692 struct perf_data_file file = { 702 693 .mode = PERF_DATA_MODE_READ, 703 694 }; 695 + int ret = hists__init(); 696 + 697 + if (ret < 0) 698 + return ret; 704 699 705 700 perf_config(report__config, &report); 706 701
-3
tools/perf/builtin-sched.c
··· 1431 1431 { 1432 1432 int err = 0; 1433 1433 1434 - evsel->hists.stats.total_period += sample->period; 1435 - hists__inc_nr_samples(&evsel->hists, true); 1436 - 1437 1434 if (evsel->handler != NULL) { 1438 1435 tracepoint_handler f = evsel->handler; 1439 1436 err = f(tool, evsel, sample, machine);
+17 -5
tools/perf/builtin-script.c
··· 44 44 PERF_OUTPUT_ADDR = 1U << 10, 45 45 PERF_OUTPUT_SYMOFFSET = 1U << 11, 46 46 PERF_OUTPUT_SRCLINE = 1U << 12, 47 + PERF_OUTPUT_PERIOD = 1U << 13, 47 48 }; 48 49 49 50 struct output_option { ··· 64 63 {.str = "addr", .field = PERF_OUTPUT_ADDR}, 65 64 {.str = "symoff", .field = PERF_OUTPUT_SYMOFFSET}, 66 65 {.str = "srcline", .field = PERF_OUTPUT_SRCLINE}, 66 + {.str = "period", .field = PERF_OUTPUT_PERIOD}, 67 67 }; 68 68 69 69 /* default set to maintain compatibility with current format */ ··· 82 80 .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | 83 81 PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | 84 82 PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | 85 - PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, 83 + PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | 84 + PERF_OUTPUT_PERIOD, 86 85 87 86 .invalid_fields = PERF_OUTPUT_TRACE, 88 87 }, ··· 94 91 .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | 95 92 PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | 96 93 PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | 97 - PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, 94 + PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | 95 + PERF_OUTPUT_PERIOD, 98 96 99 97 .invalid_fields = PERF_OUTPUT_TRACE, 100 98 }, ··· 114 110 .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | 115 111 PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | 116 112 PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | 117 - PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, 113 + PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | 114 + PERF_OUTPUT_PERIOD, 118 115 119 116 .invalid_fields = PERF_OUTPUT_TRACE, 120 117 }, ··· 232 227 if (PRINT_FIELD(CPU) && 233 228 perf_evsel__check_stype(evsel, PERF_SAMPLE_CPU, "CPU", 234 229 PERF_OUTPUT_CPU)) 230 + return -EINVAL; 231 + 232 + if (PRINT_FIELD(PERIOD) && 233 + perf_evsel__check_stype(evsel, PERF_SAMPLE_PERIOD, "PERIOD", 234 + PERF_OUTPUT_PERIOD)) 235 235 return -EINVAL; 236 236 237 237 return 0; ··· 458 448 459 449 print_sample_start(sample, thread, evsel); 460 450 451 + if (PRINT_FIELD(PERIOD)) 452 + printf("%10" PRIu64 " ", sample->period); 453 + 461 454 if (PRINT_FIELD(EVNAME)) { 462 455 const char *evname = perf_evsel__name(evsel); 463 456 printf("%s: ", evname ? evname : "[unknown]"); ··· 585 572 586 573 scripting_ops->process_event(event, sample, evsel, thread, &al); 587 574 588 - evsel->hists.stats.total_period += sample->period; 589 575 return 0; 590 576 } 591 577 ··· 1556 1544 "comma separated output fields prepend with 'type:'. " 1557 1545 "Valid types: hw,sw,trace,raw. " 1558 1546 "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," 1559 - "addr,symoff", parse_output_fields), 1547 + "addr,symoff,period", parse_output_fields), 1560 1548 OPT_BOOLEAN('a', "all-cpus", &system_wide, 1561 1549 "system-wide collection from all CPUs"), 1562 1550 OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
+1
tools/perf/builtin-stat.c
··· 43 43 44 44 #include "perf.h" 45 45 #include "builtin.h" 46 + #include "util/cgroup.h" 46 47 #include "util/util.h" 47 48 #include "util/parse-options.h" 48 49 #include "util/parse-events.h"
+34 -26
tools/perf/builtin-top.c
··· 251 251 char bf[160]; 252 252 int printed = 0; 253 253 const int win_width = top->winsize.ws_col - 1; 254 + struct hists *hists = evsel__hists(top->sym_evsel); 254 255 255 256 puts(CONSOLE_CLEAR); 256 257 ··· 262 261 263 262 printf("%-*.*s\n", win_width, win_width, graph_dotted_line); 264 263 265 - if (top->sym_evsel->hists.stats.nr_lost_warned != 266 - top->sym_evsel->hists.stats.nr_events[PERF_RECORD_LOST]) { 267 - top->sym_evsel->hists.stats.nr_lost_warned = 268 - top->sym_evsel->hists.stats.nr_events[PERF_RECORD_LOST]; 264 + if (hists->stats.nr_lost_warned != 265 + hists->stats.nr_events[PERF_RECORD_LOST]) { 266 + hists->stats.nr_lost_warned = 267 + hists->stats.nr_events[PERF_RECORD_LOST]; 269 268 color_fprintf(stdout, PERF_COLOR_RED, 270 269 "WARNING: LOST %d chunks, Check IO/CPU overload", 271 - top->sym_evsel->hists.stats.nr_lost_warned); 270 + hists->stats.nr_lost_warned); 272 271 ++printed; 273 272 } 274 273 ··· 278 277 } 279 278 280 279 if (top->zero) { 281 - hists__delete_entries(&top->sym_evsel->hists); 280 + hists__delete_entries(hists); 282 281 } else { 283 - hists__decay_entries(&top->sym_evsel->hists, 284 - top->hide_user_symbols, 282 + hists__decay_entries(hists, top->hide_user_symbols, 285 283 top->hide_kernel_symbols); 286 284 } 287 285 288 - hists__collapse_resort(&top->sym_evsel->hists, NULL); 289 - hists__output_resort(&top->sym_evsel->hists); 286 + hists__collapse_resort(hists, NULL); 287 + hists__output_resort(hists); 290 288 291 - hists__output_recalc_col_len(&top->sym_evsel->hists, 292 - top->print_entries - printed); 289 + hists__output_recalc_col_len(hists, top->print_entries - printed); 293 290 putchar('\n'); 294 - hists__fprintf(&top->sym_evsel->hists, false, 295 - top->print_entries - printed, win_width, 291 + hists__fprintf(hists, false, top->print_entries - printed, win_width, 296 292 top->min_percent, stdout); 297 293 } 298 294 ··· 332 334 { 333 335 char *buf = malloc(0), *p; 334 336 struct hist_entry *syme = top->sym_filter_entry, *n, *found = NULL; 337 + struct hists *hists = evsel__hists(top->sym_evsel); 335 338 struct rb_node *next; 336 339 size_t dummy = 0; 337 340 ··· 350 351 if (p) 351 352 *p = 0; 352 353 353 - next = rb_first(&top->sym_evsel->hists.entries); 354 + next = rb_first(&hists->entries); 354 355 while (next) { 355 356 n = rb_entry(next, struct hist_entry, rb_node); 356 357 if (n->ms.sym && !strcmp(buf, n->ms.sym->name)) { ··· 537 538 static void perf_top__sort_new_samples(void *arg) 538 539 { 539 540 struct perf_top *t = arg; 541 + struct hists *hists; 542 + 540 543 perf_top__reset_sample_counters(t); 541 544 542 545 if (t->evlist->selected != NULL) 543 546 t->sym_evsel = t->evlist->selected; 544 547 548 + hists = evsel__hists(t->sym_evsel); 549 + 545 550 if (t->zero) { 546 - hists__delete_entries(&t->sym_evsel->hists); 551 + hists__delete_entries(hists); 547 552 } else { 548 - hists__decay_entries(&t->sym_evsel->hists, 549 - t->hide_user_symbols, 553 + hists__decay_entries(hists, t->hide_user_symbols, 550 554 t->hide_kernel_symbols); 551 555 } 552 556 553 - hists__collapse_resort(&t->sym_evsel->hists, NULL); 554 - hists__output_resort(&t->sym_evsel->hists); 557 + hists__collapse_resort(hists, NULL); 558 + hists__output_resort(hists); 555 559 } 556 560 557 561 static void *display_thread_tui(void *arg) ··· 575 573 * Zooming in/out UIDs. For now juse use whatever the user passed 576 574 * via --uid. 577 575 */ 578 - evlist__for_each(top->evlist, pos) 579 - pos->hists.uid_filter_str = top->record_opts.target.uid_str; 576 + evlist__for_each(top->evlist, pos) { 577 + struct hists *hists = evsel__hists(pos); 578 + hists->uid_filter_str = top->record_opts.target.uid_str; 579 + } 580 580 581 581 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent, 582 582 &top->session->header.env); ··· 772 768 } 773 769 774 770 if (al.sym == NULL || !al.sym->ignore) { 771 + struct hists *hists = evsel__hists(evsel); 775 772 struct hist_entry_iter iter = { 776 773 .add_entry_cb = hist_iter__top_callback, 777 774 }; ··· 782 777 else 783 778 iter.ops = &hist_iter_normal; 784 779 785 - pthread_mutex_lock(&evsel->hists.lock); 780 + pthread_mutex_lock(&hists->lock); 786 781 787 782 err = hist_entry_iter__add(&iter, &al, evsel, sample, 788 783 top->max_stack, top); 789 784 if (err < 0) 790 785 pr_err("Problem incrementing symbol period, skipping event\n"); 791 786 792 - pthread_mutex_unlock(&evsel->hists.lock); 787 + pthread_mutex_unlock(&hists->lock); 793 788 } 794 789 795 790 return; ··· 854 849 perf_event__process_sample(&top->tool, event, evsel, 855 850 &sample, machine); 856 851 } else if (event->header.type < PERF_RECORD_MAX) { 857 - hists__inc_nr_events(&evsel->hists, event->header.type); 852 + hists__inc_nr_events(evsel__hists(evsel), event->header.type); 858 853 machine__process_event(machine, event, &sample); 859 854 } else 860 855 ++session->stats.nr_unknown_events; ··· 1047 1042 1048 1043 int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) 1049 1044 { 1050 - int status = -1; 1051 1045 char errbuf[BUFSIZ]; 1052 1046 struct perf_top top = { 1053 1047 .count_filter = 5, ··· 1164 1160 "perf top [<options>]", 1165 1161 NULL 1166 1162 }; 1163 + int status = hists__init(); 1164 + 1165 + if (status < 0) 1166 + return status; 1167 1167 1168 1168 top.evlist = perf_evlist__new(); 1169 1169 if (top.evlist == NULL)
+8 -8
tools/perf/builtin-trace.c
··· 1189 1189 if (thread == NULL) 1190 1190 goto fail; 1191 1191 1192 - if (thread->priv == NULL) 1193 - thread->priv = thread_trace__new(); 1192 + if (thread__priv(thread) == NULL) 1193 + thread__set_priv(thread, thread_trace__new()); 1194 1194 1195 - if (thread->priv == NULL) 1195 + if (thread__priv(thread) == NULL) 1196 1196 goto fail; 1197 1197 1198 - ttrace = thread->priv; 1198 + ttrace = thread__priv(thread); 1199 1199 ++ttrace->nr_events; 1200 1200 1201 1201 return ttrace; ··· 1248 1248 1249 1249 static int trace__set_fd_pathname(struct thread *thread, int fd, const char *pathname) 1250 1250 { 1251 - struct thread_trace *ttrace = thread->priv; 1251 + struct thread_trace *ttrace = thread__priv(thread); 1252 1252 1253 1253 if (fd > ttrace->paths.max) { 1254 1254 char **npath = realloc(ttrace->paths.table, (fd + 1) * sizeof(char *)); ··· 1301 1301 static const char *thread__fd_path(struct thread *thread, int fd, 1302 1302 struct trace *trace) 1303 1303 { 1304 - struct thread_trace *ttrace = thread->priv; 1304 + struct thread_trace *ttrace = thread__priv(thread); 1305 1305 1306 1306 if (ttrace == NULL) 1307 1307 return NULL; ··· 1338 1338 { 1339 1339 int fd = arg->val; 1340 1340 size_t printed = syscall_arg__scnprintf_fd(bf, size, arg); 1341 - struct thread_trace *ttrace = arg->thread->priv; 1341 + struct thread_trace *ttrace = thread__priv(arg->thread); 1342 1342 1343 1343 if (ttrace && fd >= 0 && fd <= ttrace->paths.max) 1344 1344 zfree(&ttrace->paths.table[fd]); ··· 2381 2381 FILE *fp = data->fp; 2382 2382 size_t printed = data->printed; 2383 2383 struct trace *trace = data->trace; 2384 - struct thread_trace *ttrace = thread->priv; 2384 + struct thread_trace *ttrace = thread__priv(thread); 2385 2385 double ratio; 2386 2386 2387 2387 if (ttrace == NULL)
+5
tools/perf/tests/builtin-test.c
··· 6 6 #include <unistd.h> 7 7 #include <string.h> 8 8 #include "builtin.h" 9 + #include "hist.h" 9 10 #include "intlist.h" 10 11 #include "tests.h" 11 12 #include "debug.h" ··· 303 302 OPT_END() 304 303 }; 305 304 struct intlist *skiplist = NULL; 305 + int ret = hists__init(); 306 + 307 + if (ret < 0) 308 + return ret; 306 309 307 310 argc = parse_options(argc, argv, test_options, test_usage, 0); 308 311 if (argc >= 1 && !strcmp(argv[0], "list"))
+3
tools/perf/tests/dwarf-unwind.c
··· 9 9 #include "perf_regs.h" 10 10 #include "map.h" 11 11 #include "thread.h" 12 + #include "callchain.h" 12 13 13 14 static int mmap_handler(struct perf_tool *tool __maybe_unused, 14 15 union perf_event *event, ··· 120 119 pr_err("Could not get machine\n"); 121 120 return -1; 122 121 } 122 + 123 + callchain_param.record_mode = CALLCHAIN_DWARF; 123 124 124 125 if (init_live_machine(machine)) { 125 126 pr_err("Could not init machine\n");
+4 -4
tools/perf/tests/hists_cumulate.c
··· 245 245 static int test1(struct perf_evsel *evsel, struct machine *machine) 246 246 { 247 247 int err; 248 - struct hists *hists = &evsel->hists; 248 + struct hists *hists = evsel__hists(evsel); 249 249 /* 250 250 * expected output: 251 251 * ··· 295 295 static int test2(struct perf_evsel *evsel, struct machine *machine) 296 296 { 297 297 int err; 298 - struct hists *hists = &evsel->hists; 298 + struct hists *hists = evsel__hists(evsel); 299 299 /* 300 300 * expected output: 301 301 * ··· 442 442 static int test3(struct perf_evsel *evsel, struct machine *machine) 443 443 { 444 444 int err; 445 - struct hists *hists = &evsel->hists; 445 + struct hists *hists = evsel__hists(evsel); 446 446 /* 447 447 * expected output: 448 448 * ··· 498 498 static int test4(struct perf_evsel *evsel, struct machine *machine) 499 499 { 500 500 int err; 501 - struct hists *hists = &evsel->hists; 501 + struct hists *hists = evsel__hists(evsel); 502 502 /* 503 503 * expected output: 504 504 *
+12 -11
tools/perf/tests/hists_filter.c
··· 66 66 .ops = &hist_iter_normal, 67 67 .hide_unresolved = false, 68 68 }; 69 + struct hists *hists = evsel__hists(evsel); 69 70 70 71 /* make sure it has no filter at first */ 71 - evsel->hists.thread_filter = NULL; 72 - evsel->hists.dso_filter = NULL; 73 - evsel->hists.symbol_filter_str = NULL; 72 + hists->thread_filter = NULL; 73 + hists->dso_filter = NULL; 74 + hists->symbol_filter_str = NULL; 74 75 75 76 sample.pid = fake_samples[i].pid; 76 77 sample.tid = fake_samples[i].pid; ··· 135 134 goto out; 136 135 137 136 evlist__for_each(evlist, evsel) { 138 - struct hists *hists = &evsel->hists; 137 + struct hists *hists = evsel__hists(evsel); 139 138 140 139 hists__collapse_resort(hists, NULL); 141 140 hists__output_resort(hists); ··· 161 160 hists->stats.total_non_filtered_period); 162 161 163 162 /* now applying thread filter for 'bash' */ 164 - evsel->hists.thread_filter = fake_samples[9].thread; 163 + hists->thread_filter = fake_samples[9].thread; 165 164 hists__filter_by_thread(hists); 166 165 167 166 if (verbose > 2) { ··· 186 185 hists->stats.total_non_filtered_period == 400); 187 186 188 187 /* remove thread filter first */ 189 - evsel->hists.thread_filter = NULL; 188 + hists->thread_filter = NULL; 190 189 hists__filter_by_thread(hists); 191 190 192 191 /* now applying dso filter for 'kernel' */ 193 - evsel->hists.dso_filter = fake_samples[0].map->dso; 192 + hists->dso_filter = fake_samples[0].map->dso; 194 193 hists__filter_by_dso(hists); 195 194 196 195 if (verbose > 2) { ··· 215 214 hists->stats.total_non_filtered_period == 300); 216 215 217 216 /* remove dso filter first */ 218 - evsel->hists.dso_filter = NULL; 217 + hists->dso_filter = NULL; 219 218 hists__filter_by_dso(hists); 220 219 221 220 /* ··· 225 224 * be counted as a separate entry but the sample count and 226 225 * total period will be remained. 227 226 */ 228 - evsel->hists.symbol_filter_str = "main"; 227 + hists->symbol_filter_str = "main"; 229 228 hists__filter_by_symbol(hists); 230 229 231 230 if (verbose > 2) { ··· 250 249 hists->stats.total_non_filtered_period == 300); 251 250 252 251 /* now applying all filters at once. */ 253 - evsel->hists.thread_filter = fake_samples[1].thread; 254 - evsel->hists.dso_filter = fake_samples[1].map->dso; 252 + hists->thread_filter = fake_samples[1].thread; 253 + hists->dso_filter = fake_samples[1].map->dso; 255 254 hists__filter_by_thread(hists); 256 255 hists__filter_by_dso(hists); 257 256
+15 -8
tools/perf/tests/hists_link.c
··· 73 73 * "bash [libc] malloc" so total 9 entries will be in the tree. 74 74 */ 75 75 evlist__for_each(evlist, evsel) { 76 + struct hists *hists = evsel__hists(evsel); 77 + 76 78 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 77 79 const union perf_event event = { 78 80 .header = { ··· 89 87 &sample) < 0) 90 88 goto out; 91 89 92 - he = __hists__add_entry(&evsel->hists, &al, NULL, 90 + he = __hists__add_entry(hists, &al, NULL, 93 91 NULL, NULL, 1, 1, 0, true); 94 92 if (he == NULL) 95 93 goto out; ··· 113 111 &sample) < 0) 114 112 goto out; 115 113 116 - he = __hists__add_entry(&evsel->hists, &al, NULL, 114 + he = __hists__add_entry(hists, &al, NULL, 117 115 NULL, NULL, 1, 1, 0, true); 118 116 if (he == NULL) 119 117 goto out; ··· 273 271 int test__hists_link(void) 274 272 { 275 273 int err = -1; 274 + struct hists *hists, *first_hists; 276 275 struct machines machines; 277 276 struct machine *machine = NULL; 278 277 struct perf_evsel *evsel, *first; ··· 309 306 goto out; 310 307 311 308 evlist__for_each(evlist, evsel) { 312 - hists__collapse_resort(&evsel->hists, NULL); 309 + hists = evsel__hists(evsel); 310 + hists__collapse_resort(hists, NULL); 313 311 314 312 if (verbose > 2) 315 - print_hists_in(&evsel->hists); 313 + print_hists_in(hists); 316 314 } 317 315 318 316 first = perf_evlist__first(evlist); 319 317 evsel = perf_evlist__last(evlist); 320 318 319 + first_hists = evsel__hists(first); 320 + hists = evsel__hists(evsel); 321 + 321 322 /* match common entries */ 322 - hists__match(&first->hists, &evsel->hists); 323 - err = validate_match(&first->hists, &evsel->hists); 323 + hists__match(first_hists, hists); 324 + err = validate_match(first_hists, hists); 324 325 if (err) 325 326 goto out; 326 327 327 328 /* link common and/or dummy entries */ 328 - hists__link(&first->hists, &evsel->hists); 329 - err = validate_link(&first->hists, &evsel->hists); 329 + hists__link(first_hists, hists); 330 + err = validate_link(first_hists, hists); 330 331 if (err) 331 332 goto out; 332 333
+10 -10
tools/perf/tests/hists_output.c
··· 122 122 static int test1(struct perf_evsel *evsel, struct machine *machine) 123 123 { 124 124 int err; 125 - struct hists *hists = &evsel->hists; 125 + struct hists *hists = evsel__hists(evsel); 126 126 struct hist_entry *he; 127 127 struct rb_root *root; 128 128 struct rb_node *node; ··· 159 159 print_hists_out(hists); 160 160 } 161 161 162 - root = &evsel->hists.entries; 162 + root = &hists->entries; 163 163 node = rb_first(root); 164 164 he = rb_entry(node, struct hist_entry, rb_node); 165 165 TEST_ASSERT_VAL("Invalid hist entry", ··· 224 224 static int test2(struct perf_evsel *evsel, struct machine *machine) 225 225 { 226 226 int err; 227 - struct hists *hists = &evsel->hists; 227 + struct hists *hists = evsel__hists(evsel); 228 228 struct hist_entry *he; 229 229 struct rb_root *root; 230 230 struct rb_node *node; ··· 259 259 print_hists_out(hists); 260 260 } 261 261 262 - root = &evsel->hists.entries; 262 + root = &hists->entries; 263 263 node = rb_first(root); 264 264 he = rb_entry(node, struct hist_entry, rb_node); 265 265 TEST_ASSERT_VAL("Invalid hist entry", ··· 280 280 static int test3(struct perf_evsel *evsel, struct machine *machine) 281 281 { 282 282 int err; 283 - struct hists *hists = &evsel->hists; 283 + struct hists *hists = evsel__hists(evsel); 284 284 struct hist_entry *he; 285 285 struct rb_root *root; 286 286 struct rb_node *node; ··· 313 313 print_hists_out(hists); 314 314 } 315 315 316 - root = &evsel->hists.entries; 316 + root = &hists->entries; 317 317 node = rb_first(root); 318 318 he = rb_entry(node, struct hist_entry, rb_node); 319 319 TEST_ASSERT_VAL("Invalid hist entry", ··· 354 354 static int test4(struct perf_evsel *evsel, struct machine *machine) 355 355 { 356 356 int err; 357 - struct hists *hists = &evsel->hists; 357 + struct hists *hists = evsel__hists(evsel); 358 358 struct hist_entry *he; 359 359 struct rb_root *root; 360 360 struct rb_node *node; ··· 391 391 print_hists_out(hists); 392 392 } 393 393 394 - root = &evsel->hists.entries; 394 + root = &hists->entries; 395 395 node = rb_first(root); 396 396 he = rb_entry(node, struct hist_entry, rb_node); 397 397 TEST_ASSERT_VAL("Invalid hist entry", ··· 456 456 static int test5(struct perf_evsel *evsel, struct machine *machine) 457 457 { 458 458 int err; 459 - struct hists *hists = &evsel->hists; 459 + struct hists *hists = evsel__hists(evsel); 460 460 struct hist_entry *he; 461 461 struct rb_root *root; 462 462 struct rb_node *node; ··· 494 494 print_hists_out(hists); 495 495 } 496 496 497 - root = &evsel->hists.entries; 497 + root = &hists->entries; 498 498 node = rb_first(root); 499 499 he = rb_entry(node, struct hist_entry, rb_node); 500 500
+36
tools/perf/tests/parse-events.c
··· 457 457 return 0; 458 458 } 459 459 460 + 461 + static int test__checkevent_pmu_events_mix(struct perf_evlist *evlist) 462 + { 463 + struct perf_evsel *evsel = perf_evlist__first(evlist); 464 + 465 + /* pmu-event:u */ 466 + TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 467 + TEST_ASSERT_VAL("wrong exclude_user", 468 + !evsel->attr.exclude_user); 469 + TEST_ASSERT_VAL("wrong exclude_kernel", 470 + evsel->attr.exclude_kernel); 471 + TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); 472 + TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); 473 + TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); 474 + 475 + /* cpu/pmu-event/u*/ 476 + evsel = perf_evsel__next(evsel); 477 + TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); 478 + TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 479 + TEST_ASSERT_VAL("wrong exclude_user", 480 + !evsel->attr.exclude_user); 481 + TEST_ASSERT_VAL("wrong exclude_kernel", 482 + evsel->attr.exclude_kernel); 483 + TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); 484 + TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); 485 + TEST_ASSERT_VAL("wrong pinned", !evsel->attr.pinned); 486 + 487 + return 0; 488 + } 489 + 460 490 static int test__checkterms_simple(struct list_head *terms) 461 491 { 462 492 struct parse_events_term *term; ··· 1583 1553 e.name = name; 1584 1554 e.check = test__checkevent_pmu_events; 1585 1555 1556 + ret = test_event(&e); 1557 + if (ret) 1558 + break; 1559 + snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); 1560 + e.name = name; 1561 + e.check = test__checkevent_pmu_events_mix; 1586 1562 ret = test_event(&e); 1587 1563 #undef MAX_NAME 1588 1564 }
+1
tools/perf/ui/browsers/header.c
··· 1 1 #include "util/cache.h" 2 2 #include "util/debug.h" 3 3 #include "ui/browser.h" 4 + #include "ui/keysyms.h" 4 5 #include "ui/ui.h" 5 6 #include "ui/util.h" 6 7 #include "ui/libslang.h"
+34 -18
tools/perf/ui/browsers/hists.c
··· 35 35 36 36 extern void hist_browser__init_hpp(void); 37 37 38 - static int hists__browser_title(struct hists *hists, char *bf, size_t size); 38 + static int hists__browser_title(struct hists *hists, 39 + struct hist_browser_timer *hbt, 40 + char *bf, size_t size); 39 41 static void hist_browser__update_nr_entries(struct hist_browser *hb); 40 42 41 43 static struct rb_node *hists__filter_entries(struct rb_node *nd, ··· 392 390 browser->b.entries = &browser->hists->entries; 393 391 browser->b.nr_entries = hist_browser__nr_entries(browser); 394 392 395 - hists__browser_title(browser->hists, title, sizeof(title)); 393 + hists__browser_title(browser->hists, hbt, title, sizeof(title)); 396 394 397 395 if (ui_browser__show(&browser->b, title, 398 396 "Press '?' for help on key bindings") < 0) ··· 419 417 ui_browser__warn_lost_events(&browser->b); 420 418 } 421 419 422 - hists__browser_title(browser->hists, title, sizeof(title)); 420 + hists__browser_title(browser->hists, 421 + hbt, title, sizeof(title)); 423 422 ui_browser__show_title(&browser->b, title); 424 423 continue; 425 424 } ··· 1207 1204 return browser->he_selection->thread; 1208 1205 } 1209 1206 1210 - static int hists__browser_title(struct hists *hists, char *bf, size_t size) 1207 + /* Check whether the browser is for 'top' or 'report' */ 1208 + static inline bool is_report_browser(void *timer) 1209 + { 1210 + return timer == NULL; 1211 + } 1212 + 1213 + static int hists__browser_title(struct hists *hists, 1214 + struct hist_browser_timer *hbt, 1215 + char *bf, size_t size) 1211 1216 { 1212 1217 char unit; 1213 1218 int printed; ··· 1240 1229 ev_name = buf; 1241 1230 1242 1231 for_each_group_member(pos, evsel) { 1232 + struct hists *pos_hists = evsel__hists(pos); 1233 + 1243 1234 if (symbol_conf.filter_relative) { 1244 - nr_samples += pos->hists.stats.nr_non_filtered_samples; 1245 - nr_events += pos->hists.stats.total_non_filtered_period; 1235 + nr_samples += pos_hists->stats.nr_non_filtered_samples; 1236 + nr_events += pos_hists->stats.total_non_filtered_period; 1246 1237 } else { 1247 - nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1248 - nr_events += pos->hists.stats.total_period; 1238 + nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE]; 1239 + nr_events += pos_hists->stats.total_period; 1249 1240 } 1250 1241 } 1251 1242 } ··· 1269 1256 if (dso) 1270 1257 printed += scnprintf(bf + printed, size - printed, 1271 1258 ", DSO: %s", dso->short_name); 1259 + if (!is_report_browser(hbt)) { 1260 + struct perf_top *top = hbt->arg; 1261 + 1262 + if (top->zero) 1263 + printed += scnprintf(bf + printed, size - printed, " [z]"); 1264 + } 1265 + 1272 1266 return printed; 1273 1267 } 1274 1268 ··· 1285 1265 1286 1266 for (i = 0; i < n; ++i) 1287 1267 zfree(&options[i]); 1288 - } 1289 - 1290 - /* Check whether the browser is for 'top' or 'report' */ 1291 - static inline bool is_report_browser(void *timer) 1292 - { 1293 - return timer == NULL; 1294 1268 } 1295 1269 1296 1270 /* ··· 1401 1387 float min_pcnt, 1402 1388 struct perf_session_env *env) 1403 1389 { 1404 - struct hists *hists = &evsel->hists; 1390 + struct hists *hists = evsel__hists(evsel); 1405 1391 struct hist_browser *browser = hist_browser__new(hists); 1406 1392 struct branch_info *bi; 1407 1393 struct pstack *fstack; ··· 1816 1802 struct perf_evsel_menu *menu = container_of(browser, 1817 1803 struct perf_evsel_menu, b); 1818 1804 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); 1805 + struct hists *hists = evsel__hists(evsel); 1819 1806 bool current_entry = ui_browser__is_current_entry(browser, row); 1820 - unsigned long nr_events = evsel->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1807 + unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 1821 1808 const char *ev_name = perf_evsel__name(evsel); 1822 1809 char bf[256], unit; 1823 1810 const char *warn = " "; ··· 1833 1818 ev_name = perf_evsel__group_name(evsel); 1834 1819 1835 1820 for_each_group_member(pos, evsel) { 1836 - nr_events += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1821 + struct hists *pos_hists = evsel__hists(pos); 1822 + nr_events += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE]; 1837 1823 } 1838 1824 } 1839 1825 ··· 1843 1827 unit, unit == ' ' ? "" : " ", ev_name); 1844 1828 slsmg_printf("%s", bf); 1845 1829 1846 - nr_events = evsel->hists.stats.nr_events[PERF_RECORD_LOST]; 1830 + nr_events = hists->stats.nr_events[PERF_RECORD_LOST]; 1847 1831 if (nr_events != 0) { 1848 1832 menu->lost_events = true; 1849 1833 if (!current_entry)
+1 -1
tools/perf/ui/gtk/hists.c
··· 319 319 gtk_container_add(GTK_CONTAINER(window), vbox); 320 320 321 321 evlist__for_each(evlist, pos) { 322 - struct hists *hists = &pos->hists; 322 + struct hists *hists = evsel__hists(pos); 323 323 const char *evname = perf_evsel__name(pos); 324 324 GtkWidget *scrolled_window; 325 325 GtkWidget *tab_label;
+4 -4
tools/perf/util/annotate.c
··· 478 478 479 479 pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); 480 480 481 - if (addr < sym->start || addr > sym->end) 481 + if (addr < sym->start || addr >= sym->end) 482 482 return -ERANGE; 483 483 484 484 offset = addr - sym->start; ··· 836 836 end = map__rip_2objdump(map, sym->end); 837 837 838 838 offset = line_ip - start; 839 - if ((u64)line_ip < start || (u64)line_ip > end) 839 + if ((u64)line_ip < start || (u64)line_ip >= end) 840 840 offset = -1; 841 841 else 842 842 parsed_line = tmp2 + 1; ··· 966 966 kce.kcore_filename = symfs_filename; 967 967 kce.addr = map__rip_2objdump(map, sym->start); 968 968 kce.offs = sym->start; 969 - kce.len = sym->end + 1 - sym->start; 969 + kce.len = sym->end - sym->start; 970 970 if (!kcore_extract__create(&kce)) { 971 971 delete_extract = true; 972 972 strlcpy(symfs_filename, kce.extract_filename, ··· 987 987 disassembler_style ? "-M " : "", 988 988 disassembler_style ? disassembler_style : "", 989 989 map__rip_2objdump(map, sym->start), 990 - map__rip_2objdump(map, sym->end+1), 990 + map__rip_2objdump(map, sym->end), 991 991 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw", 992 992 symbol_conf.annotate_src ? "-S" : "", 993 993 symfs_filename, filename);
+2
tools/perf/util/callchain.h
··· 65 65 enum chain_key key; 66 66 }; 67 67 68 + extern struct callchain_param callchain_param; 69 + 68 70 struct callchain_list { 69 71 u64 ip; 70 72 struct map_symbol ms;
+26
tools/perf/util/event.h
··· 190 190 PERF_RECORD_HEADER_MAX 191 191 }; 192 192 193 + /* 194 + * The kernel collects the number of events it couldn't send in a stretch and 195 + * when possible sends this number in a PERF_RECORD_LOST event. The number of 196 + * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while 197 + * total_lost tells exactly how many events the kernel in fact lost, i.e. it is 198 + * the sum of all struct lost_event.lost fields reported. 199 + * 200 + * The total_period is needed because by default auto-freq is used, so 201 + * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get 202 + * the total number of low level events, it is necessary to to sum all struct 203 + * sample_event.period and stash the result in total_period. 204 + */ 205 + struct events_stats { 206 + u64 total_period; 207 + u64 total_non_filtered_period; 208 + u64 total_lost; 209 + u64 total_invalid_chains; 210 + u32 nr_events[PERF_RECORD_HEADER_MAX]; 211 + u32 nr_non_filtered_samples; 212 + u32 nr_lost_warned; 213 + u32 nr_unknown_events; 214 + u32 nr_invalid_chains; 215 + u32 nr_unknown_id; 216 + u32 nr_unprocessable_samples; 217 + }; 218 + 193 219 struct attr_event { 194 220 struct perf_event_header header; 195 221 struct perf_event_attr attr;
+48 -1
tools/perf/util/evlist.c
··· 1003 1003 1004 1004 out_delete_threads: 1005 1005 thread_map__delete(evlist->threads); 1006 + evlist->threads = NULL; 1006 1007 return -1; 1007 1008 } 1008 1009 ··· 1176 1175 } 1177 1176 } 1178 1177 1178 + static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) 1179 + { 1180 + int err = -ENOMEM; 1181 + 1182 + /* 1183 + * Try reading /sys/devices/system/cpu/online to get 1184 + * an all cpus map. 1185 + * 1186 + * FIXME: -ENOMEM is the best we can do here, the cpu_map 1187 + * code needs an overhaul to properly forward the 1188 + * error, and we may not want to do that fallback to a 1189 + * default cpu identity map :-\ 1190 + */ 1191 + evlist->cpus = cpu_map__new(NULL); 1192 + if (evlist->cpus == NULL) 1193 + goto out; 1194 + 1195 + evlist->threads = thread_map__new_dummy(); 1196 + if (evlist->threads == NULL) 1197 + goto out_free_cpus; 1198 + 1199 + err = 0; 1200 + out: 1201 + return err; 1202 + out_free_cpus: 1203 + cpu_map__delete(evlist->cpus); 1204 + evlist->cpus = NULL; 1205 + goto out; 1206 + } 1207 + 1179 1208 int perf_evlist__open(struct perf_evlist *evlist) 1180 1209 { 1181 1210 struct perf_evsel *evsel; 1182 1211 int err; 1212 + 1213 + /* 1214 + * Default: one fd per CPU, all threads, aka systemwide 1215 + * as sys_perf_event_open(cpu = -1, thread = -1) is EINVAL 1216 + */ 1217 + if (evlist->threads == NULL && evlist->cpus == NULL) { 1218 + err = perf_evlist__create_syswide_maps(evlist); 1219 + if (err < 0) 1220 + goto out_err; 1221 + } 1183 1222 1184 1223 perf_evlist__update_id_pos(evlist); 1185 1224 ··· 1317 1276 sigaction(SIGUSR1, &act, NULL); 1318 1277 } 1319 1278 1320 - if (target__none(target)) 1279 + if (target__none(target)) { 1280 + if (evlist->threads == NULL) { 1281 + fprintf(stderr, "FATAL: evlist->threads need to be set at this point (%s:%d).\n", 1282 + __func__, __LINE__); 1283 + goto out_close_pipes; 1284 + } 1321 1285 evlist->threads->map[0] = evlist->workload.pid; 1286 + } 1322 1287 1323 1288 close(child_ready_pipe[1]); 1324 1289 close(go_pipe[0]);
+2
tools/perf/util/evlist.h
··· 117 117 void *ucontext)); 118 118 int perf_evlist__start_workload(struct perf_evlist *evlist); 119 119 120 + struct option; 121 + 120 122 int perf_evlist__parse_mmap_pages(const struct option *opt, 121 123 const char *str, 122 124 int unset);
+56 -21
tools/perf/util/evsel.c
··· 15 15 #include <linux/perf_event.h> 16 16 #include <sys/resource.h> 17 17 #include "asm/bug.h" 18 + #include "callchain.h" 19 + #include "cgroup.h" 18 20 #include "evsel.h" 19 21 #include "evlist.h" 20 22 #include "util.h" ··· 33 31 bool mmap2; 34 32 bool cloexec; 35 33 } perf_missing_features; 34 + 35 + static int perf_evsel__no_extra_init(struct perf_evsel *evsel __maybe_unused) 36 + { 37 + return 0; 38 + } 39 + 40 + static void perf_evsel__no_extra_fini(struct perf_evsel *evsel __maybe_unused) 41 + { 42 + } 43 + 44 + static struct { 45 + size_t size; 46 + int (*init)(struct perf_evsel *evsel); 47 + void (*fini)(struct perf_evsel *evsel); 48 + } perf_evsel__object = { 49 + .size = sizeof(struct perf_evsel), 50 + .init = perf_evsel__no_extra_init, 51 + .fini = perf_evsel__no_extra_fini, 52 + }; 53 + 54 + int perf_evsel__object_config(size_t object_size, 55 + int (*init)(struct perf_evsel *evsel), 56 + void (*fini)(struct perf_evsel *evsel)) 57 + { 58 + 59 + if (object_size == 0) 60 + goto set_methods; 61 + 62 + if (perf_evsel__object.size > object_size) 63 + return -EINVAL; 64 + 65 + perf_evsel__object.size = object_size; 66 + 67 + set_methods: 68 + if (init != NULL) 69 + perf_evsel__object.init = init; 70 + 71 + if (fini != NULL) 72 + perf_evsel__object.fini = fini; 73 + 74 + return 0; 75 + } 36 76 37 77 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) 38 78 ··· 160 116 evsel->is_pos = __perf_evsel__calc_is_pos(evsel->attr.sample_type); 161 117 } 162 118 163 - void hists__init(struct hists *hists) 164 - { 165 - memset(hists, 0, sizeof(*hists)); 166 - hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; 167 - hists->entries_in = &hists->entries_in_array[0]; 168 - hists->entries_collapsed = RB_ROOT; 169 - hists->entries = RB_ROOT; 170 - pthread_mutex_init(&hists->lock, NULL); 171 - } 172 - 173 119 void __perf_evsel__set_sample_bit(struct perf_evsel *evsel, 174 120 enum perf_event_sample_format bit) 175 121 { ··· 202 168 evsel->unit = ""; 203 169 evsel->scale = 1.0; 204 170 INIT_LIST_HEAD(&evsel->node); 205 - hists__init(&evsel->hists); 171 + perf_evsel__object.init(evsel); 206 172 evsel->sample_size = __perf_evsel__sample_size(attr->sample_type); 207 173 perf_evsel__calc_id_pos(evsel); 208 174 } 209 175 210 176 struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) 211 177 { 212 - struct perf_evsel *evsel = zalloc(sizeof(*evsel)); 178 + struct perf_evsel *evsel = zalloc(perf_evsel__object.size); 213 179 214 180 if (evsel != NULL) 215 181 perf_evsel__init(evsel, attr, idx); ··· 219 185 220 186 struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx) 221 187 { 222 - struct perf_evsel *evsel = zalloc(sizeof(*evsel)); 188 + struct perf_evsel *evsel = zalloc(perf_evsel__object.size); 223 189 224 190 if (evsel != NULL) { 225 191 struct perf_event_attr attr = { ··· 726 692 } 727 693 } 728 694 729 - int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) 695 + static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) 730 696 { 731 697 int cpu, thread; 732 698 ··· 814 780 return evsel->counts != NULL ? 0 : -ENOMEM; 815 781 } 816 782 817 - void perf_evsel__free_fd(struct perf_evsel *evsel) 783 + static void perf_evsel__free_fd(struct perf_evsel *evsel) 818 784 { 819 785 xyarray__delete(evsel->fd); 820 786 evsel->fd = NULL; 821 787 } 822 788 823 - void perf_evsel__free_id(struct perf_evsel *evsel) 789 + static void perf_evsel__free_id(struct perf_evsel *evsel) 824 790 { 825 791 xyarray__delete(evsel->sample_id); 826 792 evsel->sample_id = NULL; ··· 851 817 assert(list_empty(&evsel->node)); 852 818 perf_evsel__free_fd(evsel); 853 819 perf_evsel__free_id(evsel); 854 - } 855 - 856 - void perf_evsel__delete(struct perf_evsel *evsel) 857 - { 858 - perf_evsel__exit(evsel); 859 820 close_cgroup(evsel->cgrp); 860 821 zfree(&evsel->group_name); 861 822 if (evsel->tp_format) 862 823 pevent_free_format(evsel->tp_format); 863 824 zfree(&evsel->name); 825 + perf_evsel__object.fini(evsel); 826 + } 827 + 828 + void perf_evsel__delete(struct perf_evsel *evsel) 829 + { 830 + perf_evsel__exit(evsel); 864 831 free(evsel); 865 832 } 866 833
+7 -10
tools/perf/util/evsel.h
··· 7 7 #include <linux/perf_event.h> 8 8 #include <linux/types.h> 9 9 #include "xyarray.h" 10 - #include "cgroup.h" 11 - #include "hist.h" 12 10 #include "symbol.h" 13 11 14 12 struct perf_counts_values { ··· 41 43 u64 period; 42 44 }; 43 45 46 + struct cgroup_sel; 47 + 44 48 /** struct perf_evsel - event selector 45 49 * 46 50 * @name - Can be set to retain the original event name passed by the user, ··· 66 66 struct perf_counts *prev_raw_counts; 67 67 int idx; 68 68 u32 ids; 69 - struct hists hists; 70 69 char *name; 71 70 double scale; 72 71 const char *unit; ··· 99 100 u32 val32[2]; 100 101 }; 101 102 102 - #define hists_to_evsel(h) container_of(h, struct perf_evsel, hists) 103 - 104 103 struct cpu_map; 104 + struct target; 105 105 struct thread_map; 106 106 struct perf_evlist; 107 107 struct record_opts; 108 + 109 + int perf_evsel__object_config(size_t object_size, 110 + int (*init)(struct perf_evsel *evsel), 111 + void (*fini)(struct perf_evsel *evsel)); 108 112 109 113 struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); 110 114 ··· 155 153 const char *perf_evsel__group_name(struct perf_evsel *evsel); 156 154 int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size); 157 155 158 - int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); 159 156 int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); 160 157 int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus); 161 158 void perf_evsel__reset_counts(struct perf_evsel *evsel, int ncpus); 162 - void perf_evsel__free_fd(struct perf_evsel *evsel); 163 - void perf_evsel__free_id(struct perf_evsel *evsel); 164 159 void perf_evsel__free_counts(struct perf_evsel *evsel); 165 160 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); 166 161 ··· 279 280 { 280 281 return __perf_evsel__read(evsel, ncpus, nthreads, true); 281 282 } 282 - 283 - void hists__init(struct hists *hists); 284 283 285 284 int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, 286 285 struct perf_sample *sample);
+57 -16
tools/perf/util/hist.c
··· 3 3 #include "hist.h" 4 4 #include "session.h" 5 5 #include "sort.h" 6 + #include "evlist.h" 6 7 #include "evsel.h" 7 8 #include "annotate.h" 8 9 #include <math.h> ··· 14 13 struct hist_entry *he); 15 14 static bool hists__filter_entry_by_symbol(struct hists *hists, 16 15 struct hist_entry *he); 17 - 18 - struct callchain_param callchain_param = { 19 - .mode = CHAIN_GRAPH_REL, 20 - .min_percent = 0.5, 21 - .order = ORDER_CALLEE, 22 - .key = CCKEY_FUNCTION 23 - }; 24 16 25 17 u16 hists__col_len(struct hists *hists, enum hist_column col) 26 18 { ··· 510 516 { 511 517 u64 cost; 512 518 struct mem_info *mi = iter->priv; 519 + struct hists *hists = evsel__hists(iter->evsel); 513 520 struct hist_entry *he; 514 521 515 522 if (mi == NULL) ··· 527 532 * and this is indirectly achieved by passing period=weight here 528 533 * and the he_stat__add_period() function. 529 534 */ 530 - he = __hists__add_entry(&iter->evsel->hists, al, iter->parent, NULL, mi, 535 + he = __hists__add_entry(hists, al, iter->parent, NULL, mi, 531 536 cost, cost, 0, true); 532 537 if (!he) 533 538 return -ENOMEM; ··· 541 546 struct addr_location *al __maybe_unused) 542 547 { 543 548 struct perf_evsel *evsel = iter->evsel; 549 + struct hists *hists = evsel__hists(evsel); 544 550 struct hist_entry *he = iter->he; 545 551 int err = -EINVAL; 546 552 547 553 if (he == NULL) 548 554 goto out; 549 555 550 - hists__inc_nr_samples(&evsel->hists, he->filtered); 556 + hists__inc_nr_samples(hists, he->filtered); 551 557 552 558 err = hist_entry__append_callchain(he, iter->sample); 553 559 ··· 614 618 { 615 619 struct branch_info *bi; 616 620 struct perf_evsel *evsel = iter->evsel; 621 + struct hists *hists = evsel__hists(evsel); 617 622 struct hist_entry *he = NULL; 618 623 int i = iter->curr; 619 624 int err = 0; ··· 628 631 * The report shows the percentage of total branches captured 629 632 * and not events sampled. Thus we use a pseudo period of 1. 630 633 */ 631 - he = __hists__add_entry(&evsel->hists, al, iter->parent, &bi[i], NULL, 634 + he = __hists__add_entry(hists, al, iter->parent, &bi[i], NULL, 632 635 1, 1, 0, true); 633 636 if (he == NULL) 634 637 return -ENOMEM; 635 638 636 - hists__inc_nr_samples(&evsel->hists, he->filtered); 639 + hists__inc_nr_samples(hists, he->filtered); 637 640 638 641 out: 639 642 iter->he = he; ··· 665 668 struct perf_sample *sample = iter->sample; 666 669 struct hist_entry *he; 667 670 668 - he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 671 + he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, 669 672 sample->period, sample->weight, 670 673 sample->transaction, true); 671 674 if (he == NULL) ··· 688 691 689 692 iter->he = NULL; 690 693 691 - hists__inc_nr_samples(&evsel->hists, he->filtered); 694 + hists__inc_nr_samples(evsel__hists(evsel), he->filtered); 692 695 693 696 return hist_entry__append_callchain(he, sample); 694 697 } ··· 721 724 struct addr_location *al) 722 725 { 723 726 struct perf_evsel *evsel = iter->evsel; 727 + struct hists *hists = evsel__hists(evsel); 724 728 struct perf_sample *sample = iter->sample; 725 729 struct hist_entry **he_cache = iter->priv; 726 730 struct hist_entry *he; 727 731 int err = 0; 728 732 729 - he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 733 + he = __hists__add_entry(hists, al, iter->parent, NULL, NULL, 730 734 sample->period, sample->weight, 731 735 sample->transaction, true); 732 736 if (he == NULL) ··· 744 746 */ 745 747 callchain_cursor_commit(&callchain_cursor); 746 748 747 - hists__inc_nr_samples(&evsel->hists, he->filtered); 749 + hists__inc_nr_samples(hists, he->filtered); 748 750 749 751 return err; 750 752 } ··· 800 802 } 801 803 } 802 804 803 - he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 805 + he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, 804 806 sample->period, sample->weight, 805 807 sample->transaction, false); 806 808 if (he == NULL) ··· 1406 1408 return 0; 1407 1409 } 1408 1410 1411 + 1412 + size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp) 1413 + { 1414 + struct perf_evsel *pos; 1415 + size_t ret = 0; 1416 + 1417 + evlist__for_each(evlist, pos) { 1418 + ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos)); 1419 + ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp); 1420 + } 1421 + 1422 + return ret; 1423 + } 1424 + 1425 + 1409 1426 u64 hists__total_period(struct hists *hists) 1410 1427 { 1411 1428 return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period : ··· 1446 1433 return parse_filter_percentage(NULL, value, 0); 1447 1434 1448 1435 return 0; 1436 + } 1437 + 1438 + static int hists_evsel__init(struct perf_evsel *evsel) 1439 + { 1440 + struct hists *hists = evsel__hists(evsel); 1441 + 1442 + memset(hists, 0, sizeof(*hists)); 1443 + hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; 1444 + hists->entries_in = &hists->entries_in_array[0]; 1445 + hists->entries_collapsed = RB_ROOT; 1446 + hists->entries = RB_ROOT; 1447 + pthread_mutex_init(&hists->lock, NULL); 1448 + return 0; 1449 + } 1450 + 1451 + /* 1452 + * XXX We probably need a hists_evsel__exit() to free the hist_entries 1453 + * stored in the rbtree... 1454 + */ 1455 + 1456 + int hists__init(void) 1457 + { 1458 + int err = perf_evsel__object_config(sizeof(struct hists_evsel), 1459 + hists_evsel__init, NULL); 1460 + if (err) 1461 + fputs("FATAL ERROR: Couldn't setup hists class\n", stderr); 1462 + 1463 + return err; 1449 1464 }
+21 -28
tools/perf/util/hist.h
··· 4 4 #include <linux/types.h> 5 5 #include <pthread.h> 6 6 #include "callchain.h" 7 + #include "evsel.h" 7 8 #include "header.h" 8 9 #include "color.h" 9 10 #include "ui/progress.h" 10 - 11 - extern struct callchain_param callchain_param; 12 11 13 12 struct hist_entry; 14 13 struct addr_location; ··· 20 21 HIST_FILTER__SYMBOL, 21 22 HIST_FILTER__GUEST, 22 23 HIST_FILTER__HOST, 23 - }; 24 - 25 - /* 26 - * The kernel collects the number of events it couldn't send in a stretch and 27 - * when possible sends this number in a PERF_RECORD_LOST event. The number of 28 - * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while 29 - * total_lost tells exactly how many events the kernel in fact lost, i.e. it is 30 - * the sum of all struct lost_event.lost fields reported. 31 - * 32 - * The total_period is needed because by default auto-freq is used, so 33 - * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get 34 - * the total number of low level events, it is necessary to to sum all struct 35 - * sample_event.period and stash the result in total_period. 36 - */ 37 - struct events_stats { 38 - u64 total_period; 39 - u64 total_non_filtered_period; 40 - u64 total_lost; 41 - u64 total_invalid_chains; 42 - u32 nr_events[PERF_RECORD_HEADER_MAX]; 43 - u32 nr_non_filtered_samples; 44 - u32 nr_lost_warned; 45 - u32 nr_unknown_events; 46 - u32 nr_invalid_chains; 47 - u32 nr_unknown_id; 48 - u32 nr_unprocessable_samples; 49 24 }; 50 25 51 26 enum hist_column { ··· 138 165 139 166 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, 140 167 int max_cols, float min_pcnt, FILE *fp); 168 + size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp); 141 169 142 170 void hists__filter_by_dso(struct hists *hists); 143 171 void hists__filter_by_thread(struct hists *hists); ··· 158 184 159 185 void hists__match(struct hists *leader, struct hists *other); 160 186 int hists__link(struct hists *leader, struct hists *other); 187 + 188 + struct hists_evsel { 189 + struct perf_evsel evsel; 190 + struct hists hists; 191 + }; 192 + 193 + static inline struct perf_evsel *hists_to_evsel(struct hists *hists) 194 + { 195 + struct hists_evsel *hevsel = container_of(hists, struct hists_evsel, hists); 196 + return &hevsel->evsel; 197 + } 198 + 199 + static inline struct hists *evsel__hists(struct perf_evsel *evsel) 200 + { 201 + struct hists_evsel *hevsel = (struct hists_evsel *)evsel; 202 + return &hevsel->hists; 203 + } 204 + 205 + int hists__init(void); 161 206 162 207 struct perf_hpp { 163 208 char *buf;
-1
tools/perf/util/include/linux/string.h
··· 1 1 #include <string.h> 2 2 3 3 void *memdup(const void *src, size_t len); 4 - int str_append(char **s, int *len, const char *a);
+8 -2
tools/perf/util/machine.c
··· 13 13 #include <symbol/kallsyms.h> 14 14 #include "unwind.h" 15 15 16 + static void dsos__init(struct dsos *dsos) 17 + { 18 + INIT_LIST_HEAD(&dsos->head); 19 + dsos->root = RB_ROOT; 20 + } 21 + 16 22 int machine__init(struct machine *machine, const char *root_dir, pid_t pid) 17 23 { 18 24 map_groups__init(&machine->kmaps); 19 25 RB_CLEAR_NODE(&machine->rb_node); 20 - INIT_LIST_HEAD(&machine->user_dsos.head); 21 - INIT_LIST_HEAD(&machine->kernel_dsos.head); 26 + dsos__init(&machine->user_dsos); 27 + dsos__init(&machine->kernel_dsos); 22 28 23 29 machine->threads = RB_ROOT; 24 30 INIT_LIST_HEAD(&machine->dead_threads);
+4 -4
tools/perf/util/map.c
··· 556 556 557 557 int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter) 558 558 { 559 - if (ams->addr < ams->map->start || ams->addr > ams->map->end) { 559 + if (ams->addr < ams->map->start || ams->addr >= ams->map->end) { 560 560 if (ams->map->groups == NULL) 561 561 return -1; 562 562 ams->map = map_groups__find(ams->map->groups, ams->map->type, ··· 664 664 goto move_map; 665 665 } 666 666 667 - before->end = map->start - 1; 667 + before->end = map->start; 668 668 map_groups__insert(mg, before); 669 669 if (verbose >= 2) 670 670 map__fprintf(before, fp); ··· 678 678 goto move_map; 679 679 } 680 680 681 - after->start = map->end + 1; 681 + after->start = map->end; 682 682 map_groups__insert(mg, after); 683 683 if (verbose >= 2) 684 684 map__fprintf(after, fp); ··· 752 752 m = rb_entry(parent, struct map, rb_node); 753 753 if (ip < m->start) 754 754 p = &(*p)->rb_left; 755 - else if (ip > m->end) 755 + else if (ip >= m->end) 756 756 p = &(*p)->rb_right; 757 757 else 758 758 return m;
+45 -4
tools/perf/util/ordered-events.c
··· 1 1 #include <linux/list.h> 2 2 #include <linux/compiler.h> 3 + #include <linux/string.h> 3 4 #include "ordered-events.h" 4 5 #include "evlist.h" 5 6 #include "session.h" ··· 58 57 } 59 58 } 60 59 60 + static union perf_event *__dup_event(struct ordered_events *oe, 61 + union perf_event *event) 62 + { 63 + union perf_event *new_event = NULL; 64 + 65 + if (oe->cur_alloc_size < oe->max_alloc_size) { 66 + new_event = memdup(event, event->header.size); 67 + if (new_event) 68 + oe->cur_alloc_size += event->header.size; 69 + } 70 + 71 + return new_event; 72 + } 73 + 74 + static union perf_event *dup_event(struct ordered_events *oe, 75 + union perf_event *event) 76 + { 77 + return oe->copy_on_queue ? __dup_event(oe, event) : event; 78 + } 79 + 80 + static void free_dup_event(struct ordered_events *oe, union perf_event *event) 81 + { 82 + if (oe->copy_on_queue) { 83 + oe->cur_alloc_size -= event->header.size; 84 + free(event); 85 + } 86 + } 87 + 61 88 #define MAX_SAMPLE_BUFFER (64 * 1024 / sizeof(struct ordered_event)) 62 - static struct ordered_event *alloc_event(struct ordered_events *oe) 89 + static struct ordered_event *alloc_event(struct ordered_events *oe, 90 + union perf_event *event) 63 91 { 64 92 struct list_head *cache = &oe->cache; 65 93 struct ordered_event *new = NULL; 94 + union perf_event *new_event; 95 + 96 + new_event = dup_event(oe, event); 97 + if (!new_event) 98 + return NULL; 66 99 67 100 if (!list_empty(cache)) { 68 101 new = list_entry(cache->next, struct ordered_event, list); ··· 109 74 size_t size = MAX_SAMPLE_BUFFER * sizeof(*new); 110 75 111 76 oe->buffer = malloc(size); 112 - if (!oe->buffer) 77 + if (!oe->buffer) { 78 + free_dup_event(oe, new_event); 113 79 return NULL; 80 + } 114 81 115 82 pr("alloc size %" PRIu64 "B (+%zu), max %" PRIu64 "B\n", 116 83 oe->cur_alloc_size, size, oe->max_alloc_size); ··· 127 90 pr("allocation limit reached %" PRIu64 "B\n", oe->max_alloc_size); 128 91 } 129 92 93 + new->event = new_event; 130 94 return new; 131 95 } 132 96 133 97 struct ordered_event * 134 - ordered_events__new(struct ordered_events *oe, u64 timestamp) 98 + ordered_events__new(struct ordered_events *oe, u64 timestamp, 99 + union perf_event *event) 135 100 { 136 101 struct ordered_event *new; 137 102 138 - new = alloc_event(oe); 103 + new = alloc_event(oe, event); 139 104 if (new) { 140 105 new->timestamp = timestamp; 141 106 queue_event(oe, new); ··· 150 111 { 151 112 list_move(&event->list, &oe->cache); 152 113 oe->nr_events--; 114 + free_dup_event(oe, event->event); 153 115 } 154 116 155 117 static int __ordered_events__flush(struct perf_session *s, ··· 280 240 281 241 event = list_entry(oe->to_free.next, struct ordered_event, list); 282 242 list_del(&event->list); 243 + free_dup_event(oe, event->event); 283 244 free(event); 284 245 } 285 246 }
+9 -1
tools/perf/util/ordered-events.h
··· 34 34 int buffer_idx; 35 35 unsigned int nr_events; 36 36 enum oe_flush last_flush_type; 37 + bool copy_on_queue; 37 38 }; 38 39 39 - struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp); 40 + struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp, 41 + union perf_event *event); 40 42 void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event); 41 43 int ordered_events__flush(struct perf_session *s, struct perf_tool *tool, 42 44 enum oe_flush how); ··· 49 47 void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size) 50 48 { 51 49 oe->max_alloc_size = size; 50 + } 51 + 52 + static inline 53 + void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy) 54 + { 55 + oe->copy_on_queue = copy; 52 56 } 53 57 #endif /* __ORDERED_EVENTS_H */
+112 -23
tools/perf/util/parse-events.c
··· 6 6 #include "parse-options.h" 7 7 #include "parse-events.h" 8 8 #include "exec_cmd.h" 9 - #include "linux/string.h" 9 + #include "string.h" 10 10 #include "symbol.h" 11 11 #include "cache.h" 12 12 #include "header.h" ··· 29 29 extern int parse_events_debug; 30 30 #endif 31 31 int parse_events_parse(void *data, void *scanner); 32 + 33 + static struct perf_pmu_event_symbol *perf_pmu_events_list; 34 + /* 35 + * The variable indicates the number of supported pmu event symbols. 36 + * 0 means not initialized and ready to init 37 + * -1 means failed to init, don't try anymore 38 + * >0 is the number of supported pmu event symbols 39 + */ 40 + static int perf_pmu_events_list_num; 32 41 33 42 static struct event_symbol event_symbols_hw[PERF_COUNT_HW_MAX] = { 34 43 [PERF_COUNT_HW_CPU_CYCLES] = { ··· 872 863 return 0; 873 864 } 874 865 875 - static int parse_events__scanner(const char *str, void *data, int start_token); 876 - 877 - static int parse_events_fixup(int ret, const char *str, void *data, 878 - int start_token) 866 + static int 867 + comp_pmu(const void *p1, const void *p2) 879 868 { 880 - char *o = strdup(str); 881 - char *s = NULL; 882 - char *t = o; 883 - char *p; 869 + struct perf_pmu_event_symbol *pmu1 = (struct perf_pmu_event_symbol *) p1; 870 + struct perf_pmu_event_symbol *pmu2 = (struct perf_pmu_event_symbol *) p2; 871 + 872 + return strcmp(pmu1->symbol, pmu2->symbol); 873 + } 874 + 875 + static void perf_pmu__parse_cleanup(void) 876 + { 877 + if (perf_pmu_events_list_num > 0) { 878 + struct perf_pmu_event_symbol *p; 879 + int i; 880 + 881 + for (i = 0; i < perf_pmu_events_list_num; i++) { 882 + p = perf_pmu_events_list + i; 883 + free(p->symbol); 884 + } 885 + free(perf_pmu_events_list); 886 + perf_pmu_events_list = NULL; 887 + perf_pmu_events_list_num = 0; 888 + } 889 + } 890 + 891 + #define SET_SYMBOL(str, stype) \ 892 + do { \ 893 + p->symbol = str; \ 894 + if (!p->symbol) \ 895 + goto err; \ 896 + p->type = stype; \ 897 + } while (0) 898 + 899 + /* 900 + * Read the pmu events list from sysfs 901 + * Save it into perf_pmu_events_list 902 + */ 903 + static void perf_pmu__parse_init(void) 904 + { 905 + 906 + struct perf_pmu *pmu = NULL; 907 + struct perf_pmu_alias *alias; 884 908 int len = 0; 885 909 886 - if (!o) 887 - return ret; 888 - while ((p = strsep(&t, ",")) != NULL) { 889 - if (s) 890 - str_append(&s, &len, ","); 891 - str_append(&s, &len, "cpu/"); 892 - str_append(&s, &len, p); 893 - str_append(&s, &len, "/"); 910 + pmu = perf_pmu__find("cpu"); 911 + if ((pmu == NULL) || list_empty(&pmu->aliases)) { 912 + perf_pmu_events_list_num = -1; 913 + return; 894 914 } 895 - free(o); 896 - if (!s) 897 - return -ENOMEM; 898 - return parse_events__scanner(s, data, start_token); 915 + list_for_each_entry(alias, &pmu->aliases, list) { 916 + if (strchr(alias->name, '-')) 917 + len++; 918 + len++; 919 + } 920 + perf_pmu_events_list = malloc(sizeof(struct perf_pmu_event_symbol) * len); 921 + if (!perf_pmu_events_list) 922 + return; 923 + perf_pmu_events_list_num = len; 924 + 925 + len = 0; 926 + list_for_each_entry(alias, &pmu->aliases, list) { 927 + struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; 928 + char *tmp = strchr(alias->name, '-'); 929 + 930 + if (tmp != NULL) { 931 + SET_SYMBOL(strndup(alias->name, tmp - alias->name), 932 + PMU_EVENT_SYMBOL_PREFIX); 933 + p++; 934 + SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); 935 + len += 2; 936 + } else { 937 + SET_SYMBOL(strdup(alias->name), PMU_EVENT_SYMBOL); 938 + len++; 939 + } 940 + } 941 + qsort(perf_pmu_events_list, len, 942 + sizeof(struct perf_pmu_event_symbol), comp_pmu); 943 + 944 + return; 945 + err: 946 + perf_pmu__parse_cleanup(); 947 + } 948 + 949 + enum perf_pmu_event_symbol_type 950 + perf_pmu__parse_check(const char *name) 951 + { 952 + struct perf_pmu_event_symbol p, *r; 953 + 954 + /* scan kernel pmu events from sysfs if needed */ 955 + if (perf_pmu_events_list_num == 0) 956 + perf_pmu__parse_init(); 957 + /* 958 + * name "cpu" could be prefix of cpu-cycles or cpu// events. 959 + * cpu-cycles has been handled by hardcode. 960 + * So it must be cpu// events, not kernel pmu event. 961 + */ 962 + if ((perf_pmu_events_list_num <= 0) || !strcmp(name, "cpu")) 963 + return PMU_EVENT_SYMBOL_ERR; 964 + 965 + p.symbol = strdup(name); 966 + r = bsearch(&p, perf_pmu_events_list, 967 + (size_t) perf_pmu_events_list_num, 968 + sizeof(struct perf_pmu_event_symbol), comp_pmu); 969 + free(p.symbol); 970 + return r ? r->type : PMU_EVENT_SYMBOL_ERR; 899 971 } 900 972 901 973 static int parse_events__scanner(const char *str, void *data, int start_token) ··· 999 909 parse_events__flush_buffer(buffer, scanner); 1000 910 parse_events__delete_buffer(buffer, scanner); 1001 911 parse_events_lex_destroy(scanner); 1002 - if (ret && !strchr(str, '/')) 1003 - ret = parse_events_fixup(ret, str, data, start_token); 1004 912 return ret; 1005 913 } 1006 914 ··· 1033 945 int ret; 1034 946 1035 947 ret = parse_events__scanner(str, &data, PE_START_EVENTS); 948 + perf_pmu__parse_cleanup(); 1036 949 if (!ret) { 1037 950 int entries = data.idx - evlist->nr_entries; 1038 951 perf_evlist__splice_list_tail(evlist, &data.list, entries);
+14
tools/perf/util/parse-events.h
··· 35 35 36 36 #define EVENTS_HELP_MAX (128*1024) 37 37 38 + enum perf_pmu_event_symbol_type { 39 + PMU_EVENT_SYMBOL_ERR, /* not a PMU EVENT */ 40 + PMU_EVENT_SYMBOL, /* normal style PMU event */ 41 + PMU_EVENT_SYMBOL_PREFIX, /* prefix of pre-suf style event */ 42 + PMU_EVENT_SYMBOL_SUFFIX, /* suffix of pre-suf style event */ 43 + }; 44 + 45 + struct perf_pmu_event_symbol { 46 + char *symbol; 47 + enum perf_pmu_event_symbol_type type; 48 + }; 49 + 38 50 enum { 39 51 PARSE_EVENTS__TERM_TYPE_NUM, 40 52 PARSE_EVENTS__TERM_TYPE_STR, ··· 107 95 void *ptr, char *type); 108 96 int parse_events_add_pmu(struct list_head *list, int *idx, 109 97 char *pmu , struct list_head *head_config); 98 + enum perf_pmu_event_symbol_type 99 + perf_pmu__parse_check(const char *name); 110 100 void parse_events__set_leader(char *name, struct list_head *list); 111 101 void parse_events_update_lists(struct list_head *list_event, 112 102 struct list_head *list_all);
+29 -1
tools/perf/util/parse-events.l
··· 51 51 return token; 52 52 } 53 53 54 + static int pmu_str_check(yyscan_t scanner) 55 + { 56 + YYSTYPE *yylval = parse_events_get_lval(scanner); 57 + char *text = parse_events_get_text(scanner); 58 + 59 + yylval->str = strdup(text); 60 + switch (perf_pmu__parse_check(text)) { 61 + case PMU_EVENT_SYMBOL_PREFIX: 62 + return PE_PMU_EVENT_PRE; 63 + case PMU_EVENT_SYMBOL_SUFFIX: 64 + return PE_PMU_EVENT_SUF; 65 + case PMU_EVENT_SYMBOL: 66 + return PE_KERNEL_PMU_EVENT; 67 + default: 68 + return PE_NAME; 69 + } 70 + } 71 + 54 72 static int sym(yyscan_t scanner, int type, int config) 55 73 { 56 74 YYSTYPE *yylval = parse_events_get_lval(scanner); ··· 196 178 emulation-faults { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); } 197 179 dummy { return sym(yyscanner, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_DUMMY); } 198 180 181 + /* 182 + * We have to handle the kernel PMU event cycles-ct/cycles-t/mem-loads/mem-stores separately. 183 + * Because the prefix cycles is mixed up with cpu-cycles. 184 + * loads and stores are mixed up with cache event 185 + */ 186 + cycles-ct { return str(yyscanner, PE_KERNEL_PMU_EVENT); } 187 + cycles-t { return str(yyscanner, PE_KERNEL_PMU_EVENT); } 188 + mem-loads { return str(yyscanner, PE_KERNEL_PMU_EVENT); } 189 + mem-stores { return str(yyscanner, PE_KERNEL_PMU_EVENT); } 190 + 199 191 L1-dcache|l1-d|l1d|L1-data | 200 192 L1-icache|l1-i|l1i|L1-instruction | 201 193 LLC|L2 | ··· 227 199 {num_hex} { return value(yyscanner, 16); } 228 200 229 201 {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } 230 - {name} { return str(yyscanner, PE_NAME); } 202 + {name} { return pmu_str_check(yyscanner); } 231 203 "/" { BEGIN(config); return '/'; } 232 204 - { return '-'; } 233 205 , { BEGIN(event); return ','; }
+40
tools/perf/util/parse-events.y
··· 47 47 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT 48 48 %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP 49 49 %token PE_ERROR 50 + %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT 50 51 %type <num> PE_VALUE 51 52 %type <num> PE_VALUE_SYM_HW 52 53 %type <num> PE_VALUE_SYM_SW ··· 59 58 %type <str> PE_MODIFIER_EVENT 60 59 %type <str> PE_MODIFIER_BP 61 60 %type <str> PE_EVENT_NAME 61 + %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT 62 62 %type <num> value_sym 63 63 %type <head> event_config 64 64 %type <term> event_term ··· 220 218 221 219 ALLOC_LIST(list); 222 220 ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL)); 221 + $$ = list; 222 + } 223 + | 224 + PE_KERNEL_PMU_EVENT sep_dc 225 + { 226 + struct parse_events_evlist *data = _data; 227 + struct list_head *head; 228 + struct parse_events_term *term; 229 + struct list_head *list; 230 + 231 + ALLOC_LIST(head); 232 + ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, 233 + $1, 1)); 234 + list_add_tail(&term->list, head); 235 + 236 + ALLOC_LIST(list); 237 + ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); 238 + parse_events__free_terms(head); 239 + $$ = list; 240 + } 241 + | 242 + PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc 243 + { 244 + struct parse_events_evlist *data = _data; 245 + struct list_head *head; 246 + struct parse_events_term *term; 247 + struct list_head *list; 248 + char pmu_name[128]; 249 + snprintf(&pmu_name, 128, "%s-%s", $1, $3); 250 + 251 + ALLOC_LIST(head); 252 + ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, 253 + &pmu_name, 1)); 254 + list_add_tail(&term->list, head); 255 + 256 + ALLOC_LIST(list); 257 + ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); 258 + parse_events__free_terms(head); 223 259 $$ = list; 224 260 } 225 261
-10
tools/perf/util/pmu.c
··· 12 12 #include "parse-events.h" 13 13 #include "cpumap.h" 14 14 15 - #define UNIT_MAX_LEN 31 /* max length for event unit name */ 16 - 17 - struct perf_pmu_alias { 18 - char *name; 19 - struct list_head terms; /* HEAD struct parse_events_term -> list */ 20 - struct list_head list; /* ELEM */ 21 - char unit[UNIT_MAX_LEN+1]; 22 - double scale; 23 - }; 24 - 25 15 struct perf_pmu_format { 26 16 char *name; 27 17 int value;
+10
tools/perf/util/pmu.h
··· 30 30 double scale; 31 31 }; 32 32 33 + #define UNIT_MAX_LEN 31 /* max length for event unit name */ 34 + 35 + struct perf_pmu_alias { 36 + char *name; 37 + struct list_head terms; /* HEAD struct parse_events_term -> list */ 38 + struct list_head list; /* ELEM */ 39 + char unit[UNIT_MAX_LEN+1]; 40 + double scale; 41 + }; 42 + 33 43 struct perf_pmu *perf_pmu__find(const char *name); 34 44 int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, 35 45 struct list_head *head_terms);
+1
tools/perf/util/scripting-engines/trace-event-python.c
··· 28 28 29 29 #include "../../perf.h" 30 30 #include "../debug.h" 31 + #include "../callchain.h" 31 32 #include "../evsel.h" 32 33 #include "../util.h" 33 34 #include "../event.h"
+2 -26
tools/perf/util/session.c
··· 532 532 return -EINVAL; 533 533 } 534 534 535 - new = ordered_events__new(oe, timestamp); 535 + new = ordered_events__new(oe, timestamp, event); 536 536 if (!new) { 537 537 ordered_events__flush(s, tool, OE_FLUSH__HALF); 538 - new = ordered_events__new(oe, timestamp); 538 + new = ordered_events__new(oe, timestamp, event); 539 539 } 540 540 541 541 if (!new) 542 542 return -ENOMEM; 543 543 544 544 new->file_offset = file_offset; 545 - new->event = event; 546 545 return 0; 547 546 } 548 547 ··· 812 813 dump_event(session, event, file_offset, sample); 813 814 814 815 evsel = perf_evlist__id2evsel(session->evlist, sample->id); 815 - if (evsel != NULL && event->header.type != PERF_RECORD_SAMPLE) { 816 - /* 817 - * XXX We're leaving PERF_RECORD_SAMPLE unnacounted here 818 - * because the tools right now may apply filters, discarding 819 - * some of the samples. For consistency, in the future we 820 - * should have something like nr_filtered_samples and remove 821 - * the sample->period from total_sample_period, etc, KISS for 822 - * now tho. 823 - * 824 - * Also testing against NULL allows us to handle files without 825 - * attr.sample_id_all and/or without PERF_SAMPLE_ID. In the 826 - * future probably it'll be a good idea to restrict event 827 - * processing via perf_session to files with both set. 828 - */ 829 - hists__inc_nr_events(&evsel->hists, event->header.type); 830 - } 831 816 832 817 machine = perf_session__find_machine_for_cpumode(session, event, 833 818 sample); ··· 1374 1391 1375 1392 size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) 1376 1393 { 1377 - struct perf_evsel *pos; 1378 1394 size_t ret = fprintf(fp, "Aggregated stats:\n"); 1379 1395 1380 1396 ret += events_stats__fprintf(&session->stats, fp); 1381 - 1382 - evlist__for_each(session->evlist, pos) { 1383 - ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos)); 1384 - ret += events_stats__fprintf(&pos->hists.stats, fp); 1385 - } 1386 - 1387 1397 return ret; 1388 1398 } 1389 1399
-1
tools/perf/util/session.h
··· 2 2 #define __PERF_SESSION_H 3 3 4 4 #include "trace-event.h" 5 - #include "hist.h" 6 5 #include "event.h" 7 6 #include "header.h" 8 7 #include "machine.h"
+2 -2
tools/perf/util/sort.c
··· 1218 1218 hse = container_of(fmt, struct hpp_sort_entry, hpp); 1219 1219 1220 1220 if (!len) 1221 - len = hists__col_len(&evsel->hists, hse->se->se_width_idx); 1221 + len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx); 1222 1222 1223 1223 return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, fmt->name); 1224 1224 } ··· 1233 1233 hse = container_of(fmt, struct hpp_sort_entry, hpp); 1234 1234 1235 1235 if (!len) 1236 - len = hists__col_len(&evsel->hists, hse->se->se_width_idx); 1236 + len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx); 1237 1237 1238 1238 return len; 1239 1239 }
-24
tools/perf/util/string.c
··· 357 357 358 358 return p; 359 359 } 360 - 361 - /** 362 - * str_append - reallocate string and append another 363 - * @s: pointer to string pointer 364 - * @len: pointer to len (initialized) 365 - * @a: string to append. 366 - */ 367 - int str_append(char **s, int *len, const char *a) 368 - { 369 - int olen = *s ? strlen(*s) : 0; 370 - int nlen = olen + strlen(a) + 1; 371 - if (*len < nlen) { 372 - *len = *len * 2; 373 - if (*len < nlen) 374 - *len = nlen; 375 - *s = realloc(*s, *len); 376 - if (!*s) 377 - return -ENOMEM; 378 - if (olen == 0) 379 - **s = 0; 380 - } 381 - strcat(*s, a); 382 - return 0; 383 - }
+4 -4
tools/perf/util/symbol.c
··· 186 186 curr = rb_entry(nd, struct symbol, rb_node); 187 187 188 188 if (prev->end == prev->start && prev->end != curr->start) 189 - prev->end = curr->start - 1; 189 + prev->end = curr->start; 190 190 } 191 191 192 192 /* Last entry */ ··· 207 207 for (nd = rb_next(prevnd); nd; nd = rb_next(nd)) { 208 208 prev = curr; 209 209 curr = rb_entry(nd, struct map, rb_node); 210 - prev->end = curr->start - 1; 210 + prev->end = curr->start; 211 211 } 212 212 213 213 /* ··· 229 229 sym = ((void *)sym) + symbol_conf.priv_size; 230 230 231 231 sym->start = start; 232 - sym->end = len ? start + len - 1 : start; 232 + sym->end = len ? start + len : start; 233 233 sym->binding = binding; 234 234 sym->namelen = namelen - 1; 235 235 ··· 325 325 326 326 if (ip < s->start) 327 327 n = n->rb_left; 328 - else if (ip > s->end) 328 + else if (ip >= s->end) 329 329 n = n->rb_right; 330 330 else 331 331 return s;
+1 -1
tools/perf/util/symbol.h
··· 95 95 96 96 static inline size_t symbol__size(const struct symbol *sym) 97 97 { 98 - return sym->end - sym->start + 1; 98 + return sym->end - sym->start; 99 99 } 100 100 101 101 struct strlist;
+6
tools/perf/util/thread.c
··· 7 7 #include "util.h" 8 8 #include "debug.h" 9 9 #include "comm.h" 10 + #include "unwind.h" 10 11 11 12 int thread__init_map_groups(struct thread *thread, struct machine *machine) 12 13 { ··· 38 37 thread->cpu = -1; 39 38 INIT_LIST_HEAD(&thread->comm_list); 40 39 40 + if (unwind__prepare_access(thread) < 0) 41 + goto err_thread; 42 + 41 43 comm_str = malloc(32); 42 44 if (!comm_str) 43 45 goto err_thread; ··· 52 48 goto err_thread; 53 49 54 50 list_add(&comm->list, &thread->comm_list); 51 + 55 52 } 56 53 57 54 return thread; ··· 74 69 list_del(&comm->list); 75 70 comm__free(comm); 76 71 } 72 + unwind__finish_access(thread); 77 73 78 74 free(thread); 79 75 }
+13 -8
tools/perf/util/thread_map.c
··· 214 214 goto out; 215 215 } 216 216 217 + struct thread_map *thread_map__new_dummy(void) 218 + { 219 + struct thread_map *threads = malloc(sizeof(*threads) + sizeof(pid_t)); 220 + 221 + if (threads != NULL) { 222 + threads->map[0] = -1; 223 + threads->nr = 1; 224 + } 225 + return threads; 226 + } 227 + 217 228 static struct thread_map *thread_map__new_by_tid_str(const char *tid_str) 218 229 { 219 230 struct thread_map *threads = NULL, *nt; ··· 235 224 struct strlist *slist; 236 225 237 226 /* perf-stat expects threads to be generated even if tid not given */ 238 - if (!tid_str) { 239 - threads = malloc(sizeof(*threads) + sizeof(pid_t)); 240 - if (threads != NULL) { 241 - threads->map[0] = -1; 242 - threads->nr = 1; 243 - } 244 - return threads; 245 - } 227 + if (!tid_str) 228 + return thread_map__new_dummy(); 246 229 247 230 slist = strlist__new(false, tid_str); 248 231 if (!slist)
+1
tools/perf/util/thread_map.h
··· 9 9 pid_t map[]; 10 10 }; 11 11 12 + struct thread_map *thread_map__new_dummy(void); 12 13 struct thread_map *thread_map__new_by_pid(pid_t pid); 13 14 struct thread_map *thread_map__new_by_tid(pid_t tid); 14 15 struct thread_map *thread_map__new_by_uid(uid_t uid);
+33 -6
tools/perf/util/unwind-libunwind.c
··· 24 24 #include <linux/list.h> 25 25 #include <libunwind.h> 26 26 #include <libunwind-ptrace.h> 27 + #include "callchain.h" 27 28 #include "thread.h" 28 29 #include "session.h" 29 30 #include "perf_regs.h" ··· 526 525 .get_proc_name = get_proc_name, 527 526 }; 528 527 528 + int unwind__prepare_access(struct thread *thread) 529 + { 530 + unw_addr_space_t addr_space; 531 + 532 + if (callchain_param.record_mode != CALLCHAIN_DWARF) 533 + return 0; 534 + 535 + addr_space = unw_create_addr_space(&accessors, 0); 536 + if (!addr_space) { 537 + pr_err("unwind: Can't create unwind address space.\n"); 538 + return -ENOMEM; 539 + } 540 + 541 + thread__set_priv(thread, addr_space); 542 + 543 + return 0; 544 + } 545 + 546 + void unwind__finish_access(struct thread *thread) 547 + { 548 + unw_addr_space_t addr_space; 549 + 550 + if (callchain_param.record_mode != CALLCHAIN_DWARF) 551 + return; 552 + 553 + addr_space = thread__priv(thread); 554 + unw_destroy_addr_space(addr_space); 555 + } 556 + 529 557 static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, 530 558 void *arg, int max_stack) 531 559 { ··· 562 532 unw_cursor_t c; 563 533 int ret; 564 534 565 - addr_space = unw_create_addr_space(&accessors, 0); 566 - if (!addr_space) { 567 - pr_err("unwind: Can't create unwind address space.\n"); 568 - return -ENOMEM; 569 - } 535 + addr_space = thread__priv(ui->thread); 536 + if (addr_space == NULL) 537 + return -1; 570 538 571 539 ret = unw_init_remote(&c, addr_space, ui); 572 540 if (ret) ··· 577 549 ret = ip ? entry(ip, ui->thread, ui->machine, cb, arg) : 0; 578 550 } 579 551 580 - unw_destroy_addr_space(addr_space); 581 552 return ret; 582 553 } 583 554
+17
tools/perf/util/unwind.h
··· 4 4 #include <linux/types.h> 5 5 #include "event.h" 6 6 #include "symbol.h" 7 + #include "thread.h" 7 8 8 9 struct unwind_entry { 9 10 struct map *map; ··· 22 21 /* libunwind specific */ 23 22 #ifdef HAVE_LIBUNWIND_SUPPORT 24 23 int libunwind__arch_reg_id(int regnum); 24 + int unwind__prepare_access(struct thread *thread); 25 + void unwind__finish_access(struct thread *thread); 26 + #else 27 + static inline int unwind__prepare_access(struct thread *thread __maybe_unused) 28 + { 29 + return 0; 30 + } 31 + 32 + static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} 25 33 #endif 26 34 #else 27 35 static inline int ··· 43 33 { 44 34 return 0; 45 35 } 36 + 37 + static inline int unwind__prepare_access(struct thread *thread __maybe_unused) 38 + { 39 + return 0; 40 + } 41 + 42 + static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} 46 43 #endif /* HAVE_DWARF_UNWIND_SUPPORT */ 47 44 #endif /* __UNWIND_H */
+8
tools/perf/util/util.c
··· 14 14 #include <byteswap.h> 15 15 #include <linux/kernel.h> 16 16 #include <unistd.h> 17 + #include "callchain.h" 18 + 19 + struct callchain_param callchain_param = { 20 + .mode = CHAIN_GRAPH_REL, 21 + .min_percent = 0.5, 22 + .order = ORDER_CALLEE, 23 + .key = CCKEY_FUNCTION 24 + }; 17 25 18 26 /* 19 27 * XXX We need to find a better place for these things...