linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf jevents: Ignore sys when determining a model directory
@ 2024-09-04 21:17 Ian Rogers
  2024-09-05 15:11 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2024-09-04 21:17 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Sandipan Das,
	Jing Zhang, Xu Yang, Thomas Richter, linux-perf-users,
	linux-kernel
  Cc: Stephane Eranian

Existing sys directories aren't placed under a model directory like
skylake. Placing a sys directory there causes the `is_leaf_dir` test
to fail and consequently no events or metrics are generated for the
model. Ignore sys directories in this case and update the comments to
reflect why.

This change has no affect, but when testing with a sys directory for a
model people have reported running into the no event/metric issue.

Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/pmu-events/jevents.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
index 1d96b2204e52..bb0a5d92df4a 100755
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -635,14 +635,17 @@ def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
 
 def process_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
   """Process a JSON file during the main walk."""
-  def is_leaf_dir(path: str) -> bool:
+  def is_leaf_dir_ignoring_sys(path: str) -> bool:
     for item in os.scandir(path):
-      if item.is_dir():
+      if item.is_dir() and item.name != 'sys':
         return False
     return True
 
-  # model directory, reset topic
-  if item.is_dir() and is_leaf_dir(item.path):
+  # Model directories are leaves (ignoring possible sys
+  # directories). The FTW will walk into the directory next. Flush
+  # pending events and metrics and update the table names for the new
+  # model directory.
+  if item.is_dir() and is_leaf_dir_ignoring_sys(item.path):
     print_pending_events()
     print_pending_metrics()
 
-- 
2.46.0.469.g59c65b2a67-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] perf jevents: Ignore sys when determining a model directory
  2024-09-04 21:17 [PATCH v1] perf jevents: Ignore sys when determining a model directory Ian Rogers
@ 2024-09-05 15:11 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-09-05 15:11 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Kan Liang,
	John Garry, Sandipan Das, Jing Zhang, Xu Yang, Thomas Richter,
	linux-perf-users, linux-kernel, Stephane Eranian

On Wed, Sep 04, 2024 at 02:17:05PM -0700, Ian Rogers wrote:
> Existing sys directories aren't placed under a model directory like
> skylake. Placing a sys directory there causes the `is_leaf_dir` test
> to fail and consequently no events or metrics are generated for the
> model. Ignore sys directories in this case and update the comments to
> reflect why.
> 
> This change has no affect, but when testing with a sys directory for a
> model people have reported running into the no event/metric issue.

Thanks, applied, if Stephan is satisfied with the fix and have tested
it, please consider providing a Tested-by,

Thanks,

- Arnaldo
 
> Reported-by: Stephane Eranian <eranian@google.com>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/pmu-events/jevents.py | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
> index 1d96b2204e52..bb0a5d92df4a 100755
> --- a/tools/perf/pmu-events/jevents.py
> +++ b/tools/perf/pmu-events/jevents.py
> @@ -635,14 +635,17 @@ def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
>  
>  def process_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
>    """Process a JSON file during the main walk."""
> -  def is_leaf_dir(path: str) -> bool:
> +  def is_leaf_dir_ignoring_sys(path: str) -> bool:
>      for item in os.scandir(path):
> -      if item.is_dir():
> +      if item.is_dir() and item.name != 'sys':
>          return False
>      return True
>  
> -  # model directory, reset topic
> -  if item.is_dir() and is_leaf_dir(item.path):
> +  # Model directories are leaves (ignoring possible sys
> +  # directories). The FTW will walk into the directory next. Flush
> +  # pending events and metrics and update the table names for the new
> +  # model directory.
> +  if item.is_dir() and is_leaf_dir_ignoring_sys(item.path):
>      print_pending_events()
>      print_pending_metrics()
>  
> -- 
> 2.46.0.469.g59c65b2a67-goog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-05 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 21:17 [PATCH v1] perf jevents: Ignore sys when determining a model directory Ian Rogers
2024-09-05 15:11 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).