Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177920235
D58698.1795573511.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D58698.1795573511.diff
View Options
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -4884,6 +4884,16 @@
pmc_multipart_copydata(ps, mp);
}
+ if (((pm->pm_flags & PMC_F_BRANCHHIST) != 0) &&
+ (mp->pmd_branch != NULL)) {
+ if (mp == NULL) {
+ ps->ps_flags |= PMC_CC_F_MULTIPART;
+ ps->ps_pc[0] = 0;
+ ps->ps_nsamples_actual = 1;
+ }
+ mp->pmd_branch(ps);
+ }
+
if (callchaindepth == 1) {
ps->ps_pc[ps->ps_nsamples_actual] = PMC_TRAPFRAME_TO_PC(tf);
} else {
diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h
--- a/sys/sys/pmc.h
+++ b/sys/sys/pmc.h
@@ -59,8 +59,8 @@
*
* The patch version is incremented for every bug fix.
*/
-#define PMC_VERSION_MAJOR 0x0A
-#define PMC_VERSION_MINOR 0x03
+#define PMC_VERSION_MAJOR 0x0B
+#define PMC_VERSION_MINOR 0x01
#define PMC_VERSION_PATCH 0x0000
#define PMC_VERSION (PMC_VERSION_MAJOR << 24 | \
@@ -382,6 +382,9 @@
* through class-dependent fields
*/
+/* V11 API */
+#define PMC_F_BRANCHHIST 0x00000400 /*OP ALLOCATE capture branch history */
+
/* internal flags */
#define PMC_F_ATTACHED_TO_OWNER 0x00010000 /*attached to owner*/
#define PMC_F_NEEDS_LOGFILE 0x00020000 /*needs log file */
@@ -1095,6 +1098,9 @@
/* handle a PMC interrupt */
int (*pmd_intr)(struct trapframe *_tf);
+ /* branch history callback */
+ int (*pmd_branch)(struct pmc_sample *ps);
+
/*
* PMC class dependent information.
*/
diff --git a/sys/sys/pmclog.h b/sys/sys/pmclog.h
--- a/sys/sys/pmclog.h
+++ b/sys/sys/pmclog.h
@@ -138,6 +138,7 @@
#define PMC_CC_MULTIPART_CALLCHAIN 1
#define PMC_CC_MULTIPART_IBS_FETCH 2
#define PMC_CC_MULTIPART_IBS_OP 3
+#define PMC_CC_MULTIPART_BRANCHHIST 4
struct pmclog_closelog {
PMCLOG_ENTRY_HEADER
diff --git a/usr.sbin/pmcstat/pmcstat.8 b/usr.sbin/pmcstat/pmcstat.8
--- a/usr.sbin/pmcstat/pmcstat.8
+++ b/usr.sbin/pmcstat/pmcstat.8
@@ -32,6 +32,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl A
+.Op Fl B
.Op Fl C
.Op Fl D Ar pathname
.Op Fl E
@@ -127,6 +128,8 @@
.Bl -tag -width indent
.It Fl A
Skip symbol lookup and display address instead.
+.It Fl B
+Toggle branch history collection.
.It Fl C
Toggle between showing cumulative or incremental counts for
subsequent counting mode PMCs specified on the command line.
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -356,6 +356,7 @@
"\t Measure process and/or system performance using hardware\n"
"\t performance monitoring counters.\n"
"\t Options include:\n"
+ "\t -B\t\t (toggle) capture branch history\n"
"\t -C\t\t (toggle) show cumulative counts\n"
"\t -D path\t create profiles in directory \"path\"\n"
"\t -E\t\t (toggle) show counts at process exit\n"
@@ -443,7 +444,7 @@
double duration;
int option, npmc;
int c, check_driver_stats;
- int do_callchain, do_descendants, do_logproccsw, do_logprocexit;
+ int do_branchhist, do_callchain, do_descendants, do_logproccsw, do_logprocexit;
int do_print, do_read, do_listcounters, do_descr, domains;
int do_userspace, i;
size_t len;
@@ -465,6 +466,7 @@
check_driver_stats = 0;
current_sampling_count = 0;
+ do_branchhist = 0;
do_callchain = 1;
do_descr = 0;
do_descendants = 0;
@@ -519,7 +521,7 @@
CPU_COPY(&rootmask, &cpumask);
while ((option = getopt(argc, argv,
- "ACD:EF:G:ILM:NO:P:R:S:TUWZa:c:def:gi:l:m:n:o:p:qr:s:t:u:vw:z:")) != -1)
+ "ABCD:EF:G:ILM:NO:P:R:S:TUWZa:c:def:gi:l:m:n:o:p:qr:s:t:u:vw:z:")) != -1)
switch (option) {
case 'A':
args.pa_flags |= FLAG_SKIP_TOP_FN_RES;
@@ -531,6 +533,11 @@
graphfilename = optarg;
break;
+ case 'B':
+ do_branchhist = !do_branchhist;
+ args.pa_required |= FLAG_HAS_SAMPLING_PMCS;
+ break;
+
case 'C': /* cumulative values */
use_cumulative_counts = !use_cumulative_counts;
args.pa_required |= FLAG_HAS_COUNTING_PMCS;
@@ -688,6 +695,8 @@
if (do_userspace)
ev->ev_flags |= PMC_F_USERCALLCHAIN;
}
+ if (do_branchhist)
+ ev->ev_flags |= PMC_F_BRANCHHIST;
if (do_descendants)
ev->ev_flags |= PMC_F_DESCENDANTS;
if (do_logprocexit)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 2:25 AM (23 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41975558
Default Alt Text
D58698.1795573511.diff (4 KB)
Attached To
Mode
D58698: pmc: Branch history interface
Attached
Detach File
Event Timeline