[PATCH v2] Generalize get_most_common_single_value to return k_th value & count

Segher Boessenkool segher@kernel.crashing.org
Mon Jul 15 15:28:00 GMT 2019


On Mon, Jul 15, 2019 at 04:41:28PM +0200, Martin Liška wrote:
> On 7/15/19 4:31 PM, Segher Boessenkool wrote:
> > On Mon, Jul 15, 2019 at 04:23:18PM +0200, Martin Liška wrote:
> >> On 7/15/19 4:17 PM, Segher Boessenkool wrote:
> >>> Is that enough?  Can there be two entries with the same count as well
> >>> as value?
> >>
> >> Yes, it can happen very unlikely in a multi-threaded instrumentation,
> >> but it will not make a problem.
> > 
> > It will result in different sort order on different hosts, then.  Is
> > that okay here?  Does a different order here not lead to different
> > compiler output?
> 
> The memory layout of the {value, count} tuple can be different. But the
> function will return you K-th most common value. And that will return the same.

Ah okay, we only look at the value later.  This should be documented I
think (just in the comparison routine is fine).


Segher



More information about the Gcc-patches mailing list