From 41ba2b30e79b7f7069fcc14e5409b8c42cee6df3 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 31 Aug 2021 11:27:14 +0200 Subject: [PATCH] lib/trace_parser: method for retrieving trace flags It gives user access to things like the tsc rate and tracepoint definitions. Signed-off-by: Konrad Sztyber Change-Id: Ib50126b331faa4508174c7cb707643a3d8db6a01 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9430 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- include/spdk/trace_parser.h | 9 +++++++++ lib/trace_parser/spdk_trace_parser.map | 1 + lib/trace_parser/trace.cpp | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/include/spdk/trace_parser.h b/include/spdk/trace_parser.h index 3aefd9f55c..b59071b7da 100644 --- a/include/spdk/trace_parser.h +++ b/include/spdk/trace_parser.h @@ -83,6 +83,15 @@ struct spdk_trace_parser *spdk_trace_parser_init(const struct spdk_trace_parser_ */ void spdk_trace_parser_cleanup(struct spdk_trace_parser *parser); +/** + * Return trace flags describing the traces. + * + * \param parser Parser object to be used. + * + * \return Pointer to the trace flags. + */ +const struct spdk_trace_flags *spdk_trace_parser_get_flags(const struct spdk_trace_parser *parser); + #ifdef __cplusplus } #endif diff --git a/lib/trace_parser/spdk_trace_parser.map b/lib/trace_parser/spdk_trace_parser.map index 1f1c1c5696..ae58db77a5 100644 --- a/lib/trace_parser/spdk_trace_parser.map +++ b/lib/trace_parser/spdk_trace_parser.map @@ -4,6 +4,7 @@ # public functions spdk_trace_parser_init; spdk_trace_parser_cleanup; + spdk_trace_parser_get_flags; local: *; }; diff --git a/lib/trace_parser/trace.cpp b/lib/trace_parser/trace.cpp index 8874b4770e..2986ee4255 100644 --- a/lib/trace_parser/trace.cpp +++ b/lib/trace_parser/trace.cpp @@ -34,6 +34,7 @@ #include "spdk/stdinc.h" #include "spdk/log.h" #include "spdk/trace_parser.h" +#include "spdk/util.h" #include #include @@ -43,6 +44,7 @@ struct spdk_trace_parser { ~spdk_trace_parser(); spdk_trace_parser(const spdk_trace_parser &) = delete; spdk_trace_parser &operator=(const spdk_trace_parser &) = delete; + const spdk_trace_flags *flags() const { return &_histories->flags; } private: bool init(const spdk_trace_parser_opts *opts); void cleanup(); @@ -158,3 +160,9 @@ spdk_trace_parser_cleanup(struct spdk_trace_parser *parser) { delete parser; } + +const struct spdk_trace_flags * +spdk_trace_parser_get_flags(const struct spdk_trace_parser *parser) +{ + return parser->flags(); +}