summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2007-12-03 10:29:49 +0000
committerjkoshy <jkoshy@FreeBSD.org>2007-12-03 10:29:49 +0000
commit4244e6396062d127c8e4c4b9a6d0851df613d428 (patch)
treeccd0a300b110c060a9175709d8459346d2ab986a /usr.sbin
parent4a9c2dfe5145a5971beccc8644e2e55d472aeb9e (diff)
downloadFreeBSD-src-4244e6396062d127c8e4c4b9a6d0851df613d428.zip
FreeBSD-src-4244e6396062d127c8e4c4b9a6d0851df613d428.tar.gz
When printing the contents of a HWPMC log in human readable form:
- Print a warning if the version number recorded in the log is not what the tool expects. - Print a tidier error message when an unrecognized event is encountered in the log. - Don't print a spurious 'Unknown error: 0' when exiting after a parse error.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index be81082..90cd058 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -1529,6 +1529,11 @@ pmcstat_print_log(struct pmcstat_args *a)
PMCSTAT_PRINT_ENTRY(a,"initlog","0x%x \"%s\"",
ev.pl_u.pl_i.pl_version,
pmc_name_of_cputype(ev.pl_u.pl_i.pl_arch));
+ if ((ev.pl_u.pl_i.pl_version & 0xFF000000) !=
+ PMC_VERSION_MAJOR << 24 && a->pa_verbosity > 0)
+ warnx("WARNING: Log version 0x%x != expected "
+ "version 0x%x.", ev.pl_u.pl_i.pl_version,
+ PMC_VERSION);
break;
case PMCLOG_TYPE_MAP_IN:
PMCSTAT_PRINT_ENTRY(a,"map-in","%d %p \"%s\"",
@@ -1599,7 +1604,7 @@ pmcstat_print_log(struct pmcstat_args *a)
ev.pl_u.pl_se.pl_pid);
break;
default:
- fprintf(a->pa_printfile, "unknown %d",
+ fprintf(a->pa_printfile, "unknown event (type %d).\n",
ev.pl_type);
}
}
@@ -1609,8 +1614,8 @@ pmcstat_print_log(struct pmcstat_args *a)
else if (ev.pl_state == PMCLOG_REQUIRE_DATA)
return (PMCSTAT_RUNNING);
- err(EX_DATAERR, "ERROR: event parsing failed "
- "(record %jd, offset 0x%jx)",
+ errx(EX_DATAERR, "ERROR: event parsing failed "
+ "(record %jd, offset 0x%jx).",
(uintmax_t) ev.pl_count + 1, ev.pl_offset);
/*NOTREACHED*/
}
OpenPOWER on IntegriCloud