Skip to contentSkip to conversation

opensm/console: add perfmgr "print_errors" (pe) console command.

PATCH New Ira Weiny 1 participant 1 message Jul 11, 2012 InfiniBand

lore
Share & tools
lore

Ira Weiny

author
#0 lore raw

PATCH v2 10/10 opensm/console: add perfmgr "print_errors" (pe) console command.

Only print ports with error counters > 0

Changes since V1:
My rebase got cross wired for the console help message. Fix this.

---
 include/opensm/osm_perfmgr.h    |    2 +-
 include/opensm/osm_perfmgr_db.h |    6 +-
 opensm/osm_console.c            |   14 +++++-
 opensm/osm_perfmgr.c            |   10 ++--
 opensm/osm_perfmgr_db.c         |  103 ++++++++++++++++++++++++---------------
 5 files changed, 86 insertions(+), 49 deletions(-)
include/opensm/osm_perfmgr.h +1 -1
index 68cf7f3..97fead1 100644
@@ -246,7 +246,7 @@ void osm_perfmgr_clear_counters(osm_perfmgr_t * p_perfmgr);
 void osm_perfmgr_dump_counters(osm_perfmgr_t * p_perfmgr,
 			       perfmgr_db_dump_t dump_type);
 void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp,
-				char *port);
+				char *port, int err_only);
 
 ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * p_perfmgr,
 				 ib_net64_t port_guid);
include/opensm/osm_perfmgr_db.h +3 -3
index d6c8feb..6333692 100644
@@ -190,11 +190,11 @@ perfmgr_db_err_t perfmgr_db_mark_active(perfmgr_db_t *db, uint64_t guid,
 void perfmgr_db_clear_counters(perfmgr_db_t * db);
 perfmgr_db_err_t perfmgr_db_dump(perfmgr_db_t * db, char *file,
 				 perfmgr_db_dump_t dump_type);
-void perfmgr_db_print_all(perfmgr_db_t * db, FILE *fp);
+void perfmgr_db_print_all(perfmgr_db_t * db, FILE *fp, int err_only);
 void perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp,
-			      char *port);
+			      char *port, int err_only);
 void perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t guid, FILE *fp,
-			      char *port);
+			      char *port, int err_only);
 
 /** =========================================================================
  * helper functions to fill in the various db objects from wire objects
opensm/osm_console.c +12 -2
index fd247c9..789092f 100644
@@ -240,7 +240,7 @@ static void help_perfmgr(FILE * out, int detail)
 {
 	fprintf(out,
 		"perfmgr(pm) [enable|disable\n"
-		"             |clear_counters|dump_counters|print_counters(pc)\n"
+		"             |clear_counters|dump_counters|print_counters(pc)|print_errors(pe)\n"
 		"             |set_rm_nodes|clear_rm_nodes|clear_inactive\n"
 		"             |dump_redir|clear_redir|sweep_time[seconds]]\n");
 	if (detail) {
@@ -260,6 +260,11 @@ static void help_perfmgr(FILE * out, int detail)
 		fprintf(out,
 			"   [pc [<nodename|nodeguid>][:<port>]] -- same as print_counters\n");
 		fprintf(out,
+			"   [print_errors [<nodename|nodeguid>]] -- print only ports with errors\n"
+			"                                           Optionaly limit output by name or guid\n");
+		fprintf(out,
+			"   [pe [<nodename|nodeguid>]] -- same as print_errors\n");
+		fprintf(out,
 			"   [dump_redir [<nodename|nodeguid>]] -- dump the redirection table\n");
 		fprintf(out,
 			"   [clear_redir [<nodename|nodeguid>]] -- clear the redirection table\n");
@@ -1487,7 +1492,12 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 				}
 			}
 			osm_perfmgr_print_counters(&p_osm->perfmgr, p_cmd,
-						   out, port);
+						   out, port, 0);
+		} else if (strcmp(p_cmd, "print_errors") == 0 ||
+			   strcmp(p_cmd, "pe") == 0) {
+			p_cmd = name_token(p_last);
+			osm_perfmgr_print_counters(&p_osm->perfmgr, p_cmd,
+						   out, NULL, 1);
 		} else if (strcmp(p_cmd, "dump_redir") == 0) {
 			p_cmd = name_token(p_last);
 			dump_redir(p_osm, p_cmd, out);
opensm/osm_perfmgr.c +6 -4
index 456c163..e47935a 100644
@@ -1437,16 +1437,18 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)
  * Print the DB information to the fp specified
  *******************************************************************/
 void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp,
-				char *port)
+				char *port, int err_only)
 {
 	if (nodename) {
 		char *end = NULL;
 		uint64_t guid = strtoull(nodename, &end, 0);
 		if (nodename + strlen(nodename) != end)
-			perfmgr_db_print_by_name(pm->db, nodename, fp, port);
+			perfmgr_db_print_by_name(pm->db, nodename, fp, port,
+						 err_only);
 		else
-			perfmgr_db_print_by_guid(pm->db, guid, fp, port);
+			perfmgr_db_print_by_guid(pm->db, guid, fp, port,
+						 err_only);
 	} else
-		perfmgr_db_print_all(pm->db, fp);
+		perfmgr_db_print_all(pm->db, fp, err_only);
 }
 #endif				/* ENABLE_OSM_PERF_MGR */
opensm/osm_perfmgr_db.c +64 -39

164 lines not on this page · raw message

Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html