[PATCH v4] gprof: only process line numbers for intersection of vmas and histograms
H.J. Lu
hjl.tools@gmail.com
Mon Mar 10 14:23:47 GMT 2025
On Sun, Mar 9, 2025 at 9:08 PM Richard Allen <rsaxvc@gmail.com> wrote:
>
> > Here is the v3 patch.
>
> I'm afraid loading the symbols on-demand may add a
> dependency on the order of records in the gmon file, so that
> [call-graph record, histogram record] may parse differently from
> [histogram record, callgraph record].
>
> >> Also, I'm not sure if it is enough for core_create_line_syms() to check
> >> only the histograms for symbols. Do you think we'll also need to lookup
> >> symbols for basic-block and call-graph addresses?
> > How can we get these symbols?
>
> Idea1:
> 1) For bb_read_rec and cg_read_rec, split the loading apart from the
> processing, and perform only the loading first, similar to hist_read_rec.
> 2) lookup symbols for all three record types, according to the addresses
> from each record type parsed.
> 3) perform processing for all three record types.
>
> Idea2:
> Build an expandable cache of address->symbol mappings.
> On cache miss, perform BFD lookup and insert in cache.
>
> -Richard
The profile data is written out with
/* write PC histogram: */
write_hist (fd, load_address);
/* write call-graph: */
write_call_graph (fd, load_address);
/* write basic-block execution counts: */
write_bb_counts (fd);
The histogram records capture low PC and high PC of program execution.
It is OK to look up only the line numbers within low PC and high PC in histogram
records.
Here is the v4 patch without the gprof.c change.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4-0001-gprof-only-process-line-numbers-for-intersection-.patch
Type: text/x-patch
Size: 4935 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20250310/615eaff9/attachment-0001.bin>
More information about the Binutils
mailing list