xref: /aosp_15_r20/external/trace-cmd/include/trace-cmd/trace-cmd.h (revision 58e6ee5f017f6a8912852c892d18457e4bafb554)
1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
3  * Copyright (C) 2008, 2009, 2010 Red Hat Inc, Steven Rostedt <[email protected]>
4  *
5  */
6 #ifndef _TRACE_CMD_H
7 #define _TRACE_CMD_H
8 
9 #include "event-parse.h"
10 #include "tracefs.h"
11 
12 struct tracecmd_input;
13 
14 enum tracecmd_open_flags {
15 	TRACECMD_FL_LOAD_NO_PLUGINS		= 1 << 0, /* Do not load plugins */
16 	TRACECMD_FL_LOAD_NO_SYSTEM_PLUGINS	= 1 << 1, /* Do not load system plugins */
17 };
18 
19 enum tracecmd_section_flags {
20 	TRACECMD_SEC_FL_COMPRESS	= 1 << 0, /* the section is compressed */
21 };
22 
23 struct tracecmd_input *tracecmd_open_head(const char *file, int flags);
24 struct tracecmd_input *tracecmd_open(const char *file, int flags);
25 struct tracecmd_input *tracecmd_open_fd(int fd, int flags);
26 
27 void tracecmd_close(struct tracecmd_input *handle);
28 
29 int tracecmd_init_data(struct tracecmd_input *handle);
30 struct tep_record *
31 tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu);
32 struct tep_record *
33 tracecmd_read_data(struct tracecmd_input *handle, int cpu);
34 struct tep_record *
35 tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset,
36 		 int *cpu);
37 void tracecmd_free_record(struct tep_record *record);
38 
39 struct tep_handle *tracecmd_get_tep(struct tracecmd_input *handle);
40 unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle);
41 int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
42 			      unsigned long long trace_id,
43 			      const char **name,
44 			      int *vcpu_count, const int **cpu_pid);
45 unsigned long long tracecmd_get_first_ts(struct tracecmd_input *handle);
46 void tracecmd_add_ts_offset(struct tracecmd_input *handle, long long offset);
47 int tracecmd_buffer_instances(struct tracecmd_input *handle);
48 const char *tracecmd_buffer_instance_name(struct tracecmd_input *handle, int indx);
49 struct tracecmd_input *tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx);
50 
51 void tracecmd_set_loglevel(enum tep_loglevel level);
52 
53 #endif /* _TRACE_CMD_H */
54