RE: [PATCH 2/2] perf record: Replace 'overwrite' by 'flightrecorder' for better naming

From: Liang, Kan
Date: Wed Nov 01 2017 - 10:22:35 EST


> On 2017/11/1 21:26, Liang, Kan wrote:
> >> The meaning of perf record's "overwrite" option and many "overwrite"
> >> in source code are not clear. In perf's code, the 'overwrite' has 2 meanings:
> >> 1. Make ringbuffer readonly (perf_evlist__mmap_ex's argument).
> >> 2. Set evsel's "backward" attribute (in apply_config_terms).
> >>
> >> perf record doesn't use meaning 1 at all, but have a overwrite
> >> option, its real meaning is setting backward.
> >>
> > I don't understand here.
> > 'overwrite' has 2 meanings. perf record only support 1.
> > It should be a bug, and need to be fixed.
>
> Not a bug, but ambiguous.
>
> Perf record doesn't need overwrite main channel (we have two channels:
> evlist->mmap is main channel and evlist->backward_mmap is backward
> evlist->channel),
> but some testcases require it, and your new patchset may require it.
> 'perf record --overwrite' doesn't set main channel overwrite. What it does is
> moving all evsels to backward channel, and we can move some evsels back to
> the main channel by /no-overwrite/ setting. This behavior is hard to
> understand.
>

As my understanding, the 'main channel' should depends on what user sets.
If --overwrite is applied, then evlist->backward_mmap should be the
'main channel'. evlist->overwrite should be set to true as well.

/no-overwrite/ setting is per-event setting.
Only when we finish the global setting, then the per-event setting will be
considered. You may refer to apply_config_terms.

Thanks,
Kan