[openib-general] [PATCH 2/2] Diags/perfquery: Add support for PortExtendedCounters

Hal Rosenstock halr at voltaire.com
Sat Oct 21 06:44:58 PDT 2006


Diags/perfquery: Add support for PortExtendedCounters

Note that this patch requires the associated libibmad patch

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: src/perfquery.c
===================================================================
--- src/perfquery.c	(revision 9827)
+++ src/perfquery.c	(working copy)
@@ -42,7 +42,7 @@
 #include <stdarg.h>
 #include <getopt.h>
 
-#define __BUILD_VERSION_TAG__ 1.1
+#define __BUILD_VERSION_TAG__ 1.2
 #include <common.h>
 #include <umad.h>
 #include <mad.h>
@@ -89,9 +89,12 @@ usage(void)
 	fprintf(stderr, "\tExamples:\n");
 	fprintf(stderr, "\t\t%s\t\t# read local port's performance counters\n", basename);
 	fprintf(stderr, "\t\t%s 32 1\t\t# read performance counters from lid 32, port 1\n", basename);
+	fprintf(stderr, "\t\t%s -e 32 1\t# read extended performance counters from lid 32, port 1\n", basename);
 	fprintf(stderr, "\t\t%s -a 32\t\t# read performance counters from lid 32, all ports\n", basename);
 	fprintf(stderr, "\t\t%s -r 32 1\t# read performance counters and reset\n", basename);
+	fprintf(stderr, "\t\t%s -e -r 32 1\t# read extended performance counters and reset\n", basename);
 	fprintf(stderr, "\t\t%s -R 0x20 1\t# reset performance counters of port 1 only\n", basename);
+	fprintf(stderr, "\t\t%s -e -R 0x20 1\t# reset extended performance counters of port 1 only\n", basename);
 	fprintf(stderr, "\t\t%s -R -a 32\t# reset performance counters of all ports\n", basename);
 	fprintf(stderr, "\t\t%s -R 32 2 0x0fff\t# reset only error counters of port 2\n", basename);
 	fprintf(stderr, "\t\t%s -R 32 2 0xf000\t# reset only non-error counters of port 2\n", basename);
@@ -114,13 +117,15 @@ main(int argc, char **argv)
 	int udebug = 0;
 	char *ca = 0;
 	int ca_port = 0;
+	int extended = 0;
 
-	static char const str_opts[] = "C:P:s:t:dGarRVhu";
+	static char const str_opts[] = "C:P:s:t:dGearRVhu";
 	static const struct option long_opts[] = {
 		{ "C", 1, 0, 'C'},
 		{ "P", 1, 0, 'P'},
 		{ "debug", 0, 0, 'd'},
 		{ "Guid", 0, 0, 'G'},
+		{ "extended", 0, 0, 'e'},
 		{ "all_ports", 0, 0, 'a'},
 		{ "reset_after_read", 0, 0, 'r'},
 		{ "Reset_only", 0, 0, 'R'},
@@ -145,6 +150,9 @@ main(int argc, char **argv)
 		case 'P':
 			ca_port = strtoul(optarg, 0, 0);
 			break;
+		case 'e':
+			extended = 1;
+			break;
 		case 'a':
 			all++;
 			port = 0xff;
@@ -205,18 +213,30 @@ main(int argc, char **argv)
 	if (!perf_classportinfo_query(pc, &portid, port, timeout))
 		IBERROR("classportinfo query");
 
-	if (!port_performance_query(pc, &portid, port, timeout))
-		IBERROR("perfquery");
+	if (extended != 1) {
+		if (!port_performance_query(pc, &portid, port, timeout))
+			IBERROR("perfquery");
+
+		mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
+	} else {
+		if (!port_performance_ext_query(pc, &portid, port, timeout))
+			IBERROR("perfextquery");
 
-	mad_dump_perfcounters(buf, sizeof buf, pc, sizeof pc);
+		mad_dump_perfcounters_ext(buf, sizeof buf, pc, sizeof pc);
+	}
 
 	printf("# Port counters: %s port %d\n%s", portid2str(&portid), port, buf);
 
 	if (!reset)
 		exit(0);
 do_reset:
-	if (!port_performance_reset(pc, &portid, port, mask, timeout))
-		IBERROR("perf reset");
+	if (extended != 1) {
+		if (!port_performance_reset(pc, &portid, port, mask, timeout))
+			IBERROR("perf reset");
+	} else {
+		if (!port_performance_ext_reset(pc, &portid, port, mask, timeout))
+			IBERROR("perf ext reset");
+	}
 
 	exit(0);
 }
