app/trace: move stats update out of print_event

It'll make it a bit easier to support printing traces in different
formats.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I33d454868fe7975ce81046823e3a3b9b6f587b0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8102
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-05-19 20:59:08 +02:00 committed by Jim Harris
parent a4044e77d6
commit fb67f90b31

View File

@ -178,14 +178,6 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
d = &g_histories->flags.tpoint[e->tpoint_id];
stats = &g_stats[d->object_type];
if (d->new_object) {
stats->index[e->object_id] = stats->counter++;
stats->tpoint_id[e->object_id] = e->tpoint_id;
stats->start[e->object_id] = e->tsc;
stats->size[e->object_id] = e->size;
}
us = get_us_from_tsc(e->tsc - tsc_offset, tsc_rate);
printf("%2d: %10.3f ", lcore, us);
@ -228,6 +220,19 @@ static void
process_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
uint64_t tsc_offset, uint16_t lcore)
{
struct spdk_trace_tpoint *d;
struct object_stats *stats;
d = &g_histories->flags.tpoint[e->tpoint_id];
stats = &g_stats[d->object_type];
if (d->new_object) {
stats->index[e->object_id] = stats->counter++;
stats->tpoint_id[e->object_id] = e->tpoint_id;
stats->start[e->object_id] = e->tsc;
stats->size[e->object_id] = e->size;
}
if (g_verbose) {
print_event(e, tsc_rate, tsc_offset, lcore);
}