svn commit: r290929 - in head: lib/libpmc sys/sys usr.sbin/pmcstat
Jonathan T. Looney
jtl at FreeBSD.org
Mon Nov 16 15:16:11 UTC 2015
Author: jtl
Date: Mon Nov 16 15:16:09 2015
New Revision: 290929
URL: https://svnweb.freebsd.org/changeset/base/290929
Log:
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
Modified:
head/lib/libpmc/pmc.h
head/sys/sys/pmc.h
head/usr.sbin/pmcstat/pmcstat.c
Modified: head/lib/libpmc/pmc.h
==============================================================================
--- head/lib/libpmc/pmc.h Mon Nov 16 12:58:47 2015 (r290928)
+++ head/lib/libpmc/pmc.h Mon Nov 16 15:16:09 2015 (r290929)
@@ -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 */
};
/*
Modified: head/sys/sys/pmc.h
==============================================================================
--- head/sys/sys/pmc.h Mon Nov 16 12:58:47 2015 (r290928)
+++ head/sys/sys/pmc.h Mon Nov 16 15:16:09 2015 (r290929)
@@ -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 */
};
/*
Modified: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c Mon Nov 16 12:58:47 2015 (r290928)
+++ head/usr.sbin/pmcstat/pmcstat.c Mon Nov 16 15:16:09 2015 (r290929)
@@ -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" : ""
);
}
More information about the svn-src-all
mailing list