Index: man/perfquery.8
===================================================================
--- man/perfquery.8	(revision 9827)
+++ man/perfquery.8	(working copy)
@@ -1,25 +1,30 @@
-.TH PERFQUERY 8 "October 9, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH PERFQUERY 8 "October 20, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 perfquery \- query InfiniBand port counters
 
 .SH SYNOPSIS
 .B perfquery 
-[\-d(ebug)] [\-G(uid)] [-a(ll_ports)] [-r(eset_after_read)] [-R(eset_only)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)] [<lid|guid> [[port] [reset_mask]]]
+[\-d(ebug)] [\-G(uid)] [-e(xtended)] [-a(ll_ports)] [-r(eset_after_read)] [-R(eset_only)] [\-C ca_name] [\-P ca_port] [\-t(imeout) timeout_ms] [\-V(ersion)] [\-h(elp)] [<lid|guid> [[port] [reset_mask]]]
 
 .SH DESCRIPTION
 .PP
 perfquery uses PerfMgt GMPs to obtain the PortCounters (basic performance
-and error counters) from the PMA at the node/port specified. Optionally 
-show aggregated counters for all ports of node. Also, optionally, reset 
-after read, or only reset counters.
+and error counters) or PortExtendedCounters from the PMA at the node/port 
+specified. Optionally shows aggregated counters for all ports of node. 
+Also, optionally, reset after read, or only reset counters.
 
 .SH OPTIONS
 
 .PP
 .TP
+\fB\-e\fR, \fB\-\-extended\fR
+show extended port counters rather than (basic) port counters.
+Note that extended port counters attribute is optional.
+.TP
 \fB\-a\fR, \fB\-\-all_ports\fR
-show aggregated counters for all ports of the destination lid
+show aggregated counters for all ports of the destination lid.
+Note all ports support is optional.
 .TP
 \fB\-r\fR, \fB\-\-reset_after_read\fR
 reset counters after read
@@ -88,12 +93,18 @@ perfquery               # read local por
 .PP
 perfquery 32 1          # read performance counters from lid 32, port 1
 .PP
+perfquery -e 32 1       # read extended performance counters from lid 32, port 1
+.PP
 perfquery -a 32         # read perf counters from lid 32, all ports
 .PP
 perfquery -r 32 1       # read performance counters and reset
 .PP
+perfquery -e -r 32 1    # read extended performance counters and reset
+.PP
 perfquery -R 0x20 1     # reset performance counters of port 1 only
 .PP
+perfquery -e -R 0x20 1  # reset extended performance counters of port 1 only
+.PP
 perfquery -R -a 32      # reset performance counters of all ports
 .PP
 perfquery -R 32 2 0x0fff # reset only error counters of port 2
Index: configure.in
===================================================================
--- configure.in	(revision 9935)
+++ configure.in	(working copy)
@@ -35,6 +35,8 @@ AC_CHECK_LIB(ibumad, umad_init, [],
 	AC_MSG_ERROR([umad_init() not found. diags require libibumad.]))
 AC_CHECK_LIB(ibmad, mad_dump_int, [],
 	AC_MSG_ERROR([mad_dump_int() not found. diags require libibmad.]))
+AC_CHECK_LIB(ibmad, port_performance_ext_query, [],
+	AC_MSG_ERROR([port_performance_ext_query() not found. diags require more recent libibmad.]))
 fi
 
 dnl Checks for header files.







More information about the general mailing list