From owner-svn-src-all@freebsd.org Wed Aug 29 12:41:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D68210892D9; Wed, 29 Aug 2018 12:41:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6C5B8B768; Wed, 29 Aug 2018 12:41:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 9EA4D1421A; Wed, 29 Aug 2018 12:41:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.0.2.164] (ptr-8rgnodx4lgssngonp86.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:240b:b802:f552:1840:7e47:a776]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 832C7479D9; Wed, 29 Aug 2018 14:41:51 +0200 (CEST) From: "Kristof Provost" To: "Matt Macy" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334647 - in head: lib/libpmc sys/dev/hwpmc sys/kern sys/sys usr.sbin usr.sbin/pmc Date: Wed, 29 Aug 2018 14:41:49 +0200 X-Mailer: MailMate (2.0BETAr6116) Message-ID: <7049241C-BA3D-4652-9568-C4387557F8E3@FreeBSD.org> In-Reply-To: <201806050426.w554QfVq001396@repo.freebsd.org> References: <201806050426.w554QfVq001396@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2018 12:41:54 -0000 On 5 Jun 2018, at 6:26, Matt Macy wrote: > Author: mmacy > Date: Tue Jun 5 04:26:40 2018 > New Revision: 334647 > URL: https://svnweb.freebsd.org/changeset/base/334647 > > Log: > hwpmc: log name->pid, name->tid mappings > > By logging all threads and processes 'pmc filter' > can now filter on process or thread name, relieving > the user of the burden of determining which tid or > pid was which when the sample was taken. > > % pmc filter -T if_io_tqg -P nginx pmc.log pmc-iflib.log > > % pmc filter -x -T idle pmc.log pmc-noidle.log > > Added: > head/usr.sbin/pmc/cmd_pmc_filter.cc > - copied, changed from r334645, > head/usr.sbin/pmc/cmd_pmc_filter.c > Deleted: > head/usr.sbin/pmc/cmd_pmc_filter.c > Modified: > head/lib/libpmc/pmclog.c > head/lib/libpmc/pmclog.h > head/sys/dev/hwpmc/hwpmc_logging.c > head/sys/dev/hwpmc/hwpmc_mod.c > head/sys/kern/kern_kthread.c > head/sys/kern/kern_thr.c > head/sys/kern/kern_thread.c > head/sys/sys/pmc.h > head/sys/sys/pmckern.h > head/sys/sys/pmclog.h > head/usr.sbin/Makefile > head/usr.sbin/pmc/Makefile (contents, props changed) > head/usr.sbin/pmc/cmd_pmc.h (contents, props changed) > > Modified: head/lib/libpmc/pmclog.c > ============================================================================== > --- head/lib/libpmc/pmclog.c Tue Jun 5 01:05:58 2018 (r334646) > +++ head/lib/libpmc/pmclog.c Tue Jun 5 04:26:40 2018 (r334647) > @@ -404,6 +404,19 @@ pmclog_get_event(void *cookie, char **data, > ssize_t *l > case PMCLOG_TYPE_USERDATA: > PMCLOG_READ32(le,ev->pl_u.pl_u.pl_userdata); > break; > + case PMCLOG_TYPE_THR_CREATE: > + PMCLOG_READ32(le,ev->pl_u.pl_tc.pl_tid); > + PMCLOG_READ32(le,ev->pl_u.pl_tc.pl_pid); > + PMCLOG_READ32(le,noop); > + memcpy(ev->pl_u.pl_tc.pl_tdname, le, MAXCOMLEN+1); > + break; > + case PMCLOG_TYPE_THR_EXIT: > + PMCLOG_READ32(le,ev->pl_u.pl_te.pl_tid); > + break; > + case PMCLOG_TYPE_PROC_CREATE: > + PMCLOG_READ32(le,ev->pl_u.pl_pc.pl_pid); > + memcpy(ev->pl_u.pl_pc.pl_pcomm, le, MAXCOMLEN+1); > + break; > default: /* unknown record type */ > ps->ps_state = PL_STATE_ERROR; > ev->pl_state = PMCLOG_ERROR; > pmcstat does not know about these new event types, so a `pmcstat -S cpu_clk_unhalted.core -l 10 -G data.test` produces error messages about unknown events: # pmcstat -S cpu_clk_unhalted.core -l 10 -G data.test initlog 0x9030000 "INTEL_ATOM_SILVERMONT" allocate 0x711 "cpu_clk_unhalted.core" 0x20080 allocate 0x100711 "cpu_clk_unhalted.core" 0x20080 allocate 0x200711 "cpu_clk_unhalted.core" 0x20080 allocate 0x300711 "cpu_clk_unhalted.core" 0x20080 allocate 0x400711 "cpu_clk_unhalted.core" 0x20080 allocate 0x500711 "cpu_clk_unhalted.core" 0x20080 allocate 0x600711 "cpu_clk_unhalted.core" 0x20080 allocate 0x700711 "cpu_clk_unhalted.core" 0x20080 unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). unknown event (type 18). unknown event (type 20). … I’ve added this locally, but I’m not familiar enough with the pmc tooling to know if this is complete, or correct. diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index 5f88d274f39..5444181ce0c 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -478,6 +478,21 @@ pmcstat_print_log(void) PMCSTAT_PRINT_ENTRY("exit","%d", ev.pl_u.pl_se.pl_pid); break; + case PMCLOG_TYPE_THR_CREATE: + PMCSTAT_PRINT_ENTRY("thrcreate","%d %d \"%s\"", + ev.pl_u.pl_tc.pl_tid, + ev.pl_u.pl_tc.pl_pid, + ev.pl_u.pl_tc.pl_tdname); + break; + case PMCLOG_TYPE_THR_EXIT: + PMCSTAT_PRINT_ENTRY("threxit","%d", + ev.pl_u.pl_te.pl_tid); + break; + case PMCLOG_TYPE_PROC_CREATE: + PMCSTAT_PRINT_ENTRY("proccreate","%d \"%s\"", + ev.pl_u.pl_pc.pl_pid, + ev.pl_u.pl_pc.pl_pcomm); + break; default: fprintf(args.pa_printfile, "unknown event (type %d).\n", ev.pl_type); Regards, Kristof