11b4822a4SAttilio Rao.\" Copyright (c) 2008 Nokia Corporation 21b4822a4SAttilio Rao.\" All rights reserved. 31b4822a4SAttilio Rao.\" 41b4822a4SAttilio Rao.\" This software was developed by Attilio Rao for the IPSO project under 51b4822a4SAttilio Rao.\" contract to Nokia Corporation. 61b4822a4SAttilio Rao.\" 71b4822a4SAttilio Rao.\" Redistribution and use in source and binary forms, with or without 81b4822a4SAttilio Rao.\" modification, are permitted provided that the following conditions 91b4822a4SAttilio Rao.\" are met: 101b4822a4SAttilio Rao.\" 1. Redistributions of source code must retain the above copyright 111b4822a4SAttilio Rao.\" notice, this list of conditions and the following disclaimer. 121b4822a4SAttilio Rao.\" 2. Redistributions in binary form must reproduce the above copyright 131b4822a4SAttilio Rao.\" notice, this list of conditions and the following disclaimer in the 141b4822a4SAttilio Rao.\" documentation and/or other materials provided with the distribution. 151b4822a4SAttilio Rao.\" 161b4822a4SAttilio Rao.\" This software is provided by the authors ``as is'' and 171b4822a4SAttilio Rao.\" any express or implied warranties, including, but not limited to, the 181b4822a4SAttilio Rao.\" implied warranties of merchantability and fitness for a particular purpose 191b4822a4SAttilio Rao.\" are disclaimed. in no event shall the authors be liable 201b4822a4SAttilio Rao.\" for any direct, indirect, incidental, special, exemplary, or consequential 211b4822a4SAttilio Rao.\" damages (including, but not limited to, procurement of substitute goods 221b4822a4SAttilio Rao.\" or services; loss of use, data, or profits; or business interruption) 231b4822a4SAttilio Rao.\" however caused and on any theory of liability, whether in contract, strict 241b4822a4SAttilio Rao.\" liability, or tort (including negligence or otherwise) arising in any way 251b4822a4SAttilio Rao.\" out of the use of this software, even if advised of the possibility of 261b4822a4SAttilio Rao.\" such damage. 271b4822a4SAttilio Rao.\" 28*de112993SJohn Baldwin.Dd January 14, 2025 291b4822a4SAttilio Rao.Dt PMCANNOTATE 8 30aa12cea2SUlrich Spörlein.Os 311b4822a4SAttilio Rao.Sh NAME 321b4822a4SAttilio Rao.Nm pmcannotate 331b4822a4SAttilio Rao.Nd "sources printout with inlined profiling" 341b4822a4SAttilio Rao.Sh SYNOPSIS 351b4822a4SAttilio Rao.Nm 361b4822a4SAttilio Rao.Op Fl a 371b4822a4SAttilio Rao.Op Fl h 381b4822a4SAttilio Rao.Op Fl k Ar pathname 391b4822a4SAttilio Rao.Op Fl l Ar level 40*de112993SJohn Baldwin.Op Fl m Ar mode 411b4822a4SAttilio Rao.Ar pmcout.out binaryobj 421b4822a4SAttilio Rao.Sh DESCRIPTION 431b4822a4SAttilio RaoThe 441b4822a4SAttilio Rao.Nm 451b4822a4SAttilio Raoutility can produce both C sources or assembly sources of a program with 461b4822a4SAttilio Raoa line-by-line based profiling. 472063b2c0SJoel DahlThe profiling information is retrieved through a 481b4822a4SAttilio Rao.Xr pmcstat 8 491b4822a4SAttilio Raoraw output while the program operations are retrieved through the 501b4822a4SAttilio Rao.Xr objdump 1 511b4822a4SAttilio Raotool. 521b4822a4SAttilio Rao.Pp 531b4822a4SAttilio RaoWhen calling 541b4822a4SAttilio Rao.Nm 551b4822a4SAttilio Raothe raw output is passed through the 561b4822a4SAttilio Rao.Ar pmcout.out 571b4822a4SAttilio Raoargument, while the program is passed through the 581b4822a4SAttilio Rao.Ar binaryobj 591b4822a4SAttilio Raoargument. 601b4822a4SAttilio Rao.Pp 611b4822a4SAttilio RaoAs long as 621b4822a4SAttilio Rao.Nm 631b4822a4SAttilio Raorelies on 641b4822a4SAttilio Rao.Xr objdump 1 651b4822a4SAttilio Raoand 661b4822a4SAttilio Rao.Xr pmcstat 8 671b4822a4SAttilio Raoto work, it will fail if one of them is not available. 681b4822a4SAttilio Rao.Sh OPTIONS 691b4822a4SAttilio RaoThe following options are available: 701b4822a4SAttilio Rao.Bl -tag -width indent 711b4822a4SAttilio Rao.It Fl a 721b4822a4SAttilio RaoShows the program profiling inlined in the assembly code only. 732063b2c0SJoel DahlNo C information involving C sources is provided. 741b4822a4SAttilio Rao.It Fl h 752063b2c0SJoel DahlPrints out information about the usage of the tool. 761b4822a4SAttilio Rao.It Fl l Ar level 771b4822a4SAttilio RaoChanges the lower bound (expressed in percentage) for traced functions 781b4822a4SAttilio Raothat will be printed out in the report. 791b4822a4SAttilio RaoThe default value is 0.5%. 801b4822a4SAttilio Rao.It Fl k Ar kerneldir 811b4822a4SAttilio RaoSet the pathname of the kernel directory to argument 821b4822a4SAttilio Rao.Ar kerneldir . 831b4822a4SAttilio RaoThis directory specifies where 841b4822a4SAttilio Rao.Nm 851b4822a4SAttilio Raoshould look for the kernel and its modules. 861b4822a4SAttilio RaoThe default is 871b4822a4SAttilio Rao.Pa /boot/kernel . 88*de112993SJohn Baldwin.It Fl m Ar mode 89*de112993SJohn BaldwinFormat to use when annotating source or assembly lines. 90*de112993SJohn BaldwinOne of: 91*de112993SJohn Baldwin.Bl -tag -width indent 92*de112993SJohn Baldwin.It Cm block 93*de112993SJohn BaldwinDisplay percentage of matching samples relative to samples 94*de112993SJohn Baldwinfalling in the current block. 95*de112993SJohn Baldwin.It Cm global 96*de112993SJohn BaldwinDisplay percentage of matching samples relative to all samples. 97*de112993SJohn Baldwin.It Cm raw 98*de112993SJohn BaldwinDisplay the raw count of matching samples. 99*de112993SJohn Baldwin.El 10063d46d1dSUlrich Spörlein.El 1011b4822a4SAttilio Rao.Sh LIMITATIONS 1021b4822a4SAttilio RaoAs long as 1031b4822a4SAttilio Rao.Nm 1041b4822a4SAttilio Raorelies on the 1051b4822a4SAttilio Rao.Xr objdump 1 1061b4822a4SAttilio Raoutility to retrieve the C code, the program needs to be compiled with 1071b4822a4SAttilio Raodebugging options. 1081b4822a4SAttilio RaoSometimes, in particular with heavy optimization levels, the 1091b4822a4SAttilio Rao.Xr objdump 1 1101b4822a4SAttilio Raoutility embeds the code of inlining functions directly in the callers, 1111b4822a4SAttilio Raomaking an output difficult to read. 1121b4822a4SAttilio RaoThe x86 version reports the sampling from pmcstat collecting the following 1131b4822a4SAttilio Raoinstruction in regard of the interrupted one. 1141b4822a4SAttilio RaoThis means that the samples may be attributed to the line below the one 1151b4822a4SAttilio Raoof interest. 1161b4822a4SAttilio Rao.Sh SEE ALSO 1171b4822a4SAttilio Rao.Xr objdump 1 , 1181b4822a4SAttilio Rao.Xr pmcstat 8 1191b4822a4SAttilio Rao.Sh AUTHORS 12001c2b8acSBaptiste Daroussin.An Attilio Rao Aq Mt attilio@FreeBSD.org 121