On Thu, Sep 17, 2026 at 10:39:17AM +1000, Kugan Vivekanandarajah wrote:
> +/* Remember the earliest TIME seen at PC, a DWARF lookup address.  */
> +void
> +profile_reader::note_sample_timestamp (uint64_t pc, uint64_t time)
> +{
> +  if (time == 0 || pc == 0)
> +    return;
> +  auto inserted = first_sample_time_by_pc_.emplace (pc, time);
> +  if (!inserted.second && time < inserted.first->second)
> +    inserted.first->second = time;
> +}

> +
> +/* Reduce the per-PC first-sample times to one earliest time per function,
> +   which is what the profile records.  */

Ah ok that explains the time stamp use. Thinking of it perf-gcov uses 
a similar heuristic. It would be still nice if it wasn't needed to make
the files smaller.


> +
> +std::unique_ptr<profile_reader>
> +create_perf_reader (const std::string &perf_data_path,
> +                 const std::string &binary_path, sampling_mode mode)
> +{
> +  switch (mode)
> +    {

So we don't have just sample (like autofdo has too)? That would be
useful in virtualized environments which often miss BRANCH_STACK.
I thought i had already seen some code related to this.

> +    case sampling_mode::BRANCH_STACK:
> +      return std::make_unique<perf_branch_stack_reader> (
> +     perf_data_path, binary_path);
> +
> +    case sampling_mode::SPE:
> +      return std::make_unique<perf_spe_reader> (perf_data_path, binary_path);

Reply via email to