linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xin Hao <xhao@linux.alibaba.com>
To: sj@kernel.org
Cc: xhao@linux.alibaba.com, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH V1 2/2] mm/damon: Modify the display form of damon tracepoint
Date: Fri, 10 Dec 2021 00:33:17 +0800	[thread overview]
Message-ID: <1e019e8ffe8c040376ec59e918d301058cc58ade.1639066954.git.xhao@linux.alibaba.com> (raw)
In-Reply-To: <cover.1639066954.git.xhao@linux.alibaba.com>

When I use the perf command to record damon monitor data, like below.
    # perf record -e damon:damon_aggregated
    # perf script
    ...target_id=18446462667479739520 nr_regions=13 281472805928960-281472942936064...
    ...target_id=18446462667479739520 nr_regions=13 281472942936064-281473080008704...
    ...target_id=18446462667479739520 nr_regions=13 281473080008704-281473216634880...

From a user's point of view, the 'target_id' and 'damon_region' which displays in decimal
are not very friendly, So there do some changes, keep the 'target_id' display consistent
with 'dbgfs/target_ids' interface and 'damon_region' is displayed in hexadecimal, just like
below.
    # perf record -e damon:damon_aggregated
    # perf script
    ...target_id=5522 nr_regions=14 ffff716a3000-ffff79893000...
    ...target_id=5522 nr_regions=14 ffff79893000-ffff819dc000...
    ...target_id=5522 nr_regions=14 ffff819dc000-ffff89bd9000...

Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
---
 include/trace/events/damon.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
index 99ffa601e351..67de51814f4c 100644
--- a/include/trace/events/damon.h
+++ b/include/trace/events/damon.h
@@ -17,7 +17,7 @@ TRACE_EVENT(damon_aggregated,
 	TP_ARGS(t, r, nr_regions),

 	TP_STRUCT__entry(
-		__field(unsigned long, target_id)
+		__field(int, target_id)
 		__field(unsigned int, nr_regions)
 		__field(unsigned long, start)
 		__field(unsigned long, end)
@@ -26,7 +26,7 @@ TRACE_EVENT(damon_aggregated,
 	),

 	TP_fast_assign(
-		__entry->target_id = t->id;
+		__entry->target_id = (int)pid_vnr((struct pid *)t->id);
 		__entry->nr_regions = nr_regions;
 		__entry->start = r->ar.start;
 		__entry->end = r->ar.end;
@@ -34,7 +34,7 @@ TRACE_EVENT(damon_aggregated,
 		__entry->age = r->age;
 	),

-	TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u",
+	TP_printk("target_id=%u nr_regions=%u %lx-%lx: %u %u",
 			__entry->target_id, __entry->nr_regions,
 			__entry->start, __entry->end,
 			__entry->nr_accesses, __entry->age)
--
2.31.0


  parent reply	other threads:[~2021-12-09 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 16:33 [PATCH V1 0/2] mm/damon: Do little changes Xin Hao
2021-12-09 16:33 ` [PATCH V1 1/2] mm/damon/dbgfs: Avoid target_ids display wrong pid value Xin Hao
2021-12-09 16:33 ` Xin Hao [this message]
2021-12-09 16:46   ` [PATCH V1 2/2] mm/damon: Modify the display form of damon tracepoint SeongJae Park
2021-12-10  3:36     ` Xin Hao
2021-12-10  8:18       ` SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e019e8ffe8c040376ec59e918d301058cc58ade.1639066954.git.xhao@linux.alibaba.com \
    --to=xhao@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox