Date: Wed, 29 Aug 2018 14:41:49 +0200 From: "Kristof Provost" <kp@FreeBSD.org> To: "Matt Macy" <mmacy@FreeBSD.org> 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 Message-ID: <7049241C-BA3D-4652-9568-C4387557F8E3@FreeBSD.org> In-Reply-To: <201806050426.w554QfVq001396@repo.freebsd.org> References: <201806050426.w554QfVq001396@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7049241C-BA3D-4652-9568-C4387557F8E3>