mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Ian Rogers <irogers@google.com>
Cc: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<namhyung@kernel.org>, <james.clark@arm.com>,
	<yu.c.chen@intel.com>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
	<rostedt@goodmis.org>, <vincent.guittot@linaro.org>,
	<adrian.hunter@intel.com>, <kan.liang@linux.intel.com>,
	<gautham.shenoy@amd.com>, <kprateek.nayak@amd.com>,
	<juri.lelli@redhat.com>, <yangjihong@bytedance.com>,
	<void@manifault.com>, <tj@kernel.org>, <sshegde@linux.ibm.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>, <santosh.shukla@amd.com>,
	<sandipan.das@amd.com>, Cristian Prundeanu <cpru@amazon.com>,
	"Sapkal, Swapnil" <swapnil.sapkal@amd.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH v4 00/11] perf sched: Introduce stats tool
Date: Fri, 12 Dec 2025 09:13:40 +0530	[thread overview]
Message-ID: <4f231fbb-d38b-4c0e-82dc-6b334f340943@amd.com> (raw)
In-Reply-To: <CAP-5=fWSFgkWggNaYDRno=Lv+s980_9ckr3vKy+CX2TsCJH+vA@mail.gmail.com>

Hi Ian,

>>> Next is CPU scheduling statistics. These are simple diffs of
>>> /proc/schedstat CPU lines along with description. The report also
>>> prints % relative to base stat.
> 
> I wonder if this is similar to user_time and system_time:
> ```
> $ perf list
> ...
> tool:
> ...
>  system_time
>       [System/kernel time in nanoseconds. Unit: tool]
> ...
>  user_time
>       [User (non-kernel) time in nanoseconds. Unit: tool]
> ...
> ```
> These events are implemented by reading /proc/stat and /proc/pid/stat:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/tool_pmu.c?h=perf-tools-next#n267
> 
> As they are events then they can appear in perf stat output and also
> within metrics.

Create synthesized events for each field of /proc/schedstat?

Your idea is interesting and, I suppose, will work best when we care
about individual counters. However, for the "perf sched stats" tool,
I see atleast two challenges:

1. One of the design goal of "perf sched stats" was to keep the
   overhead low. Currently, it reads /proc/schedstat once at the
   beginning and once at the end. Switching to per-counter events
   would require opening, reading and closing a large number of
   events which would incur significant overhead.

2. Taking a snapshot in one go allows us to correlate counts easily.
   Using synthetic events would force us to read each counter
   individually, making cross-counter correlation impossible.

Thanks,
Ravi

  reply	other threads:[~2025-12-12  3:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  5:10 Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 01/11] perf: Add print_separator to util Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 02/11] tools/lib: Add list_is_first() Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 03/11] perf header: Support CPU DOMAIN relation info Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 04/11] perf sched stats: Add record and rawdump support Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 05/11] perf sched stats: Add schedstat v16 support Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 06/11] perf sched stats: Add schedstat v17 support Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 07/11] perf sched stats: Add support for report subcommand Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 08/11] perf sched stats: Add support for live mode Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 09/11] perf sched stats: Add support for diff subcommand Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 10/11] perf sched stats: Add basic perf sched stats test Swapnil Sapkal
2025-08-26  5:10 ` [PATCH v4 11/11] perf sched stats: Add details in man page Swapnil Sapkal
2025-08-28  4:43 ` [PATCH v4 00/11] perf sched: Introduce stats tool Sapkal, Swapnil
2025-12-09 21:03   ` Ian Rogers
2025-12-12  3:43     ` Ravi Bangoria [this message]
2025-12-12  5:11       ` Ian Rogers
2025-12-16 10:09     ` Swapnil Sapkal
2025-12-17 15:37       ` Namhyung Kim
2025-12-18  9:46         ` Swapnil Sapkal

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=4f231fbb-d38b-4c0e-82dc-6b334f340943@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=cpru@amazon.com \
    --cc=gautham.shenoy@amd.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sandipan.das@amd.com \
    --cc=santosh.shukla@amd.com \
    --cc=sshegde@linux.ibm.com \
    --cc=swapnil.sapkal@amd.com \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=yangjihong@bytedance.com \
    --cc=yu.c.chen@intel.com \
    /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

all inboxes | Powered by JetHome®