summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2006-04-05 15:12:25 +0000
committerjkoshy <jkoshy@FreeBSD.org>2006-04-05 15:12:25 +0000
commit435490fd44444f7e638eb8a518e43c30b5e06762 (patch)
treef1617fee4b2c3227dc36e682f958ab33508818b6 /usr.sbin/pmcstat
parente41986c80d27fde142feb57ad5abdebfcbbd4f29 (diff)
downloadFreeBSD-src-435490fd44444f7e638eb8a518e43c30b5e06762.zip
FreeBSD-src-435490fd44444f7e638eb8a518e43c30b5e06762.tar.gz
When printing a map, print the number of samples recorded by each gmon.out file.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index 0beb7c7..be81082 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -135,6 +135,7 @@ struct pmcstat_gmonfile {
int pgf_overflow; /* whether a count overflowed */
pmc_id_t pgf_pmcid; /* id of the associated pmc */
size_t pgf_nbuckets; /* #buckets in this gmon.out */
+ unsigned int pgf_nsamples; /* #samples in this gmon.out */
pmcstat_interned_string pgf_name; /* pathname of gmon.out file */
size_t pgf_ndatabytes; /* number of bytes mapped */
void *pgf_gmondata; /* pointer to mmap'ed data */
@@ -910,6 +911,7 @@ pmcstat_image_increment_bucket(struct pmcstat_pcmap *map, uintfptr_t pc,
FUNCTION_ALIGNMENT; /* see <machine/profile.h> */
pgf->pgf_ndatabytes = sizeof(struct gmonhdr) +
pgf->pgf_nbuckets * sizeof(HISTCOUNTER);
+ pgf->pgf_nsamples = 0;
pmcstat_gmon_create_file(pgf, image);
@@ -941,6 +943,8 @@ pmcstat_image_increment_bucket(struct pmcstat_pcmap *map, uintfptr_t pc,
hc[bucket]++;
else /* mark that an overflow occurred */
pgf->pgf_overflow = 1;
+
+ pgf->pgf_nsamples++;
}
/*
@@ -1796,22 +1800,31 @@ pmcstat_shutdown_logging(struct pmcstat_args *a)
for (i = 0; i < PMCSTAT_NHASH; i++) {
LIST_FOREACH_SAFE(pi, &pmcstat_image_hash[i], pi_next, pitmp) {
+
+ if (mf)
+ (void) fprintf(mf, " \"%s\" => \"%s\"",
+ pmcstat_string_unintern(pi->pi_execpath),
+ pmcstat_string_unintern(pi->pi_samplename));
+
/* flush gmon.out data to disk */
LIST_FOREACH_SAFE(pgf, &pi->pi_gmlist, pgf_next,
pgftmp) {
pmcstat_gmon_unmap_file(pgf);
LIST_REMOVE(pgf, pgf_next);
-
+ if (mf)
+ (void) fprintf(mf, " %s/%d",
+ pmcstat_pmcid_to_name(pgf->pgf_pmcid),
+ pgf->pgf_nsamples);
if (pgf->pgf_overflow && a->pa_verbosity >= 1)
warnx("WARNING: profile \"%s\" "
"overflowed.",
- pmcstat_string_unintern(pgf->pgf_name));
+ pmcstat_string_unintern(
+ pgf->pgf_name));
free(pgf);
}
+
if (mf)
- (void) fprintf(mf, " \"%s\" -> \"%s\"\n",
- pmcstat_string_unintern(pi->pi_execpath),
- pmcstat_string_unintern(pi->pi_samplename));
+ (void) fprintf(mf, "\n");
LIST_REMOVE(pi, pi_next);
free(pi);
OpenPOWER on IntegriCloud