Change the driver stats to what they really are: unsigned values.

When pmcstat exits after some samples were dropped, give the user an
idea of how many were lost. (Granted, these are global numbers, but
they may still help quantify the scope of the loss.)

Differential Revision:	https://reviews.freebsd.org/D4123
Approved by:	gnn (mentor)
MFC after:	1 month
Sponsored by:	Juniper Networks
This commit is contained in:
Jonathan T. Looney 2015-11-16 15:16:09 +00:00
parent 1d211085ac
commit e64ba55dd2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290929
3 changed files with 32 additions and 20 deletions

View File

@ -37,14 +37,15 @@
* Driver statistics.
*/
struct pmc_driverstats {
int pm_intr_ignored; /* #interrupts ignored */
int pm_intr_processed; /* #interrupts processed */
int pm_intr_bufferfull; /* #interrupts with ENOSPC */
int pm_syscalls; /* #syscalls */
int pm_syscall_errors; /* #syscalls with errors */
int pm_buffer_requests; /* #buffer requests */
int pm_buffer_requests_failed; /* #failed buffer requests */
int pm_log_sweeps; /* #sample buffer processing passes */
unsigned int pm_intr_ignored; /* #interrupts ignored */
unsigned int pm_intr_processed; /* #interrupts processed */
unsigned int pm_intr_bufferfull; /* #interrupts with ENOSPC */
unsigned int pm_syscalls; /* #syscalls */
unsigned int pm_syscall_errors; /* #syscalls with errors */
unsigned int pm_buffer_requests; /* #buffer requests */
unsigned int pm_buffer_requests_failed; /* #failed buffer requests */
unsigned int pm_log_sweeps; /* #sample buffer processing
passes */
};
/*

View File

@ -550,14 +550,15 @@ struct pmc_op_configurelog {
*/
struct pmc_op_getdriverstats {
int pm_intr_ignored; /* #interrupts ignored */
int pm_intr_processed; /* #interrupts processed */
int pm_intr_bufferfull; /* #interrupts with ENOSPC */
int pm_syscalls; /* #syscalls */
int pm_syscall_errors; /* #syscalls with errors */
int pm_buffer_requests; /* #buffer requests */
int pm_buffer_requests_failed; /* #failed buffer requests */
int pm_log_sweeps; /* #sample buffer processing passes */
unsigned int pm_intr_ignored; /* #interrupts ignored */
unsigned int pm_intr_processed; /* #interrupts processed */
unsigned int pm_intr_bufferfull; /* #interrupts with ENOSPC */
unsigned int pm_syscalls; /* #syscalls */
unsigned int pm_syscall_errors; /* #syscalls with errors */
unsigned int pm_buffer_requests; /* #buffer requests */
unsigned int pm_buffer_requests_failed; /* #failed buffer requests */
unsigned int pm_log_sweeps; /* #sample buffer processing
passes */
};
/*

View File

@ -1500,14 +1500,24 @@ main(int argc, char **argv)
"ERROR: Cannot retrieve driver statistics");
if (ds_start.pm_intr_bufferfull != ds_end.pm_intr_bufferfull &&
args.pa_verbosity > 0)
warnx("WARNING: some samples were dropped.\n"
"Please consider tuning the \"kern.hwpmc.nsamples\" tunable."
warnx(
"WARNING: sampling was paused at least %u time%s.\n"
"Please consider tuning the \"kern.hwpmc.nsamples\" tunable.",
ds_end.pm_intr_bufferfull -
ds_start.pm_intr_bufferfull,
((ds_end.pm_intr_bufferfull -
ds_start.pm_intr_bufferfull) != 1) ? "s" : ""
);
if (ds_start.pm_buffer_requests_failed !=
ds_end.pm_buffer_requests_failed &&
args.pa_verbosity > 0)
warnx("WARNING: some events were discarded.\n"
"Please consider tuning the \"kern.hwpmc.nbuffers\" tunable."
warnx(
"WARNING: at least %u event%s were discarded while running.\n"
"Please consider tuning the \"kern.hwpmc.nbuffers\" tunable.",
ds_end.pm_buffer_requests_failed -
ds_start.pm_buffer_requests_failed,
((ds_end.pm_buffer_requests_failed -
ds_start.pm_buffer_requests_failed) != 1) ? "s" : ""
);
}