The default watermark is half of the total buffer size. In many cases,
the tool can not be notified with sufficient free space, especially when
profiling with small AUX buffer (e.g., 64KiB).
Setting watermark to quarter of the buffer to notifies the tool to read
data earlier and prevents the data loss.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/perf/arch/arm/util/cs-etm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index ea891d12f8f40beebf8dee1d3db71cad701f5666..649b8b0d0f92b4af45fb97db9da3c5ccf24a978b 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -424,6 +424,13 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
pr_debug2("%s snapshot size: %zu\n", CORESIGHT_ETM_PMU_NAME,
opts->auxtrace_snapshot_size);
+ if (!opts->auxtrace_snapshot_mode && !opts->auxtrace_sample_mode) {
+ size_t aw = opts->auxtrace_mmap_pages * (size_t)page_size / 4;
+ u32 aux_watermark = aw > UINT_MAX ? UINT_MAX : aw;
+
+ cs_etm_evsel->core.attr.aux_watermark = aux_watermark;
+ }
+
/*
* To obtain the auxtrace buffer file descriptor, the auxtrace
* event must come first.
--
2.34.1