Lines Matching +full:cpu +full:- +full:offset
1 // SPDX-License-Identifier: LGPL-2.1
9 #include "event-parse.h"
10 #include "event-utils.h"
11 #include "trace-seq.h"
18 static int cpus = -1;
38 .name = "offset",
60 if (pos < stack->size) in add_child()
61 free(stack->stack[pos]); in add_child()
65 ptr = realloc(stack->stack, sizeof(char *) * in add_child()
66 (stack->size + STK_BLK)); in add_child()
72 stack->stack = ptr; in add_child()
74 for (i = stack->size; i < stack->size + STK_BLK; i++) in add_child()
75 stack->stack[i] = NULL; in add_child()
76 stack->size += STK_BLK; in add_child()
79 stack->stack[pos] = strdup(child); in add_child()
82 static int add_and_get_index(const char *parent, const char *child, int cpu) in add_and_get_index() argument
86 if (cpu < 0) in add_and_get_index()
89 if (cpu > cpus) { in add_and_get_index()
92 ptr = realloc(fstack, sizeof(*fstack) * (cpu + 1)); in add_and_get_index()
100 /* Account for holes in the cpu count */ in add_and_get_index()
101 for (i = cpus + 1; i <= cpu; i++) in add_and_get_index()
103 cpus = cpu; in add_and_get_index()
106 for (i = 0; i < fstack[cpu].size && fstack[cpu].stack[i]; i++) { in add_and_get_index()
107 if (strcmp(parent, fstack[cpu].stack[i]) == 0) { in add_and_get_index()
108 add_child(&fstack[cpu], child, i+1); in add_and_get_index()
114 add_child(&fstack[cpu], parent, 0); in add_and_get_index()
115 add_child(&fstack[cpu], child, 1); in add_and_get_index()
122 unsigned long long offset; in show_function() local
125 if (ftrace_offset->set) { in show_function()
126 offset = tep_find_function_address(tep, function); in show_function()
127 trace_seq_printf(s, "+0x%x ", (int)(function - offset)); in show_function()
134 struct tep_handle *tep = event->tep; in function_handler()
151 if (parent && ftrace_indent->set) in function_handler()
152 index = add_and_get_index(parent, func, record->cpu); in function_handler()
161 if (ftrace_parent->set) { in function_handler()
162 trace_seq_printf(s, " <-- "); in function_handler()
180 void *data = record->data; in trace_stack_handler()
190 long_size = tep_get_long_size(event->tep); in trace_stack_handler()
192 for (data += field->offset; data < record->data + record->size; in trace_stack_handler()
194 addr = tep_read_number(event->tep, data, long_size); in trace_stack_handler()
196 if ((long_size == 8 && addr == (unsigned long long)-1) || in trace_stack_handler()
197 ((int)addr == -1)) in trace_stack_handler()
200 func = tep_find_function(event->tep, addr); in trace_stack_handler()
217 void *data = record->data; in trace_raw_data_handler()
230 long_size = tep_get_long_size(event->tep); in trace_raw_data_handler()
232 for (data += field->offset; data < record->data + record->size; in trace_raw_data_handler()
235 int left = (record->data + record->size) - data; in trace_raw_data_handler()
250 tep_register_event_handler(tep, -1, "ftrace", "function", in TEP_PLUGIN_LOADER()
253 tep_register_event_handler(tep, -1, "ftrace", "kernel_stack", in TEP_PLUGIN_LOADER()
256 tep_register_event_handler(tep, -1, "ftrace", "raw_data", in TEP_PLUGIN_LOADER()
268 tep_unregister_event_handler(tep, -1, "ftrace", "function", in TEP_PLUGIN_UNLOADER()
281 cpus = -1; in TEP_PLUGIN_UNLOADER()