xprof_text(4)xprof_text(4)NAMExprof_text - profile feedback text file
DESCRIPTION
Text files generated and recognized, respectively, by xprof_btoa and
xprof_atob have the format described below.
FORMAT
/*
* Note on notation: in the comments below, a syntactic
* entity <x> associated with a printf/scanf format <f>
* is denoted as <x>(<f>) in its description.
*/
/*
* A profile feedback text file begins with a <header> containing
* version information and record counts for object files, programs,
* procedure names, and source files.
*
* The <header> has the form
*
* PROFILE-FEEDBACK-DATA: <major>.<minor> * <n_objfiles> <n_programs> <n_proc_names> <n_srcfiles> * [<type>]
*
* where
*
* <major>(%u), <minor>(%u) are the major and minor version
* numbers of the profile feedback text file format.
*
* <n_objfiles(%u)>, <n_programs(%u)>, <n_proc_names(%u)>,
* and <n_srcfiles(%u)> are the number of object files, programs,
* indirectly called procedures, and source files represented in
* the profile.
*
* <type> is a type name associated with one of following
* file types:
*
* <type> file type
* ---------------
* (none) profile feedback data (default)
* tcovd test coverage run time data
* objfd object file compilation data
* tcovsd test coverage source data
*
* If <type> is "objfd", the file must contain exactly
* one <object file section>.
*/
#define SUN_PROFDATA_MAJOR_VERSION 4
#define SUN_PROFDATA_MINOR_VERSION 4
/*
* Version information is followed by at least one of
* <object file section>
* <program section>
* <source file section>
*
* An <object file section> has the form
*
* OBJFILE:<pathname> <n_procs> <tv_sec> <tv_usec> <n_values_per_vp> * <signature> <n_srcfile_names>
* {<stat>}*
* {<procedure section>}*
*
* where
*
* <pathname>(%s) is the resolved UNIX pathname of the object
* file, as recorded by the compiler using dladdr(3DL)
* and realpath(3C) at the time the object file was
* generated.
*
* <n_procs>(%u) is an unsigned decimal integer giving the number
* of profiled procedures or functions contained in the
* object file. The value of <n_procs> may be 0.
*
* <tv_sec>(%u) <tv_usec>(%u) are the tv_sec and tv_usec fields
* of a timeval structure returned by gettimeofday(3C) during
* code generation when the object file was compiled.
*
* <n_values_per_vp>(%u) is an unsigned decimal integer giving the
* number of values stored in each of the object file's
* value profile records.
*
* <signature>(0x%llx) is a 64 bit hexadecimal integer whose value
* is a hash of the signatures of the procedures defined in the
* object file. Its purpose is to detect differences between
* two compilations of a given object file.
*
* <n_srcfile_names>(%u) is the number of source file name
* strings stored in the scope of the object file.
*
* {<stat>}* is a series of 0 or more profile counter statistics,
* each of which takes one of the following forms:
* max <count>(%llu)
* sum <count>(%llu)
* where:
* <count>(%llu) is a 64 bit unsigned decimal integer
* representing either the maximum counter value or
* the sum of all counter values, over all counters
* in the object file profile.
*
* {<procedure section>}* is a series of <n_procs> procedure
* sections, each of which contains the profile data of
* one of the object file's procedures or functions.
* Note that <n_procs> may be 0.
*
* A <procedure section> has the form
*
* PROC: <proc_name> <signature> * <n_counters> <n_vp_sites> <n_vp_records> <proc id> * <n_blocks> <n_edges> <n_srcmap_ops>
* {<stat>}*
* {<counter record>}*
* {<value profile record>}*
* {<block record>}*
* {<edge record>}*
* {<source mapping tuple>}*
*
* where
*
* <proc_name>(%s) is the procedure's linker symbol name
*
* <signature>(0x%llx) is a 64 bit hexadecimal integer whose
* value is a hash of the procedure's control flow graph (CFG)
* at the point in compilation where the CFG is associated with
* profile counters under -xprofile=collect and with profile
* counter values under -xprofile=use.
*
* The value of <signature> is used to detect differences
* in the input CFG between the two compilations, whether
* due to source code changes or due to code transformations
* applied earlier in the compilation process.
*
* <n_counters>(%u) is the number of counter records contained
* in the procedure section.
*
* <n_vp_exprs>(%u) is the number of value-profiled expressions
* contained in the procedure section.
*
* <n_vp_records>(%u) is the number of value profile records
* contained in the procedure section.
*
* <proc id>(%u) is the procedure's id number in [1..<n_procs>].
*
* <n_blocks>(%u) and <n_edges>(%u) are respectively the
* number of basic blocks and edges in the procedure's
* control flow graph.
*
* <n_srcmap_ops>(%u) is the number of operations used to
* construct the procedure's mapping from source code
* locations to basic blocks.
*
* {<stat>}* are optional statistics over the procedure,
* defined in the same manner as {<stat>}* under
* <object file section>.
*
* {<block record>}* and {<edge record>}* are sequences of
* records representing, respectively, the basic blocks
* and edges of the procedure's control flow graph.
*
*
* A PROC record is optionallly followed by summary statistics,
* <n_counters> counter records and <n_vp_records> value profile records.
* Note that <n_counters>, <n_vp_sites>, <n_vp_records>, <n_blocks>,
* and <n_edges> may all be 0. The value of <n_counters> is 0 for a
* procedure that was loaded but not executed.
*
* A <counter record> has the form
*
* <counter id> <counter value>
*
* where
*
* <counter id>(%u) is a 32 bit unsigned integer id uniquely
* identifying a point of execution within the containing
* procedure or function. <counter id> may represent either
* a basic block or an edge of the procedure's CFG.
*
* <counter value>(%llu) is a 64 bit unsigned integer whose
* value is the number of times that the code at the point
* associated with <counter id> was executed.
*
* A <value profile record> consists of <n_values_per_vp>
* sub-records of the form:
*
* <type> <expr id> <count> <value>
*
* where
*
* <type>(%s) is a keyword string identifying the type
* of the profiled expression. The defined values
* of <type> and their associated C data types are:
*
* VP_INT signed int
* VP_LLONG signed long long int
* VP_FLOAT float
* VP_DOUBLE double
* VP_PROC pointer to indirectly called function
*
* <expr id>(%u) is a 32 bit unsigned integer id uniquely
* identifying a value profiled expression within
* the scope of the containing procedure.
*
* <count>(%llu) is a 64 bit unsigned integer whose value
* is the number of times that the profiled expression was
* observed to have the value represented by <value>.
*
* <value> represents one of the <n_values> most frequently
* observed values of the expression identified by <value>.
*
* If <count> is 0, the <value> field is empty; otherwise,
* its value can be scanned using scanf(3C) with a format
* string determined by the <type> keyword:
*
* VP_INT %d
* VP_LLONG %lld
* VP_FLOAT %g
* VP_DOUBLE %lg
* VP_PROC %s
*
* If <type> = VP_PROC, the form of the <value> field is
* <proc_name>:<objfile pathname>
* where
* <proc_name> is the called function's linker symbol name
* <objfile pathname> is the UNIX pathname of the object
* file containing the called function.
* If the called function is not profiled, the <value> field
* is empty.
*
* A <block record> has the form
*
* B<block id>: <counter id>
*
* where
*
* <counter id>(%u) is either 0 or the basic block's profile counter
* id number in [1..<n_counters>];
*
* An <edge record> has the form
*
* E<edge id> <counter id> B<from id> B<to id>
*
* where
*
* <edge id>(%u) is the id number in [1..<n_edges>] of an
* edge in the containing procedure's control flow graph;
*
* <counter id>(%u) is either 0 or the edge's profile counter
* id number in [1..<n_counters>];
*
* <from id>(%u) and <to id>(%u) are respectively the id numbers
* in [1..<n_blocks>] of the edge's starting and ending basic
* blocks.
*
* A <source mapping tuple> has the form
*
* S<tuple id>: B<block id> <line no>[:<column no>] [<srcfile>]
*
* where
*
* <tuple id>(%u) is the source mapping tuple's id number in
* [1..<n_srcmap_ops>]. Note that <n_srcmap_ops> may be greater
* than the number of source mapping tuples.
*
* <block id>(%u) is the id number in [1..<n_blocks>] of a
* basic block compiled from source code at the location
* given by the other fields of the tuple;
*
* <line no>(%u) is the positive line number of the
* source line from which the basic block was compiled;
*
* [:<column no>(%u)], if present, is the positive column number
* of the source line from which the basic block was compiled;
*
* [<srcfile>(%s)], if present, is the UNIX pathname of the
* source file from which the basic block was compiled. If
* no <srcfile> is present, the basic block was compiled from
* the same source file as that of the previous source mapping
* tuple.
*
* A <program section> has the form
*
* PROGRAM: <pathname> <n_objfile_refs> <n_comdat_procs>
* {<stat>}*
* {<objfile_ref>}*
* {<comdat proc>}*
*
* where
*
* <pathname>(%s) is the UNIX pathname of a profiled executable
* or shared library, as returned by dladdr(3DL) and
* realpath(3C) at the time the executable or shared
* library was loaded for execution.
*
* <n_objfile_refs>(%u) is an unsigned decimal number whose
* value is the number of profiled object files statically
* linked in the executable or shared library.
*
* <n_comdat_procs>(%u) is an unsigned decimal number whose
* value is the number of procedures defined in comdat
* sections and surviving elimination of duplicates at
* link time.
*
* {<stat>}* is a series of 0 or more statistics over the
* profiled executable or shared library, defined in the
* same manner as {<stat>}* under <object file section>.
*
* {<objfile_ref>}* is a series of <n_objfiles> object file
* references, each of which has the form:
* OBJREF: <objfile pathname>(%s)
* where
* <objfile pathname> is the UNIX pathname of an object
* file statically linked in the executable or shared
* library. The referenced object file must have been
* previously defined in an <object file section>.
*
* {<comdat proc>}* is a series of <n_comdat_procs> comdat procedure
* definitions, each of which has the form:
* COMDAT_PROC: <proc_name>:<objfile pathname>
* where
* <proc_name> is the linker symbol name of the surviving
* instance of a comdat procedure after elimination
* of duplicate copies at link time
* <objfile pathname> is the UNIX pathname of the
* object file containing the surviving instance
* of the named comdat procedure
*
* A <source file section> has the form
*
* SRCFILE: <pathname> <n_srclines>
* {<srcline>}*
*
* where
*
* <pathname>(%s) is the UNIX pathname of a source file from
* which profiled basic blocks were generated.
*
* <n_srclines>(%u) is an unsigned decimal number whose value
* is the number of source lines from which profiled
* basic blocks were generated.
*
* {<srcline>}* is a series of 0 or more source code line
* sections, which have one of the following forms:
*
* SRCLINE: <line no>[:<column no>] <n_block_refs>
* {<block ref>}*
*
* where
*
* <line no>(%u) and <column no>(%u) are as defined
* under <block record>;
*
* <n_block_refs>(%u) is an unsigned decimal integer
* whose value is the number of basic blocks generated
* from the associated source line;
*
* {<block ref>}* is a series of 1 or more records of
* the form
*
* B<block id> <count> <proc_name>:<objfile_name>
*
* each of which represents a basic block compiled from
* the given source line, where
*
* <block id>(%u) and <count>(%llu) are respectively
* the basic block id and execution count of the
* generated basic block.
*
* <proc_name>(%s) is the linker symbol name of the
* procedure containing the generated basic block,
*
* <objfile_name>(%s) is the UNIX pathname of the
* object file containing the generated basic block,
*/
May 2010 xprof_text(4)