File Index
Files and directories
Sign in
FILE

auxtrace.h

File preview with syntax highlighting.

linux-6.19.14/tools/perf/util/auxtrace.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * auxtrace.h: AUX area trace support
  4 * Copyright (c) 2013-2015, Intel Corporation.
  5 */
  6
  7#ifndef __PERF_AUXTRACE_H
  8#define __PERF_AUXTRACE_H
  9
 10#include <sys/types.h>
 11#include <stdio.h> // FILE
 12#include <linux/perf_event.h>
 13#include <linux/types.h>
 14#include <asm/barrier.h>
 15#include <perf/cpumap.h>
 16
 17union perf_event;
 18struct perf_session;
 19struct evlist;
 20struct evsel;
 21struct perf_env;
 22struct perf_tool;
 23struct mmap;
 24struct perf_sample;
 25struct option;
 26struct record_opts;
 27struct perf_record_auxtrace_error;
 28struct perf_record_auxtrace_info;
 29struct events_stats;
 30struct perf_pmu;
 31
 32enum auxtrace_error_type {
 33       PERF_AUXTRACE_ERROR_ITRACE  = 1,
 34       PERF_AUXTRACE_ERROR_MAX
 35};
 36
 37/* Auxtrace records must have the same alignment as perf event records */
 38#define PERF_AUXTRACE_RECORD_ALIGNMENT 8
 39
 40enum auxtrace_type {
 41	PERF_AUXTRACE_UNKNOWN,
 42	PERF_AUXTRACE_INTEL_PT,
 43	PERF_AUXTRACE_INTEL_BTS,
 44	PERF_AUXTRACE_CS_ETM,
 45	PERF_AUXTRACE_ARM_SPE,
 46	PERF_AUXTRACE_S390_CPUMSF,
 47	PERF_AUXTRACE_HISI_PTT,
 48	PERF_AUXTRACE_VPA_DTL,
 49};
 50
 51enum itrace_period_type {
 52	PERF_ITRACE_PERIOD_INSTRUCTIONS,
 53	PERF_ITRACE_PERIOD_TICKS,
 54	PERF_ITRACE_PERIOD_NANOSECS,
 55};
 56
 57#define AUXTRACE_ERR_FLG_OVERFLOW	(1 << ('o' - 'a'))
 58#define AUXTRACE_ERR_FLG_DATA_LOST	(1 << ('l' - 'a'))
 59
 60#define AUXTRACE_LOG_FLG_ALL_PERF_EVTS	(1 << ('a' - 'a'))
 61#define AUXTRACE_LOG_FLG_ON_ERROR	(1 << ('e' - 'a'))
 62#define AUXTRACE_LOG_FLG_USE_STDOUT	(1 << ('o' - 'a'))
 63
 64/**
 65 * struct itrace_synth_opts - AUX area tracing synthesis options.
 66 * @set: indicates whether or not options have been set
 67 * @default_no_sample: Default to no sampling.
 68 * @inject: indicates the event (not just the sample) must be fully synthesized
 69 *          because 'perf inject' will write it out
 70 * @instructions: whether to synthesize 'instructions' events
 71 * @cycles: whether to synthesize 'cycles' events
 72 *          (not fully accurate, since CYC packets are only emitted
 73 *          together with other events, such as branches)
 74 * @branches: whether to synthesize 'branches' events
 75 * @transactions: whether to synthesize events for transactions
 76 * @ptwrites: whether to synthesize events for ptwrites
 77 * @pwr_events: whether to synthesize power events
 78 * @other_events: whether to synthesize other events recorded due to the use of
 79 *                aux_output
 80 * @intr_events: whether to synthesize interrupt events
 81 * @errors: whether to synthesize decoder error events
 82 * @dont_decode: whether to skip decoding entirely
 83 * @log: write a decoding log
 84 * @calls: limit branch samples to calls (can be combined with @returns)
 85 * @returns: limit branch samples to returns (can be combined with @calls)
 86 * @callchain: add callchain to 'instructions' events
 87 * @add_callchain: add callchain to existing event records
 88 * @thread_stack: feed branches to the thread_stack
 89 * @last_branch: add branch context to 'instruction' events
 90 * @add_last_branch: add branch context to existing event records
 91 * @approx_ipc: approximate IPC
 92 * @flc: whether to synthesize first level cache events
 93 * @llc: whether to synthesize last level cache events
 94 * @tlb: whether to synthesize TLB events
 95 * @remote_access: whether to synthesize remote access events
 96 * @mem: whether to synthesize memory events
 97 * @timeless_decoding: prefer "timeless" decoding i.e. ignore timestamps
 98 * @use_timestamp: use the timestamp trace as kernel time
 99 * @vm_time_correlation: perform VM Time Correlation
100 * @vm_tm_corr_dry_run: VM Time Correlation dry-run
101 * @vm_tm_corr_args:  VM Time Correlation implementation-specific arguments
102 * @callchain_sz: maximum callchain size
103 * @last_branch_sz: branch context size
104 * @period: 'instructions' events period
105 * @period_type: 'instructions' events period type
106 * @initial_skip: skip N events at the beginning.
107 * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all
108 * @ptime_range: time intervals to trace or NULL
109 * @range_num: number of time intervals to trace
110 * @error_plus_flags: flags to affect what errors are reported
111 * @error_minus_flags: flags to affect what errors are reported
112 * @log_plus_flags: flags to affect what is logged
113 * @log_minus_flags: flags to affect what is logged
114 * @quick: quicker (less detailed) decoding
115 * @log_on_error_size: size of log to keep for outputting log only on errors
116 */
117struct itrace_synth_opts {
118	bool			set;
119	bool			default_no_sample;
120	bool			inject;
121	bool			instructions;
122	bool			cycles;
123	bool			branches;
124	bool			transactions;
125	bool			ptwrites;
126	bool			pwr_events;
127	bool			other_events;
128	bool			intr_events;
129	bool			errors;
130	bool			dont_decode;
131	bool			log;
132	bool			calls;
133	bool			returns;
134	bool			callchain;
135	bool			add_callchain;
136	bool			thread_stack;
137	bool			last_branch;
138	bool			add_last_branch;
139	bool			approx_ipc;
140	bool			flc;
141	bool			llc;
142	bool			tlb;
143	bool			remote_access;
144	bool			mem;
145	bool			timeless_decoding;
146	bool			use_timestamp;
147	bool			vm_time_correlation;
148	bool			vm_tm_corr_dry_run;
149	char			*vm_tm_corr_args;
150	unsigned int		callchain_sz;
151	unsigned int		last_branch_sz;
152	unsigned long long	period;
153	enum itrace_period_type	period_type;
154	unsigned long		initial_skip;
155	unsigned long		*cpu_bitmap;
156	struct perf_time_interval *ptime_range;
157	int			range_num;
158	unsigned int		error_plus_flags;
159	unsigned int		error_minus_flags;
160	unsigned int		log_plus_flags;
161	unsigned int		log_minus_flags;
162	unsigned int		quick;
163	unsigned int		log_on_error_size;
164};
165
166/**
167 * struct auxtrace_index_entry - indexes a AUX area tracing event within a
168 *                               perf.data file.
169 * @file_offset: offset within the perf.data file
170 * @sz: size of the event
171 */
172struct auxtrace_index_entry {
173	u64			file_offset;
174	u64			sz;
175};
176
177#define PERF_AUXTRACE_INDEX_ENTRY_COUNT 256
178
179/**
180 * struct auxtrace_index - index of AUX area tracing events within a perf.data
181 *                         file.
182 * @list: linking a number of arrays of entries
183 * @nr: number of entries
184 * @entries: array of entries
185 */
186struct auxtrace_index {
187	struct list_head	list;
188	size_t			nr;
189	struct auxtrace_index_entry entries[PERF_AUXTRACE_INDEX_ENTRY_COUNT];
190};
191
192/**
193 * struct auxtrace - session callbacks to allow AUX area data decoding.
194 * @process_event: lets the decoder see all session events
195 * @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event
196 * @queue_data: queue an AUX sample or PERF_RECORD_AUXTRACE event for later
197 *              processing
198 * @dump_auxtrace_sample: dump AUX area sample data
199 * @flush_events: process any remaining data
200 * @free_events: free resources associated with event processing
201 * @free: free resources associated with the session
202 */
203struct auxtrace {
204	int (*process_event)(struct perf_session *session,
205			     union perf_event *event,
206			     struct perf_sample *sample,
207			     const struct perf_tool *tool);
208	int (*process_auxtrace_event)(struct perf_session *session,
209				      union perf_event *event,
210				      const struct perf_tool *tool);
211	int (*queue_data)(struct perf_session *session,
212			  struct perf_sample *sample, union perf_event *event,
213			  u64 data_offset);
214	void (*dump_auxtrace_sample)(struct perf_session *session,
215				     struct perf_sample *sample);
216	int (*flush_events)(struct perf_session *session,
217			    const struct perf_tool *tool);
218	void (*free_events)(struct perf_session *session);
219	void (*free)(struct perf_session *session);
220	bool (*evsel_is_auxtrace)(struct perf_session *session,
221				  struct evsel *evsel);
222};
223
224/**
225 * struct auxtrace_buffer - a buffer containing AUX area tracing data.
226 * @list: buffers are queued in a list held by struct auxtrace_queue
227 * @size: size of the buffer in bytes
228 * @pid: in per-thread mode, the pid this buffer is associated with
229 * @tid: in per-thread mode, the tid this buffer is associated with
230 * @cpu: in per-cpu mode, the cpu this buffer is associated with
231 * @data: actual buffer data (can be null if the data has not been loaded)
232 * @data_offset: file offset at which the buffer can be read
233 * @mmap_addr: mmap address at which the buffer can be read
234 * @mmap_size: size of the mmap at @mmap_addr
235 * @data_needs_freeing: @data was malloc'd so free it when it is no longer
236 *                      needed
237 * @consecutive: the original data was split up and this buffer is consecutive
238 *               to the previous buffer
239 * @offset: offset as determined by aux_head / aux_tail members of struct
240 *          perf_event_mmap_page
241 * @reference: an implementation-specific reference determined when the data is
242 *             recorded
243 * @buffer_nr: used to number each buffer
244 * @use_size: implementation actually only uses this number of bytes
245 * @use_data: implementation actually only uses data starting at this address
246 */
247struct auxtrace_buffer {
248	struct list_head	list;
249	size_t			size;
250	pid_t			pid;
251	pid_t			tid;
252	struct perf_cpu		cpu;
253	void			*data;
254	off_t			data_offset;
255	void			*mmap_addr;
256	size_t			mmap_size;
257	bool			data_needs_freeing;
258	bool			consecutive;
259	u64			offset;
260	u64			reference;
261	u64			buffer_nr;
262	size_t			use_size;
263	void			*use_data;
264};
265
266/**
267 * struct auxtrace_queue - a queue of AUX area tracing data buffers.
268 * @head: head of buffer list
269 * @tid: in per-thread mode, the tid this queue is associated with
270 * @cpu: in per-cpu mode, the cpu this queue is associated with
271 * @set: %true once this queue has been dedicated to a specific thread or cpu
272 * @priv: implementation-specific data
273 */
274struct auxtrace_queue {
275	struct list_head	head;
276	pid_t			tid;
277	int			cpu;
278	bool			set;
279	void			*priv;
280};
281
282/**
283 * struct auxtrace_queues - an array of AUX area tracing queues.
284 * @queue_array: array of queues
285 * @nr_queues: number of queues
286 * @new_data: set whenever new data is queued
287 * @populated: queues have been fully populated using the auxtrace_index
288 * @next_buffer_nr: used to number each buffer
289 */
290struct auxtrace_queues {
291	struct auxtrace_queue	*queue_array;
292	unsigned int		nr_queues;
293	bool			new_data;
294	bool			populated;
295	u64			next_buffer_nr;
296};
297
298/**
299 * struct auxtrace_heap_item - element of struct auxtrace_heap.
300 * @queue_nr: queue number
301 * @ordinal: value used for sorting (lowest ordinal is top of the heap) expected
302 *           to be a timestamp
303 */
304struct auxtrace_heap_item {
305	unsigned int		queue_nr;
306	u64			ordinal;
307};
308
309/**
310 * struct auxtrace_heap - a heap suitable for sorting AUX area tracing queues.
311 * @heap_array: the heap
312 * @heap_cnt: the number of elements in the heap
313 * @heap_sz: maximum number of elements (grows as needed)
314 */
315struct auxtrace_heap {
316	struct auxtrace_heap_item	*heap_array;
317	unsigned int		heap_cnt;
318	unsigned int		heap_sz;
319};
320
321/**
322 * struct auxtrace_mmap - records an mmap of the auxtrace buffer.
323 * @base: address of mapped area
324 * @userpg: pointer to buffer's perf_event_mmap_page
325 * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
326 * @len: size of mapped area
327 * @prev: previous aux_head
328 * @idx: index of this mmap
329 * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
330 *       mmap) otherwise %0
331 * @cpu: cpu number for a per-cpu mmap otherwise %-1
332 */
333struct auxtrace_mmap {
334	void		*base;
335	void		*userpg;
336	size_t		mask;
337	size_t		len;
338	u64		prev;
339	int		idx;
340	pid_t		tid;
341	int		cpu;
342};
343
344/**
345 * struct auxtrace_mmap_params - parameters to set up struct auxtrace_mmap.
346 * @mask: %0 if @len is not a power of two, otherwise (@len - %1)
347 * @offset: file offset of mapped area
348 * @len: size of mapped area
349 * @prot: mmap memory protection
350 * @idx: index of this mmap
351 * @tid: tid for a per-thread mmap (also set if there is only 1 tid on a per-cpu
352 *       mmap) otherwise %0
353 * @mmap_needed: set to %false for non-auxtrace events. This is needed because
354 *               auxtrace mmapping is done in the same code path as non-auxtrace
355 *               mmapping but not every evsel that needs non-auxtrace mmapping
356 *               also needs auxtrace mmapping.
357 * @cpu: cpu number for a per-cpu mmap otherwise %-1
358 */
359struct auxtrace_mmap_params {
360	size_t		mask;
361	off_t		offset;
362	size_t		len;
363	int		prot;
364	int		idx;
365	pid_t		tid;
366	bool		mmap_needed;
367	struct perf_cpu	cpu;
368};
369
370/**
371 * struct auxtrace_record - callbacks for recording AUX area data.
372 * @recording_options: validate and process recording options
373 * @info_priv_size: return the size of the private data in auxtrace_info_event
374 * @info_fill: fill-in the private data in auxtrace_info_event
375 * @free: free this auxtrace record structure
376 * @snapshot_start: starting a snapshot
377 * @snapshot_finish: finishing a snapshot
378 * @find_snapshot: find data to snapshot within auxtrace mmap
379 * @parse_snapshot_options: parse snapshot options
380 * @reference: provide a 64-bit reference number for auxtrace_event
381 * @read_finish: called after reading from an auxtrace mmap
382 * @alignment: alignment (if any) for AUX area data
383 * @default_aux_sample_size: default sample size for --aux sample option
384 * @pmu: associated pmu
385 * @evlist: selected events list
386 */
387struct auxtrace_record {
388	int (*recording_options)(struct auxtrace_record *itr,
389				 struct evlist *evlist,
390				 struct record_opts *opts);
391	size_t (*info_priv_size)(struct auxtrace_record *itr,
392				 struct evlist *evlist);
393	int (*info_fill)(struct auxtrace_record *itr,
394			 struct perf_session *session,
395			 struct perf_record_auxtrace_info *auxtrace_info,
396			 size_t priv_size);
397	void (*free)(struct auxtrace_record *itr);
398	int (*snapshot_start)(struct auxtrace_record *itr);
399	int (*snapshot_finish)(struct auxtrace_record *itr);
400	int (*find_snapshot)(struct auxtrace_record *itr, int idx,
401			     struct auxtrace_mmap *mm, unsigned char *data,
402			     u64 *head, u64 *old);
403	int (*parse_snapshot_options)(struct auxtrace_record *itr,
404				      struct record_opts *opts,
405				      const char *str);
406	u64 (*reference)(struct auxtrace_record *itr);
407	int (*read_finish)(struct auxtrace_record *itr, int idx);
408	unsigned int alignment;
409	unsigned int default_aux_sample_size;
410	struct evlist *evlist;
411};
412
413/**
414 * struct addr_filter - address filter.
415 * @list: list node
416 * @range: true if it is a range filter
417 * @start: true if action is 'filter' or 'start'
418 * @action: 'filter', 'start' or 'stop' ('tracestop' is accepted but converted
419 *          to 'stop')
420 * @sym_from: symbol name for the filter address
421 * @sym_to: symbol name that determines the filter size
422 * @sym_from_idx: selects n'th from symbols with the same name (0 means global
423 *                and less than 0 means symbol must be unique)
424 * @sym_to_idx: same as @sym_from_idx but for @sym_to
425 * @addr: filter address
426 * @size: filter region size (for range filters)
427 * @filename: DSO file name or NULL for the kernel
428 * @str: allocated string that contains the other string members
429 */
430struct addr_filter {
431	struct list_head	list;
432	bool			range;
433	bool			start;
434	const char		*action;
435	const char		*sym_from;
436	const char		*sym_to;
437	int			sym_from_idx;
438	int			sym_to_idx;
439	u64			addr;
440	u64			size;
441	const char		*filename;
442	char			*str;
443};
444
445/**
446 * struct addr_filters - list of address filters.
447 * @head: list of address filters
448 * @cnt: number of address filters
449 */
450struct addr_filters {
451	struct list_head	head;
452	int			cnt;
453};
454
455struct auxtrace_cache;
456
457u64 compat_auxtrace_mmap__read_head(struct auxtrace_mmap *mm);
458int compat_auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail);
459
460static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm,
461					   int kernel_is_64_bit __maybe_unused)
462{
463	struct perf_event_mmap_page *pc = mm->userpg;
464	u64 head;
465
466#if BITS_PER_LONG == 32
467	if (kernel_is_64_bit)
468		return compat_auxtrace_mmap__read_head(mm);
469#endif
470	head = READ_ONCE(pc->aux_head);
471
472	/* Ensure all reads are done after we read the head */
473	smp_rmb();
474	return head;
475}
476
477static inline int auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail,
478					    int kernel_is_64_bit __maybe_unused)
479{
480	struct perf_event_mmap_page *pc = mm->userpg;
481
482#if BITS_PER_LONG == 32
483	if (kernel_is_64_bit)
484		return compat_auxtrace_mmap__write_tail(mm, tail);
485#endif
486	/* Ensure all reads are done before we write the tail out */
487	smp_mb();
488	WRITE_ONCE(pc->aux_tail, tail);
489	return 0;
490}
491
492int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
493			struct auxtrace_mmap_params *mp,
494			void *userpg, int fd);
495void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
496void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
497				off_t auxtrace_offset,
498				unsigned int auxtrace_pages,
499				bool auxtrace_overwrite);
500void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
501				   struct evlist *evlist,
502				   struct evsel *evsel, int idx);
503
504typedef int (*process_auxtrace_t)(const struct perf_tool *tool,
505				  struct mmap *map,
506				  union perf_event *event, void *data1,
507				  size_t len1, void *data2, size_t len2);
508
509int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr,
510			struct perf_env *env, const struct perf_tool *tool,
511			process_auxtrace_t fn);
512
513int auxtrace_mmap__read_snapshot(struct mmap *map,
514				 struct auxtrace_record *itr, struct perf_env *env,
515				 const struct perf_tool *tool, process_auxtrace_t fn,
516				 size_t snapshot_size);
517
518int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues);
519int auxtrace_queues__init(struct auxtrace_queues *queues);
520int auxtrace_queues__add_event(struct auxtrace_queues *queues,
521			       struct perf_session *session,
522			       union perf_event *event, off_t data_offset,
523			       struct auxtrace_buffer **buffer_ptr);
524struct auxtrace_queue *
525auxtrace_queues__sample_queue(struct auxtrace_queues *queues,
526			      struct perf_sample *sample,
527			      struct perf_session *session);
528int auxtrace_queues__add_sample(struct auxtrace_queues *queues,
529				struct perf_session *session,
530				struct perf_sample *sample, u64 data_offset,
531				u64 reference);
532void auxtrace_queues__free(struct auxtrace_queues *queues);
533int auxtrace_queues__process_index(struct auxtrace_queues *queues,
534				   struct perf_session *session);
535int auxtrace_queue_data(struct perf_session *session, bool samples,
536			bool events);
537struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue,
538					      struct auxtrace_buffer *buffer);
539void *auxtrace_buffer__get_data_rw(struct auxtrace_buffer *buffer, int fd, bool rw);
540static inline void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd)
541{
542	return auxtrace_buffer__get_data_rw(buffer, fd, false);
543}
544void auxtrace_buffer__put_data(struct auxtrace_buffer *buffer);
545void auxtrace_buffer__drop_data(struct auxtrace_buffer *buffer);
546void auxtrace_buffer__free(struct auxtrace_buffer *buffer);
547
548int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
549		       u64 ordinal);
550void auxtrace_heap__pop(struct auxtrace_heap *heap);
551void auxtrace_heap__free(struct auxtrace_heap *heap);
552
553struct auxtrace_cache_entry {
554	struct hlist_node hash;
555	u32 key;
556};
557
558struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
559					   unsigned int limit_percent);
560void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
561void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
562void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
563int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
564			struct auxtrace_cache_entry *entry);
565void auxtrace_cache__remove(struct auxtrace_cache *c, u32 key);
566void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
567
568struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
569					      int *err);
570
571int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
572				    struct record_opts *opts,
573				    const char *str);
574int auxtrace_parse_sample_options(struct auxtrace_record *itr,
575				  struct evlist *evlist,
576				  struct record_opts *opts, const char *str);
577int auxtrace_parse_aux_action(struct evlist *evlist);
578int auxtrace_record__options(struct auxtrace_record *itr,
579			     struct evlist *evlist,
580			     struct record_opts *opts);
581size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
582				       struct evlist *evlist);
583int auxtrace_record__info_fill(struct auxtrace_record *itr,
584			       struct perf_session *session,
585			       struct perf_record_auxtrace_info *auxtrace_info,
586			       size_t priv_size);
587void auxtrace_record__free(struct auxtrace_record *itr);
588int auxtrace_record__snapshot_start(struct auxtrace_record *itr);
589int auxtrace_record__snapshot_finish(struct auxtrace_record *itr, bool on_exit);
590int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
591				   struct auxtrace_mmap *mm,
592				   unsigned char *data, u64 *head, u64 *old);
593u64 auxtrace_record__reference(struct auxtrace_record *itr);
594int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx);
595
596int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
597				   off_t file_offset);
598int auxtrace_index__write(int fd, struct list_head *head);
599int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
600			    bool needs_swap);
601void auxtrace_index__free(struct list_head *head);
602
603void auxtrace_synth_guest_error(struct perf_record_auxtrace_error *auxtrace_error, int type,
604				int code, int cpu, pid_t pid, pid_t tid, u64 ip,
605				const char *msg, u64 timestamp,
606				pid_t machine_pid, int vcpu);
607void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int type,
608			  int code, int cpu, pid_t pid, pid_t tid, u64 ip,
609			  const char *msg, u64 timestamp);
610
611int perf_event__process_auxtrace_info(const struct perf_tool *tool,
612				      struct perf_session *session,
613				      union perf_event *event);
614s64 perf_event__process_auxtrace(const struct perf_tool *tool,
615				 struct perf_session *session,
616				 union perf_event *event);
617int perf_event__process_auxtrace_error(const struct perf_tool *tool,
618				       struct perf_session *session,
619				       union perf_event *event);
620int itrace_do_parse_synth_opts(struct itrace_synth_opts *synth_opts,
621			       const char *str, int unset);
622int itrace_parse_synth_opts(const struct option *opt, const char *str,
623			    int unset);
624void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
625				    bool no_sample);
626
627size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
628void perf_session__auxtrace_error_inc(struct perf_session *session,
629				      union perf_event *event);
630void events_stats__auxtrace_error_warn(const struct events_stats *stats);
631
632void addr_filters__init(struct addr_filters *filts);
633void addr_filters__exit(struct addr_filters *filts);
634int addr_filters__parse_bare_filter(struct addr_filters *filts,
635				    const char *filter);
636int auxtrace_parse_filters(struct evlist *evlist);
637
638int auxtrace__process_event(struct perf_session *session, union perf_event *event,
639			    struct perf_sample *sample, const struct perf_tool *tool);
640void auxtrace__dump_auxtrace_sample(struct perf_session *session,
641				    struct perf_sample *sample);
642int auxtrace__flush_events(struct perf_session *session, const struct perf_tool *tool);
643void auxtrace__free_events(struct perf_session *session);
644void auxtrace__free(struct perf_session *session);
645bool auxtrace__evsel_is_auxtrace(struct perf_session *session,
646				 struct evsel *evsel);
647u64 auxtrace_synth_id_range_start(struct evsel *evsel);
648
649#define ITRACE_HELP \
650"				i[period]:    		synthesize instructions events\n" \
651"				y[period]:    		synthesize cycles events (same period as i)\n" \
652"				b:	    		synthesize branches events\n" \
653"				c:	    		synthesize branches events (calls only)\n"	\
654"				r:	    		synthesize branches events (returns only)\n" \
655"				x:	    		synthesize transactions events\n"		\
656"				w:	    		synthesize ptwrite events\n"		\
657"				p:	    		synthesize power events\n"			\
658"				o:			synthesize other events recorded due to the use\n" \
659"							of aux-output (refer to perf record)\n"	\
660"				I:			synthesize interrupt or similar (asynchronous) events\n" \
661"							(e.g. Intel PT Event Trace)\n" \
662"				e[flags]:		synthesize error events\n" \
663"							each flag must be preceded by + or -\n" \
664"							error flags are: o (overflow)\n" \
665"									 l (data lost)\n" \
666"				d[flags]:		create a debug log\n" \
667"							each flag must be preceded by + or -\n" \
668"							log flags are: a (all perf events)\n" \
669"							               o (output to stdout)\n" \
670"				f:	    		synthesize first level cache events\n" \
671"				m:	    		synthesize last level cache events\n" \
672"				t:	    		synthesize TLB events\n" \
673"				a:	    		synthesize remote access events\n" \
674"				g[len]:     		synthesize a call chain (use with i or x)\n" \
675"				G[len]:			synthesize a call chain on existing event records\n" \
676"				l[len]:     		synthesize last branch entries (use with i or x)\n" \
677"				L[len]:			synthesize last branch entries on existing event records\n" \
678"				sNUMBER:    		skip initial number of events\n"		\
679"				q:			quicker (less detailed) decoding\n" \
680"				A:			approximate IPC\n" \
681"				Z:			prefer to ignore timestamps (so-called \"timeless\" decoding)\n" \
682"				T:			use the timestamp trace as kernel time\n" \
683"				PERIOD[ns|us|ms|i|t]:   specify period to sample stream\n" \
684"				concatenate multiple options. Default is iybxwpe or cewp\n"
685
686static inline
687void itrace_synth_opts__set_time_range(struct itrace_synth_opts *opts,
688				       struct perf_time_interval *ptime_range,
689				       int range_num)
690{
691	opts->ptime_range = ptime_range;
692	opts->range_num = range_num;
693}
694
695static inline
696void itrace_synth_opts__clear_time_range(struct itrace_synth_opts *opts)
697{
698	opts->ptime_range = NULL;
699	opts->range_num = 0;
700}
701
702#endif
~/ Read-only file preview.