Re: [PATCH v12 09/16] perf record: Introduce bytes written stats

From: Bayduraev, Alexey V
Date: Mon Dec 06 2021 - 06:22:23 EST


On 05.12.2021 18:14, Jiri Olsa wrote:

<SNIP>

>> static int record__write(struct record *rec, struct mmap *map __maybe_unused,
>> @@ -210,13 +223,15 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused,
>> return -1;
>> }
>>
>> - if (!(map && map->file))
>> + if (map && map->file)
>> + thread->bytes_written += size;
>> + else
>> rec->bytes_written += size;
>
> ok, that's why ;-) do we actually stil need rec->bytes_written?
> can't we count that under synthesizing main thread->bytes_written?

Hi Jiri,

No, we still need rec->bytes_written because it is used for
the header in "perf.data/data", and it cannot be replaced by
threads[0].bytes_written because threads[0] is used for
"perf.data/data.0".

Regards,
Alexey

>
> jirka
>
>>
>> if (record__output_max_size_exceeded(rec) && !done) {
>> fprintf(stderr, "[ perf record: perf size limit reached (%" PRIu64 " KB),"
>> " stopping session ]\n",
>> - rec->bytes_written >> 10);
>> + record__bytes_written(rec) >> 10);
>> done = 1;
>> }
>>
>> --
>> 2.19.0
>>
>