Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2014 20:20:52 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r265604 - stable/10/usr.sbin/pmcstat
Message-ID:  <201405072020.s47KKqOb066250@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Wed May  7 20:20:52 2014
New Revision: 265604
URL: http://svnweb.freebsd.org/changeset/base/265604

Log:
  Merged r262424-262425,265085
  
  Add the -a option to pmcstat.  This produces a full stack track on the
  sampled points.  See the man page for details on how this works.
  
  Obtained from:  Netflix, Inc.

Added:
  stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.c
     - copied, changed from r262424, head/usr.sbin/pmcstat/pmcpl_annotate_cg.c
  stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.h
     - copied, changed from r262424, head/usr.sbin/pmcstat/pmcpl_annotate_cg.h
Modified:
  stable/10/usr.sbin/pmcstat/Makefile
  stable/10/usr.sbin/pmcstat/pmcstat.8
  stable/10/usr.sbin/pmcstat/pmcstat.c
  stable/10/usr.sbin/pmcstat/pmcstat.h
  stable/10/usr.sbin/pmcstat/pmcstat_log.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pmcstat/Makefile
==============================================================================
--- stable/10/usr.sbin/pmcstat/Makefile	Wed May  7 20:18:50 2014	(r265603)
+++ stable/10/usr.sbin/pmcstat/Makefile	Wed May  7 20:20:52 2014	(r265604)
@@ -9,6 +9,7 @@ DPADD=	${LIBELF} ${LIBKVM} ${LIBPMC} ${L
 LDADD=	-lelf -lkvm -lpmc -lm -lncurses
 
 SRCS=	pmcstat.c pmcstat.h pmcstat_log.c \
-pmcpl_callgraph.c pmcpl_gprof.c pmcpl_annotate.c pmcpl_calltree.c
+pmcpl_callgraph.c pmcpl_gprof.c pmcpl_annotate.c \
+pmcpl_annotate_cg.c pmcpl_calltree.c
 
 .include <bsd.prog.mk>

Copied and modified: stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.c (from r262424, head/usr.sbin/pmcstat/pmcpl_annotate_cg.c)
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_annotate_cg.c	Mon Feb 24 02:43:58 2014	(r262424, copy source)
+++ stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.c	Wed May  7 20:20:52 2014	(r265604)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 2005-2007, Joseph Koshy
  * Copyright (c) 2007 The FreeBSD Foundation
+ * Copyright (c) 2014, Adrian Chadd, Netflix Inc.
  * All rights reserved.
  *
  * Portions of this software were developed by A. Joseph Koshy under

Copied and modified: stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.h (from r262424, head/usr.sbin/pmcstat/pmcpl_annotate_cg.h)
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_annotate_cg.h	Mon Feb 24 02:43:58 2014	(r262424, copy source)
+++ stable/10/usr.sbin/pmcstat/pmcpl_annotate_cg.h	Wed May  7 20:20:52 2014	(r265604)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 2005-2007, Joseph Koshy
  * Copyright (c) 2007 The FreeBSD Foundation
+ * Copyright (c) 2014, Adrian Chadd, Netflix Inc.
  * All rights reserved.
  *
  * Portions of this software were developed by A. Joseph Koshy under

Modified: stable/10/usr.sbin/pmcstat/pmcstat.8
==============================================================================
--- stable/10/usr.sbin/pmcstat/pmcstat.8	Wed May  7 20:18:50 2014	(r265603)
+++ stable/10/usr.sbin/pmcstat/pmcstat.8	Wed May  7 20:20:52 2014	(r265604)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 19, 2008
+.Dd April 29, 2014
 .Dt PMCSTAT 8
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Op Fl S Ar event-spec
 .Op Fl T
 .Op Fl W
+.Op Fl a Ar pathname
 .Op Fl c Ar cpu-spec
 .Op Fl d
 .Op Fl f Ar pluginopt
@@ -221,6 +222,21 @@ This is an experimental feature intended
 dynamic behaviour of processes in the system.
 It may incur substantial overhead if enabled.
 The default is for this feature to be disabled.
+.It Fl a Ar pathname
+Perform a symbol and file:line lookup for each address in each
+callgraph and save the output to
+.Ar pathname .
+Unlike
+.Fl m
+that only resolves the first symbol in the graph, this resolves
+every node in the callgraph, or prints out addresses if no
+lookup information is available.
+This option requires the
+.Fl R
+option to read in samples that were previously collected and
+saved with the 
+.Fl o
+option.
 .It Fl c Ar cpu-spec
 Set the cpus for subsequent system mode PMCs specified on the
 command line to

Modified: stable/10/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- stable/10/usr.sbin/pmcstat/pmcstat.c	Wed May  7 20:18:50 2014	(r265603)
+++ stable/10/usr.sbin/pmcstat/pmcstat.c	Wed May  7 20:20:52 2014	(r265604)
@@ -503,6 +503,7 @@ pmcstat_show_usage(void)
 	    "\t -S spec\t allocate a system-wide sampling PMC\n"
 	    "\t -T\t\t start in top mode\n"
 	    "\t -W\t\t (toggle) show counts per context switch\n"
+	    "\t -a <file>\t print sampled PCs and callgraph to \"file\"\n"
 	    "\t -c cpu-list\t set cpus for subsequent system-wide PMCs\n"
 	    "\t -d\t\t (toggle) track descendants\n"
 	    "\t -f spec\t pass \"spec\" to as plugin option\n"
@@ -617,8 +618,14 @@ main(int argc, char **argv)
 		CPU_SET(hcpu, &cpumask);
 
 	while ((option = getopt(argc, argv,
-	    "CD:EF:G:M:NO:P:R:S:TWc:df:gk:m:n:o:p:qr:s:t:vw:z:")) != -1)
+	    "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:m:n:o:p:qr:s:t:vw:z:")) != -1)
 		switch (option) {
+		case 'a':	/* Annotate + callgraph */
+			args.pa_flags |= FLAG_DO_ANNOTATE;
+			args.pa_plugin = PMCSTAT_PL_ANNOTATE_CG;
+			graphfilename  = optarg;
+			break;
+
 		case 'C':	/* cumulative values */
 			use_cumulative_counts = !use_cumulative_counts;
 			args.pa_required |= FLAG_HAS_COUNTING_PMCS;
@@ -917,7 +924,8 @@ main(int argc, char **argv)
 
 	/* -m option is allowed with -R only. */
 	if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL)
