aboutsummaryrefslogtreecommitdiff
path: root/lib/libpmcstat/libpmcstat_logging.c
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-05-26 19:26:19 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-05-26 19:26:19 +0000
commit5506ceb87fa19140863b4e3ee978f631ccc4cf74 (patch)
tree895b12b3b0657b0b43d37103be78fac70a471522 /lib/libpmcstat/libpmcstat_logging.c
parent4928135658a9d0eaee37003df6137ab363fcb0b4 (diff)
downloadsrc-5506ceb87fa19140863b4e3ee978f631ccc4cf74.tar.gz
src-5506ceb87fa19140863b4e3ee978f631ccc4cf74.zip
Revert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the"
because of squash commit messages
Notes
Notes: svn path=/head/; revision=334243
Diffstat (limited to 'lib/libpmcstat/libpmcstat_logging.c')
-rw-r--r--lib/libpmcstat/libpmcstat_logging.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/lib/libpmcstat/libpmcstat_logging.c b/lib/libpmcstat/libpmcstat_logging.c
index 42054e636b4b..71ee524bbd8c 100644
--- a/lib/libpmcstat/libpmcstat_logging.c
+++ b/lib/libpmcstat/libpmcstat_logging.c
@@ -195,6 +195,7 @@ pmcstat_analyze_log(struct pmcstat_args *args,
int *ps_samples_period)
{
uint32_t cpu, cpuflags;
+ uintfptr_t pc;
pid_t pid;
struct pmcstat_image *image;
struct pmcstat_process *pp, *ppnew;
@@ -267,6 +268,44 @@ pmcstat_analyze_log(struct pmcstat_args *args,
ev.pl_u.pl_mo.pl_end);
break;
+ case PMCLOG_TYPE_PCSAMPLE:
+ /*
+ * Note: the `PCSAMPLE' log entry is not
+ * generated by hpwmc(4) after version 2.
+ */
+
+ /*
+ * We bring in the gmon file for the image
+ * currently associated with the PMC & pid
+ * pair and increment the appropriate entry
+ * bin inside this.
+ */
+ pmcstat_stats->ps_samples_total++;
+ *ps_samples_period += 1;
+
+ pc = ev.pl_u.pl_s.pl_pc;
+ pp = pmcstat_process_lookup(ev.pl_u.pl_s.pl_pid,
+ PMCSTAT_ALLOCATE);
+
+ /* Get PMC record. */
+ pmcr = pmcstat_lookup_pmcid(ev.pl_u.pl_s.pl_pmcid, pmcstat_mergepmc);
+ assert(pmcr != NULL);
+ pmcr->pr_samples++;
+
+ /*
+ * Call the plugins processing
+ * TODO: move pmcstat_process_find_map inside plugins
+ */
+
+ if (plugins[args->pa_pplugin].pl_process != NULL)
+ plugins[args->pa_pplugin].pl_process(
+ pp, pmcr, 1, &pc,
+ pmcstat_process_find_map(pp, pc) != NULL, 0);
+ plugins[args->pa_plugin].pl_process(
+ pp, pmcr, 1, &pc,
+ pmcstat_process_find_map(pp, pc) != NULL, 0);
+ break;
+
case PMCLOG_TYPE_CALLCHAIN:
pmcstat_stats->ps_samples_total++;
*ps_samples_period += 1;
@@ -414,8 +453,8 @@ pmcstat_analyze_log(struct pmcstat_args *args,
return (PMCSTAT_RUNNING);
err(EX_DATAERR,
- "ERROR: event parsing failed state: %d type: %d (record %jd, offset 0x%jx)",
- ev.pl_state, ev.pl_type, (uintmax_t) ev.pl_count + 1, ev.pl_offset);
+ "ERROR: event parsing failed (record %jd, offset 0x%jx)",
+ (uintmax_t) ev.pl_count + 1, ev.pl_offset);
}
/*