* David Ahern <dsahern@xxxxxxxxx> wrote:
+--out-pages=::
+ Number of pages to mmap while writing data to file (must be a power of two).
+ Specification can be appended with unit character - B/K/M/G. The
+ size is rounded up to have nearest pages power of two value.
So why doesn't the code automatically round down (or up) to the next power
of 2 limit? We use computers to solve problems, not to introduce
additional ones! ;-)
+static int do_mmap_output(struct perf_record *rec, void *buf, size_t size)
+{
+ struct perf_data_file *file = &rec->file;
+ u64 remaining;
+ off_t offset;
+
+ if (rec->mmap_addr == NULL) {
+do_mmap:
+ offset = rec->session->header.data_offset + rec->bytes_written;
+ if (offset < (ssize_t) rec->mmap_out_size) {
+ rec->mmap_offset = offset;
+ offset = 0;
+ } else
+ rec->mmap_offset = 0;
(Nit: unbalanced curly braces.)
+ OPT_CALLBACK(0, "out-pages", &record.mmap_out_pages, "pages",
+ "number of pages to use for output chunks.",
+ perf_evlist__parse_mmap_pages),
Nit: the short explanation here doesn't mention it at all to the user that
these 'out pages' are used in mmap.
Shouldn't it say:
"number of pages mmap()ed for output chunks."
?
Also, what happens if a user sets it to zero?