Re: Two observations using GDB 13 snapshot

John Baldwin
2022-12-29T18:36:38Z

On 12/29/22 10:17 AM, Tom Tromey wrote:
>>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> The profile produced by gprof is attached. The time information looks
> Eli> very inaccurate, almost bogus, to me (since GDB ran for more than 2
> Eli> minutes, I expected to see gdb_main show 130 as the value of
> Eli> cumulative seconds, but the profile shows only 2.21?).
>
> Yeah, it looks strange to me as well. I don't think it really shows us
> where all the time is going.
>
> gprof also thinks gdb only ran for a couple of seconds:
>
>> granularity: each sample hit covers 4 byte(s) for 0.44% of 2.29 seconds
>
> I wonder if just randomly interrupting gdb a few times during that 2
> minutes and doing a "bt" would be more informative.

It wouldn't surprise me if -pg is somewhat broken in modern toolchains
and supporting libraries. Profiling nowadays is usually driven by
samping using hardware performance counters (like perf on Linux) rather
than relying on calls to instrumentation functions like mcount inserted
by the compiler. I'm sure Windows has a way to use hardware performance
counters as well, but I'm not familiar with how to do it on Windows.

--
John Baldwin