diff options
author | Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com> | 2020-05-11 18:07:01 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-05-21 16:23:57 +0200 |
commit | 7638c0e965f48d773d8684d38e0967e4d0ee238c (patch) | |
tree | fb656c27b0e34b2adfea478c356eb0ebeb14e249 /drivers/infiniband/hw/hfi1/trace.c | |
parent | IB/{hfi1, ipoib, rdma}: Broadcast ping sent packets which exceeded mtu size (diff) | |
download | linux-7638c0e965f48d773d8684d38e0967e4d0ee238c.tar.xz linux-7638c0e965f48d773d8684d38e0967e4d0ee238c.zip |
IB/hfi1: Add packet histogram trace event
Add a simple trace event taking context number and building simple
histogram to print packets distribution between contexts.
Link: https://lore.kernel.org/r/20200511160700.173205.84270.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/trace.c')
-rw-r--r-- | drivers/infiniband/hw/hfi1/trace.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/trace.c b/drivers/infiniband/hw/hfi1/trace.c index c8a9988d972d..b219ea90fd6f 100644 --- a/drivers/infiniband/hw/hfi1/trace.c +++ b/drivers/infiniband/hw/hfi1/trace.c @@ -520,6 +520,38 @@ u16 hfi1_trace_get_tid_idx(u32 ent) return EXP_TID_GET(ent, IDX); } +struct hfi1_ctxt_hist { + atomic_t count; + atomic_t data[255]; +}; + +struct hfi1_ctxt_hist hist = { + .count = ATOMIC_INIT(0) +}; + +const char *hfi1_trace_print_rsm_hist(struct trace_seq *p, unsigned int ctxt) +{ + int i, len = ARRAY_SIZE(hist.data); + const char *ret = trace_seq_buffer_ptr(p); + unsigned long packet_count = atomic_fetch_inc(&hist.count); + + trace_seq_printf(p, "packet[%lu]", packet_count); + for (i = 0; i < len; ++i) { + unsigned long val; + atomic_t *count = &hist.data[i]; + + if (ctxt == i) + val = atomic_fetch_inc(count); + else + val = atomic_read(count); + + if (val) + trace_seq_printf(p, "(%d:%lu)", i, val); + } + trace_seq_putc(p, 0); + return ret; +} + __hfi1_trace_fn(AFFINITY); __hfi1_trace_fn(PKT); __hfi1_trace_fn(PROC); |