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
This commit is contained in:
Matt Macy 2018-05-22 04:45:46 +00:00
parent b5e3928d6d
commit 821a352a77
3 changed files with 9 additions and 5 deletions

View File

@ -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 */

View File

@ -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));

View File

@ -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);