diff options
author | fabient <fabient@FreeBSD.org> | 2010-03-28 22:46:56 +0000 |
---|---|---|
committer | fabient <fabient@FreeBSD.org> | 2010-03-28 22:46:56 +0000 |
commit | da13321f0367c93e6227866043622792c016f3a2 (patch) | |
tree | 034692b2e080d32b69b8bd266b1fbd950907341d /usr.sbin/pmcstat | |
parent | 9b74cb340c6ec643364babbb29e8ff3c9c1cbeef (diff) | |
download | FreeBSD-src-da13321f0367c93e6227866043622792c016f3a2.zip FreeBSD-src-da13321f0367c93e6227866043622792c016f3a2.tar.gz |
Wait for pmc name in the log before displaying data.
This will solve an abort in case of low throughput PMCs.
MFC after: 3days
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r-- | usr.sbin/pmcstat/pmcstat_log.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index fc26001..9b524ff 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -1049,7 +1049,6 @@ pmcstat_pmcindex_to_name(int pmcin) if (pr->pr_pmcin == pmcin) return pmcstat_string_unintern(pr->pr_pmcname); - err(EX_SOFTWARE, "ERROR: cannot find pmcid name"); return NULL; } @@ -1789,19 +1788,23 @@ static void pmcstat_refresh_top(void) { char pmcname[40]; + const char *s; /* If in pause mode do not refresh display. */ if (pmcstat_pause) return; + /* Wait until PMC pop in the log. */ + s = pmcstat_pmcindex_to_name(pmcstat_pmcinfilter); + if (s == NULL) + return; + /* Format PMC name. */ if (pmcstat_mergepmc) - snprintf(pmcname, sizeof(pmcname), "[%s]", - pmcstat_pmcindex_to_name(pmcstat_pmcinfilter)); + snprintf(pmcname, sizeof(pmcname), "[%s]", s); else snprintf(pmcname, sizeof(pmcname), "%s.%d", - pmcstat_pmcindex_to_name(pmcstat_pmcinfilter), - pmcstat_pmcinfilter); + s, pmcstat_pmcinfilter); PMCSTAT_PRINTBEGIN(); PMCSTAT_PRINTW("PMC: %s Samples: %u processed, %u invalid\n\n", |