Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2018 04:45:46 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334017 - in head: lib/libpmcstat usr.sbin/pmcstat
Message-ID:  <201805220445.w4M4jkRD041557@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Tue May 22 04:45:46 2018
New Revision: 334017
URL: https://svnweb.freebsd.org/changeset/base/334017

Log:
  pmcstat: add option to not decode the leaf function in top mode
  
  -I will allow the user to see the hot instruction in question
  as opposed getting the name of the function

Modified:
  head/lib/libpmcstat/libpmcstat.h
  head/usr.sbin/pmcstat/pmcpl_callgraph.c
  head/usr.sbin/pmcstat/pmcstat.c

Modified: head/lib/libpmcstat/libpmcstat.h
==============================================================================
--- head/lib/libpmcstat/libpmcstat.h	Tue May 22 04:08:08 2018	(r334016)
+++ head/lib/libpmcstat/libpmcstat.h	Tue May 22 04:45:46 2018	(r334017)
@@ -106,6 +106,7 @@ struct pmcstat_args {
 #define	FLAGS_HAS_CPUMASK		0x00040000	/* -c */
 #define	FLAG_HAS_DURATION		0x00080000	/* -l secs */
 #define	FLAG_DO_WIDE_GPROF_HC		0x00100000	/* -e */
+#define	FLAG_SKIP_TOP_FN_RES		0x00200000	/* -I */
 
 	int	pa_required;		/* required features */
 	int	pa_pplugin;		/* pre-processing plugin */

Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_callgraph.c	Tue May 22 04:08:08 2018	(r334016)
+++ head/usr.sbin/pmcstat/pmcpl_callgraph.c	Tue May 22 04:45:46 2018	(r334017)
@@ -473,7 +473,7 @@ pmcstat_callgraph_print(void)
 
 static void
 pmcstat_cgnode_topprint(struct pmcstat_cgnode *cg,
-    int depth, uint32_t nsamples)
+    int depth __unused, uint32_t nsamples)
 {
 	int v_attrs, vs_len, ns_len, width, len, n, nchildren;
 	float v;
@@ -481,15 +481,15 @@ pmcstat_cgnode_topprint(struct pmcstat_cgnode *cg,
 	struct pmcstat_symbol *sym;
 	struct pmcstat_cgnode **sortbuffer, **cgn, *pcg;
 
-	(void) depth;
-
 	/* Format value. */
 	v = PMCPL_CG_COUNTP(cg);
 	snprintf(vs, sizeof(vs), "%.1f", v);
 	v_attrs = PMCSTAT_ATTRPERCENT(v);
+	sym = NULL;
 
 	/* Format name. */
-	sym = pmcstat_symbol_search(cg->pcg_image, cg->pcg_func);
+	if (!(args.pa_flags & FLAG_SKIP_TOP_FN_RES))
+		sym = pmcstat_symbol_search(cg->pcg_image, cg->pcg_func);
 	if (sym != NULL) {
 		snprintf(ns, sizeof(ns), "%s",
 		    pmcstat_string_unintern(sym->ps_name));

Modified: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c	Tue May 22 04:08:08 2018	(r334016)
+++ head/usr.sbin/pmcstat/pmcstat.c	Tue May 22 04:45:46 2018	(r334017)
@@ -500,7 +500,7 @@ main(int argc, char **argv)
 	CPU_COPY(&rootmask, &cpumask);
 
 	while ((option = getopt(argc, argv,
-	    "CD:EF:G:M:NO:P:R:S:TWa:c:def:gk:l:m:n:o:p:qr:s:t:vw:z:")) != -1)
+	    "CD:EF:G:IM:NO:P:R:S:TWa:c:def:gk:l:m:n:o:p:qr:s:t:vw:z:")) != -1)
 		switch (option) {
 		case 'a':	/* Annotate + callgraph */
 			args.pa_flags |= FLAG_DO_ANNOTATE;
@@ -569,6 +569,9 @@ main(int argc, char **argv)
 			args.pa_plugin	= PMCSTAT_PL_GPROF;
 			break;
 
+		case 'I':
+			args.pa_flags |= FLAG_SKIP_TOP_FN_RES;
+			break;
 		case 'k':	/* pathname to the kernel */
 			free(args.pa_kernel);
 			args.pa_kernel = strdup(optarg);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805220445.w4M4jkRD041557>