lib/trace_parser: method for retrieving entry count
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: If5f1b1bea0d30419be46e704ddd7c2f9556b4627 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9498 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
ffaec5f91c
commit
189b0f0920
@ -135,6 +135,16 @@ struct spdk_trace_parser_entry {
|
|||||||
bool spdk_trace_parser_next_entry(struct spdk_trace_parser *parser,
|
bool spdk_trace_parser_next_entry(struct spdk_trace_parser *parser,
|
||||||
struct spdk_trace_parser_entry *entry);
|
struct spdk_trace_parser_entry *entry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of entries recorded on a given core.
|
||||||
|
*
|
||||||
|
* \param parser Parser object to be used.
|
||||||
|
* \param lcore Logical core number.
|
||||||
|
*
|
||||||
|
* \return Number of entries.
|
||||||
|
*/
|
||||||
|
uint64_t spdk_trace_parser_get_entry_count(const struct spdk_trace_parser *parser, uint16_t lcore);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
spdk_trace_parser_get_flags;
|
spdk_trace_parser_get_flags;
|
||||||
spdk_trace_parser_get_tsc_offset;
|
spdk_trace_parser_get_tsc_offset;
|
||||||
spdk_trace_parser_next_entry;
|
spdk_trace_parser_next_entry;
|
||||||
|
spdk_trace_parser_get_entry_count;
|
||||||
|
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
@ -89,6 +89,7 @@ struct spdk_trace_parser {
|
|||||||
const spdk_trace_flags *flags() const { return &_histories->flags; }
|
const spdk_trace_flags *flags() const { return &_histories->flags; }
|
||||||
uint64_t tsc_offset() const { return _tsc_offset; }
|
uint64_t tsc_offset() const { return _tsc_offset; }
|
||||||
bool next_entry(spdk_trace_parser_entry *entry);
|
bool next_entry(spdk_trace_parser_entry *entry);
|
||||||
|
uint64_t entry_count(uint16_t lcore) const;
|
||||||
private:
|
private:
|
||||||
spdk_trace_entry_buffer *get_next_buffer(spdk_trace_entry_buffer *buf, uint16_t lcore);
|
spdk_trace_entry_buffer *get_next_buffer(spdk_trace_entry_buffer *buf, uint16_t lcore);
|
||||||
bool build_arg(argument_context *argctx, const spdk_trace_argument *arg, int argid,
|
bool build_arg(argument_context *argctx, const spdk_trace_argument *arg, int argid,
|
||||||
@ -105,6 +106,21 @@ private:
|
|||||||
entry_map::iterator _iter;
|
entry_map::iterator _iter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
spdk_trace_parser::entry_count(uint16_t lcore) const
|
||||||
|
{
|
||||||
|
spdk_trace_history *history;
|
||||||
|
|
||||||
|
if (lcore >= SPDK_TRACE_MAX_LCORE) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
history = spdk_get_per_lcore_history(_histories, lcore);
|
||||||
|
assert(history);
|
||||||
|
|
||||||
|
return history->num_entries;
|
||||||
|
}
|
||||||
|
|
||||||
spdk_trace_entry_buffer *
|
spdk_trace_entry_buffer *
|
||||||
spdk_trace_parser::get_next_buffer(spdk_trace_entry_buffer *buf, uint16_t lcore)
|
spdk_trace_parser::get_next_buffer(spdk_trace_entry_buffer *buf, uint16_t lcore)
|
||||||
{
|
{
|
||||||
@ -380,3 +396,9 @@ spdk_trace_parser_next_entry(struct spdk_trace_parser *parser,
|
|||||||
{
|
{
|
||||||
return parser->next_entry(entry);
|
return parser->next_entry(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
spdk_trace_parser_get_entry_count(const struct spdk_trace_parser *parser, uint16_t lcore)
|
||||||
|
{
|
||||||
|
return parser->entry_count(lcore);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user