From owner-freebsd-hackers@freebsd.org Fri Jan 29 10:35:37 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCF934E5FE8 for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRtyx5TF5z4h5P for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [IPv6:2a01:4f8:201:6350::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 952D7A947 for ; Fri, 29 Jan 2021 10:35:37 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [192.168.134.16] (unknown [94.19.224.8]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 3CC02A4CA for ; Fri, 29 Jan 2021 13:35:36 +0300 (MSK) To: freebsd-hackers@freebsd.org Reply-To: lev@FreeBSD.org From: Lev Serebryakov Subject: Is here good documentation/tutorial about user-level profiling with `pmcstat' Organization: FreeBSD Message-ID: <602f671d-683d-d291-c8d2-f01526eca34b@FreeBSD.org> Date: Fri, 29 Jan 2021 13:35:35 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 10:35:37 -0000 I'm trying to use `pmcstat' to profile my userland (single threaded) program. And I can not find good instructions about how to use it. What event should I use for simple CPU profile? Is it cpu_clk_unhalted.thread or inst_retired.any or anything else? How to provide symbols from `/usr/lib/debug' to `pmcstat'? I've tried `pmcstat -R' but it doesn't see any function names outside my program: # pmcstat -R out-3.pmcstat -z100 -G out-3.stacks CONVERSION STATISTICS: #exec/elf 1 #samples/total 248539181 #samples/unknown-function 43228216 #callchain/dubious-frames 132121 # How could I filter-our kernel stacks? I don't need them (now) and they take a lot of space on flame graph. How could I drill-down to source-line-level (from per-function level) for some functions which take most of time? I've tried to Google but could not find any good documentation and `man pmcstat' is very terse. Thank you. -- // Lev Serebryakov