[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201110100346.2527031-2-irogers@google.com>
Date: Tue, 10 Nov 2020 02:03:35 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
Jin Yao <yao.jin@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Paul Clarke <pc@...ibm.com>, kajoljain <kjain@...ux.ibm.com>
Cc: Stephane Eranian <eranian@...gle.com>,
Sandeep Dasgupta <sdasgup@...gle.com>,
linux-perf-users@...r.kernel.org, Ian Rogers <irogers@...gle.com>
Subject: [RFC PATCH 01/12] perf topdown-parser: Add a simple logging API.
From: Sandeep Dasgupta <sdasgup@...gle.com>
A logging API that is simpler but inspired by that in abseil.
Signed-off-by: Ian Rogers <irogers@...gle.com>
Signed-off-by: Sandeep Dasgupta <sdasgup@...gle.com>
---
.../perf/pmu-events/topdown-parser/logging.h | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 tools/perf/pmu-events/topdown-parser/logging.h
diff --git a/tools/perf/pmu-events/topdown-parser/logging.h b/tools/perf/pmu-events/topdown-parser/logging.h
new file mode 100644
index 000000000000..9942018c4c75
--- /dev/null
+++ b/tools/perf/pmu-events/topdown-parser/logging.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+// -------------------------------------
+// File: logging.h
+// -------------------------------------
+//
+// The header provides the macro defintion for logging errors/warnings
+
+#ifndef TOPDOWN_PARSER_LOGGING_H_
+#define TOPDOWN_PARSER_LOGGING_H_
+
+#include <iostream>
+
+#define INFO(msg) std::cout << "\033[1;35mInfo: " << msg << "\033[0m\n"
+#define ERROR(msg) \
+ std::cout << __FILE__ << ":" << __LINE__ \
+ << " \033[1;31mError: " << msg << "\033[0m\n"
+#define FATAL(msg) \
+ do { \
+ std::cout << __FILE__ << ":" << __LINE__ \
+ << " \033[1;31mFatal: " << msg << "\033[0m\n"; \
+ exit(1); \
+ } while (false)
+
+#endif // TOPDOWN_PARSER_LOGGING_H_
--
2.29.2.222.g5d2a92d10f8-goog
Powered by blists - more mailing lists