33 int *offset,
int *
size,
const char *type)
35 struct pevent *pevent = context->
pevent;
36 struct event_format *
event;
37 struct format_field *
field;
43 event = pevent->events[0];
44 field = pevent_find_common_field(event, type);
47 *offset = field->offset;
51 return pevent_read_number(pevent, context->
event_data + *offset, *size);
89 "common_preempt_count");
99 struct format_field *
field;
100 unsigned long long val;
102 field = pevent_find_any_field(event, name);
106 pevent_read_number_field(field, data, &val);
113 return pevent_read_number(event->pevent, ptr, size);
117 int cpu,
void *
data,
int size, FILE *fp)
119 struct pevent_record record;
122 memset(&record, 0,
sizeof(record));
128 pevent_event_info(&s, event, &record);
129 trace_seq_do_fprintf(&s, fp);
130 trace_seq_destroy(&s);
140 char *file,
unsigned int size __maybe_unused)
142 unsigned long long addr;
149 line = strtok_r(file,
"\n", &next);
151 addr_str = strtok_r(line,
":", &fmt);
156 addr = strtoull(addr_str, NULL, 16);
158 printk = strdup(fmt+1);
159 line = strtok_r(NULL,
"\n", &next);
160 pevent_register_print_string(pevent, printk, addr);
165 char *file,
unsigned int size __maybe_unused)
172 line = strtok_r(file,
"\n", &next);
174 sscanf(line,
"%d %ms", &pid, &comm);
175 pevent_register_comm(pevent, comm, pid);
177 line = strtok_r(NULL,
"\n", &next);
183 return pevent_parse_event(pevent, buf, size,
"ftrace");
187 char *buf,
unsigned long size,
char *sys)
189 return pevent_parse_event(pevent, buf, size, sys);
193 struct event_format *
event)
197 if (!pevent || !pevent->events)
202 return pevent->events[0];
205 if (idx < pevent->nr_events && event == pevent->events[idx]) {
207 if (idx == pevent->nr_events)
209 return pevent->events[idx];
212 for (idx = 1; idx < pevent->nr_events; idx++) {
213 if (event == pevent->events[idx - 1])
214 return pevent->events[idx];
226 {
"TIMER_SOFTIRQ", 1 },
227 {
"NET_TX_SOFTIRQ", 2 },
228 {
"NET_RX_SOFTIRQ", 3 },
229 {
"BLOCK_SOFTIRQ", 4 },
230 {
"IRQ_POLL_SOFTIRQ", 5 },
231 {
"TASKLET_SOFTIRQ", 6 },
232 {
"SCHED_SOFTIRQ", 7 },
233 {
"HRTIMER_SOFTIRQ", 8 },
234 {
"RCU_SOFTIRQ", 9 },
236 {
"HRTIMER_NORESTART", 0 },
237 {
"HRTIMER_RESTART", 1 },
250 return strtoull(flag, NULL, 0);
252 for (i = 0; i < (int)(
sizeof(flags)/
sizeof(flags[0])); i++)
253 if (strcmp(flags[i].
name, flag) == 0)
254 return flags[i].
value;
int common_flags(struct scripting_context *context)
void event_format__fprintf(struct event_format *event, int cpu, void *data, int size, FILE *fp)
struct event_format * trace_find_next_event(struct pevent *pevent, struct event_format *event)
int parse_event_file(struct pevent *pevent, char *buf, unsigned long size, char *sys)
int common_pc(struct scripting_context *context)
void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size __maybe_unused)
static const struct flag flags[]
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
unsigned long long eval_flag(const char *flag)
void event_format__print(struct event_format *event, int cpu, void *data, int size)
unsigned long long read_size(struct event_format *event, void *ptr, int size)
int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size)
int common_lock_depth(struct scripting_context *context)
void parse_saved_cmdline(struct pevent *pevent, char *file, unsigned int size __maybe_unused)
static int get_common_field(struct scripting_context *context, int *offset, int *size, const char *type)
#define pr_warning(fmt,...)
unsigned long long raw_field_value(struct event_format *event, const char *name, void *data)