Lines Matching +full:ftrace +full:- +full:size
1 // SPDX-License-Identifier: GPL-2.0+
26 * of the function from gd->relocaddr
31 struct trace_call *ftrace; /* The function call records */ member
32 ulong ftrace_size; /* Num. of ftrace records we have space for */
33 ulong ftrace_count; /* Num. of ftrace records written */
49 offset -= (uintptr_t)&_init; in func_ptr_to_num()
51 if (gd->flags & GD_FLG_RELOC) in func_ptr_to_num()
52 offset -= gd->relocaddr; in func_ptr_to_num()
54 offset -= CONFIG_SYS_TEXT_BASE; in func_ptr_to_num()
62 if (hdr->depth > hdr->depth_limit) { in add_ftrace()
63 hdr->ftrace_too_deep_count++; in add_ftrace()
66 if (hdr->ftrace_count < hdr->ftrace_size) { in add_ftrace()
67 struct trace_call *rec = &hdr->ftrace[hdr->ftrace_count]; in add_ftrace()
69 rec->func = func_ptr_to_num(func_ptr); in add_ftrace()
70 rec->caller = func_ptr_to_num(caller); in add_ftrace()
71 rec->flags = flags | (timer_get_us() & FUNCF_TIMESTAMP_MASK); in add_ftrace()
73 hdr->ftrace_count++; in add_ftrace()
78 if (hdr->ftrace_count < hdr->ftrace_size) { in add_textbase()
79 struct trace_call *rec = &hdr->ftrace[hdr->ftrace_count]; in add_textbase()
81 rec->func = CONFIG_SYS_TEXT_BASE; in add_textbase()
82 rec->caller = 0; in add_textbase()
83 rec->flags = FUNCF_TEXTBASE; in add_textbase()
85 hdr->ftrace_count++; in add_textbase()
105 if (func < hdr->func_count) { in __cyg_profile_func_enter()
106 hdr->call_accum[func]++; in __cyg_profile_func_enter()
107 hdr->call_count++; in __cyg_profile_func_enter()
109 hdr->untracked_count++; in __cyg_profile_func_enter()
111 hdr->depth++; in __cyg_profile_func_enter()
112 if (hdr->depth > hdr->depth_limit) in __cyg_profile_func_enter()
113 hdr->max_depth = hdr->depth; in __cyg_profile_func_enter()
130 hdr->depth--; in __cyg_profile_func_exit()
137 * The information is written into the supplied buffer - a header followed
141 * @param buff_size Size of buffer
142 * @param needed Returns size of buffer needed, which may be
144 * @return 0 if ok, -1 if space was exhausted
161 for (func = upto = 0; func < hdr->func_count; func++) { in trace_list_functions()
162 int calls = hdr->call_accum[func]; in trace_list_functions()
170 stats->offset = func * FUNC_SITE_SIZE; in trace_list_functions()
171 stats->call_count = calls; in trace_list_functions()
179 output_hdr->rec_count = upto; in trace_list_functions()
180 output_hdr->type = TRACE_CHUNK_FUNCS; in trace_list_functions()
184 *needed = ptr - buff; in trace_list_functions()
186 return -1; in trace_list_functions()
205 count = hdr->ftrace_count; in trace_list_calls()
206 if (count > hdr->ftrace_size) in trace_list_calls()
207 count = hdr->ftrace_size; in trace_list_calls()
210 struct trace_call *call = &hdr->ftrace[rec]; in trace_list_calls()
213 out->func = call->func * FUNC_SITE_SIZE; in trace_list_calls()
214 out->caller = call->caller * FUNC_SITE_SIZE; in trace_list_calls()
215 out->flags = call->flags; in trace_list_calls()
223 output_hdr->rec_count = upto; in trace_list_calls()
224 output_hdr->type = TRACE_CHUNK_CALLS; in trace_list_calls()
228 *needed = ptr - buff; in trace_list_calls()
230 return -1; in trace_list_calls()
239 #ifndef FTRACE in trace_print_stats()
240 puts("Warning: make U-Boot with FTRACE to enable function instrumenting.\n"); in trace_print_stats()
247 print_grouped_ull(hdr->func_count, 10); in trace_print_stats()
249 print_grouped_ull(hdr->call_count, 10); in trace_print_stats()
251 print_grouped_ull(hdr->untracked_count, 10); in trace_print_stats()
253 count = min(hdr->ftrace_count, hdr->ftrace_size); in trace_print_stats()
256 if (hdr->ftrace_count > hdr->ftrace_size) { in trace_print_stats()
258 hdr->ftrace_count - hdr->ftrace_size); in trace_print_stats()
261 printf("%15d maximum observed call depth\n", hdr->max_depth); in trace_print_stats()
262 printf("%15d call depth limit\n", hdr->depth_limit); in trace_print_stats()
263 print_grouped_ull(hdr->ftrace_too_deep_count, 10); in trace_print_stats()
276 * @param buff_size Size of trace buffer
281 ulong func_count = gd->mon_len / FUNC_SITE_SIZE; in trace_init()
297 end = (char *)&hdr->ftrace[hdr->ftrace_count]; in trace_init()
298 used = end - (char *)hdr; in trace_init()
305 return -1; in trace_init()
311 printf("trace: buffer size %zd bytes: at least %zd needed\n", in trace_init()
313 return -1; in trace_init()
318 hdr->func_count = func_count; in trace_init()
319 hdr->call_accum = (uintptr_t *)(hdr + 1); in trace_init()
322 hdr->ftrace = (struct trace_call *)(buff + needed); in trace_init()
323 hdr->ftrace_size = (buff_size - needed) / sizeof(*hdr->ftrace); in trace_init()
327 hdr->depth_limit = 15; in trace_init()
336 ulong func_count = gd->mon_len / FUNC_SITE_SIZE; in trace_early_init()
347 printf("trace: buffer size is %zd bytes, at least %zd needed\n", in trace_early_init()
349 return -1; in trace_early_init()
353 hdr->call_accum = (uintptr_t *)(hdr + 1); in trace_early_init()
354 hdr->func_count = func_count; in trace_early_init()
357 hdr->ftrace = (struct trace_call *)((char *)hdr + needed); in trace_early_init()
358 hdr->ftrace_size = (buff_size - needed) / sizeof(*hdr->ftrace); in trace_early_init()
360 hdr->depth_limit = 200; in trace_early_init()