From owner-svn-src-head@freebsd.org Mon Nov 16 15:16:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DDB3A30602; Mon, 16 Nov 2015 15:16:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5201E1517; Mon, 16 Nov 2015 15:16:11 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAGFGAO9024763; Mon, 16 Nov 2015 15:16:10 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAGFGAw4024760; Mon, 16 Nov 2015 15:16:10 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201511161516.tAGFGAw4024760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Mon, 16 Nov 2015 15:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290929 - in head: lib/libpmc sys/sys usr.sbin/pmcstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2015 15:16:11 -0000 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" : "" ); }