Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
providers/rxe: Add tracepoint for post send
Add initial support for RXE LTTng tracing using compiled out macros if LTTng flag isn't provided. Once LTTng records tracepoints, an example of python script to analyze per-qp traffic: #!/usr/bin/env python3 # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2023, Bytedance. All rights reserved. See COPYING file import argparse import bt2 import collections import sys def stats(args): stats = {} tcm_it = bt2.TraceCollectionMessageIterator(args.tracepoints) for msg in tcm_it: if type(msg) is not bt2._EventMessageConst: continue event = msg.event if event.cls.name != "rdma_core_rxe:post_send": continue # device filter dev = str(event.payload_field["dev"]) if args.device != None and args.device != dev: continue; # QPN filter qpn = event.payload_field['src_qp_num'] if args.qpn != None and args.qpn != qpn: continue; # opcode filter opcode = event.payload_field['opcode'] if args.opcode != None and args.opcode != opcode: continue; key = dev + "-" + str(qpn) qpstats = stats.get(key) if qpstats is None: qpstats = {} qpstats["dev"] = dev qpstats["qpn"] = qpn qpstats["bytes"] = 0 qpstats["ops"] = 0 stats[key] = qpstats bytes = event.payload_field['bytes'] qpstats["bytes"] += bytes qpstats["ops"] += 1 qpstat = qpstats.get(opcode) if qpstat is None: qpstats[opcode] = bytes else: qpstats[opcode] += bytes # sorted by total bytes of a QP sorted_stats = sorted(stats.items(), key=lambda item: (item[1].get("bytes", 0)), reverse=True) # show header print("%16s %10s %10s %10s" % ("Device", "QPN", "Bytes", "Operations")) # show QP stats for qpstats in sorted_stats: stats = qpstats[1] print("%16s %10d %10d %10d" % (stats["dev"], stats["qpn"], stats["bytes"], stats["ops"])) def parse_arg(): examples = """LTTng tracing examples: # lttng create rdma-core-stats-session # lttng list --userspace # lttng enable-event --userspace rdma_core_ibverbs:post_send # lttng start # ... # lttng destroy # ibv_stats -t /path/to/lttng/tracepoints """ parser = argparse.ArgumentParser( description="Summarize IB verbs statistics", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=examples) parser.add_argument("-t", "--tracepoints", help="specify the LTTng tracepoints directory") parser.add_argument("-d", "--device", help="specify IB device filter") parser.add_argument("-q", "--qpn", type=int, help="specify source QP number filter") parser.add_argument("-o", "--opcode", help="specify opcode filter") return parser.parse_args() if __name__ == '__main__': args = parse_arg() if args.tracepoints is None: print("Missing LTTng tracepoints directory(use -t/--tracepoints)") sys.exit(0) stats(args) Signed-off-by: zhenwei pi <[email protected]>
- Loading branch information