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.
This commit is contained in:
Joseph Koshy 2007-12-03 10:29:49 +00:00
parent 1061ff7e54
commit 3ab065b6e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174209

View File

@ -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*/
}