2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 17:23:55 +08:00

perf debug: Add debug_set_file function

Allow to set debug output file via new debug_set_file function.

It's called during perf startup in perf_debug_setup to set stderr file
as default and any perf command can set it later to different file.

It will be used in perf daemon command to get verbose output into log
file.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Budankov <abudankov@huawei.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20201212104358.412065-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa 2020-12-12 11:43:51 +01:00 committed by Arnaldo Carvalho de Melo
parent 7cfcd1e016
commit 8abceacff8
2 changed files with 10 additions and 1 deletions

View File

@ -30,6 +30,12 @@ bool dump_trace = false, quiet = false;
int debug_ordered_events;
static int redirect_to_stderr;
int debug_data_convert;
static FILE *debug_file;
void debug_set_file(FILE *file)
{
debug_file = file;
}
int veprintf(int level, int var, const char *fmt, va_list args)
{
@ -39,7 +45,7 @@ int veprintf(int level, int var, const char *fmt, va_list args)
if (use_browser >= 1 && !redirect_to_stderr)
ui_helpline__vshow(fmt, args);
else
ret = vfprintf(stderr, fmt, args);
ret = vfprintf(debug_file, fmt, args);
}
return ret;
@ -227,6 +233,7 @@ DEBUG_WRAPPER(debug, 1);
void perf_debug_setup(void)
{
debug_set_file(stderr);
libapi_set_print(pr_warning_wrapper, pr_warning_wrapper, pr_debug_wrapper);
}

View File

@ -5,6 +5,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <linux/compiler.h>
extern int verbose;
@ -62,6 +63,7 @@ int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __printf(4, 5)
int veprintf(int level, int var, const char *fmt, va_list args);
int perf_debug_option(const char *str);
void debug_set_file(FILE *file);
void perf_debug_setup(void);
int perf_quiet_option(void);