-		errx(EX_USAGE, "ERROR: option -m requires an input file");
+		errx(EX_USAGE, "ERROR: option %s requires an input file",
+		    args.pa_plugin == PMCSTAT_PL_ANNOTATE ? "-m" : "-a");
 
 	/* -m option is not allowed combined with -g or -G. */
 	if (args.pa_flags & FLAG_DO_ANNOTATE &&

Modified: stable/10/usr.sbin/pmcstat/pmcstat.h
==============================================================================
--- stable/10/usr.sbin/pmcstat/pmcstat.h	Wed May  7 20:18:50 2014	(r265603)
+++ stable/10/usr.sbin/pmcstat/pmcstat.h	Wed May  7 20:20:52 2014	(r265604)
@@ -91,6 +91,7 @@
 #define PMCSTAT_PL_GPROF	2
 #define PMCSTAT_PL_ANNOTATE	3
 #define PMCSTAT_PL_CALLTREE	4
+#define PMCSTAT_PL_ANNOTATE_CG	5
 
 #define PMCSTAT_TOP_DELTA 	0
 #define PMCSTAT_TOP_ACCUM	1

Modified: stable/10/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- stable/10/usr.sbin/pmcstat/pmcstat_log.c	Wed May  7 20:18:50 2014	(r265603)
+++ stable/10/usr.sbin/pmcstat/pmcstat_log.c	Wed May  7 20:20:52 2014	(r265604)
@@ -149,6 +149,7 @@ struct pmcstat_process *pmcstat_kernproc
 #include "pmcpl_gprof.h"
 #include "pmcpl_callgraph.h"
 #include "pmcpl_annotate.h"
+#include "pmcpl_annotate_cg.h"
 #include "pmcpl_calltree.h"
 
 static struct pmc_plugins  {
@@ -214,6 +215,11 @@ static struct pmc_plugins  {
 		.pl_topdisplay		= pmcpl_ct_topdisplay
 	},
 	{
+		.pl_name		= "annotate_cg",
+		.pl_process		= pmcpl_annotate_cg_process
+	},
+
+	{
 		.pl_name		= NULL
 	}
 };



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