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 <konrad.sztyber@intel.com>
Change-Id: Ib50126b331faa4508174c7cb707643a3d8db6a01
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9430
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Konrad Sztyber 2021-08-31 11:27:14 +02:00 committed by Tomasz Zawadzki
parent 55f64c36c6
commit 41ba2b30e7
3 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -4,6 +4,7 @@
# public functions
spdk_trace_parser_init;
spdk_trace_parser_cleanup;
spdk_trace_parser_get_flags;
local: *;
};

View File

@ -34,6 +34,7 @@
#include "spdk/stdinc.h"
#include "spdk/log.h"
#include "spdk/trace_parser.h"
#include "spdk/util.h"
#include <exception>
#include <new>
@ -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();
}