提交 1094795e 编写于 作者: J James Clark 提交者: Arnaldo Carvalho de Melo

perf tools: Add WARN_ONCE equivalent for UI warnings

Currently WARN_ONCE prints to stderr and corrupts the TUI. Add
equivalent methods for UI warnings.
Signed-off-by: NJames Clark <james.clark@arm.com>
Reviewed-by: NLeo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lore.kernel.org/lkml/20210729155805.2830-2-james.clark@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 ec02f2b1
......@@ -22,6 +22,13 @@ extern int debug_data_convert;
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning(fmt, ...) \
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning_once(fmt, ...) ({ \
static int __warned; \
if (unlikely(!__warned)) { \
pr_warning(fmt, ##__VA_ARGS__); \
__warned = 1; \
} \
})
#define pr_info(fmt, ...) \
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_debug(fmt, ...) \
......@@ -55,6 +62,13 @@ void trace_event(union perf_event *event);
int ui__error(const char *format, ...) __printf(1, 2);
int ui__warning(const char *format, ...) __printf(1, 2);
#define ui__warning_once(format, ...) ({ \
static int __warned; \
if (unlikely(!__warned)) { \
ui__warning(format, ##__VA_ARGS__); \
__warned = 1; \
} \
})
void pr_stat(const char *fmt, ...);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册