Skip to contentSkip to conversation

tools/perf: Integrate DAMON in perf

RFC PATCH New SeongJae Park 1 participant 1 message Jan 7, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tools/perf: Integrate DAMON in perf

From: SeongJae Park <[email protected]>

NOTE: This RFC has a dependancy on DAMON (Data Access MONitor) patchset[1], which is not merged in the mainline yet. The aim of this is to show how DAMON would be evolved once it is merged in and get some comments early. So, if you have some interest in this, please consider reviewing the DAMON patchset, either.

[1] https://lore.kernel.org/linux-mm/[email protected]

---

Though there is a simple debugfs interface for DAMON and even a dedicated user space tool, integrating the interface in perf will make best user experiences. For the reason, this commit adds perf scripts for DAMON. After this commit, users can record the data access monitoring results and read in human readable form with:

    $ sudo perf script record damon
    $ sudo perf script report damon

or simply,

    $ sudo perf script damon

Nevertheless, above commands do not start the monitoring by themselves, so the user should turn it on in background. To make it easy, this commit also adds a convenient version of 'perf script record damon', which executes a command, turns on DAMON for the process, and records DAMON trace events. For example, it can be used as:

    $ sudo ~/libexec/perf-core/scripts/python/bin/damon-record.sh <cmd>
    $ sudo perf script report damon

Currently, the report command supports only raw format.

---
 tools/perf/scripts/python/bin/damon-record    |   4 +
 tools/perf/scripts/python/bin/damon-record.sh | 163 ++++++++++++++++++
 tools/perf/scripts/python/bin/damon-report    |   4 +
 tools/perf/scripts/python/damon.py            |  44 +++++
 4 files changed, 215 insertions(+)
 create mode 100644 tools/perf/scripts/python/bin/damon-record
 create mode 100644 tools/perf/scripts/python/bin/damon-record.sh
 create mode 100644 tools/perf/scripts/python/bin/damon-report
 create mode 100644 tools/perf/scripts/python/damon.py
tools/perf/scripts/python/bin/damon-record new file +4 -0
new file mode 100644
index 000000000000..6e21802c8c0e
@@ -0,0 +1,4 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+perf record -e damon:damon_aggregated $@
tools/perf/scripts/python/bin/damon-record.sh new file +163 -0

163 lines not on this page · raw message

tools/perf/scripts/python/bin/damon-report new file +4 -0
new file mode 100644
index 000000000000..89ece171959e
@@ -0,0 +1,4 @@
+#!/bin/bash
+# description: data access monitoring
+
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/damon.py
tools/perf/scripts/python/damon.py new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.17.1