11 #include <api/debug.h> 12 #include <linux/time64.h> 13 #ifdef HAVE_BACKTRACE_SUPPORT 40 ret = vfprintf(stderr, fmt, args);
52 ret =
veprintf(level, var, fmt, args);
61 u64 secs, usecs,
nsecs = t;
65 usecs = nsecs / NSEC_PER_USEC;
67 ret = fprintf(stderr,
"[%13" PRIu64
".%06" PRIu64
"] ",
69 ret += vfprintf(stderr, fmt, args);
108 ret = vprintf(fmt, args);
116 unsigned int val,
void *extra, FILE *fp)
120 unsigned char ch = (
unsigned char)val;
125 printed += fprintf(fp,
".");
126 printed +=
color_fprintf(fp, color,
"\n. ... raw event: size %d bytes\n",
130 printed += fprintf(fp,
".");
155 printed += fprintf(fp,
"\n");
166 unsigned char *raw_event = (
void *)event;
189 char *vstr, *s = strdup(str);
192 vstr = strchr(s,
'=');
197 if (!strcmp(s, var->
name))
203 pr_err(
"Unknown debug variable name '%s'\n", s);
214 v = (v < 0) || (v > 10) ? 0 : v;
238 #define DEBUG_WRAPPER(__n, __l) \ 239 static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ 244 va_start(args, fmt); \ 245 ret = veprintf(__l, verbose, fmt, args); \ 255 libapi_set_print(pr_warning_wrapper, pr_warning_wrapper, pr_debug_wrapper);
259 #ifdef HAVE_BACKTRACE_SUPPORT 263 size_t size = backtrace(array, ARRAY_SIZE(array));
264 char **strings = backtrace_symbols(array, size);
267 printf(
"Obtained %zd stack frames.\n", size);
269 for (i = 0; i <
size; i++)
270 printf(
"%s\n", strings[i]);
280 psignal(sig,
"perf");
282 signal(sig, SIG_DFL);
void perf_debug_setup(void)
int color_fprintf(FILE *fp, const char *color, const char *fmt,...)
void pr_stat(const char *fmt,...)
int veprintf(int level, int var, const char *fmt, va_list args)
#define DEBUG_WRAPPER(__n, __l)
void trace_event(union perf_event *event)
int eprintf(int level, int var, const char *fmt,...)
int dump_printf(const char *fmt,...)
int perf_debug_option(const char *str)
static int veprintf_time(u64 t, const char *fmt, va_list args)
int perf_quiet_option(void)
static struct debug_variable debug_variables[]
static void print_binary(unsigned char *data, size_t len, size_t bytes_per_line, binary__fprintf_t printer, void *extra)
static int str(yyscan_t scanner, int token)
struct perf_event_header header
static int redirect_to_stderr
static int trace_event_printer(enum binary_printer_ops op, unsigned int val, void *extra, FILE *fp)
static unsigned int nsecs
int ui_helpline__vshow(const char *fmt, va_list ap)
void sighandler_dump_stack(int sig)
int eprintf_time(int level, int var, u64 t, const char *fmt,...)