All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands
@ 2022-12-26  8:57 Yang Jihong
  2022-12-27 19:34 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Jihong @ 2022-12-26  8:57 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, irogers, linux-perf-users, linux-kernel
  Cc: yangjihong1

Commands such as kmem, kwork, lock, sched, trace and timechart depend on
libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT
macro when cmdlist generation.

The output of the generate-cmdlist.sh script is as follows:

  # ./util/generate-cmdlist.sh
  /* Automatically generated by ./util/generate-cmdlist.sh */
  struct cmdname_help
  {
      char name[16];
      char help[80];
  };

  static struct cmdname_help common_cmds[] = {
    {"annotate", "Read perf.data (created by perf record) and display annotated code"},
    {"archive", "Create archive with object files with build-ids found in perf.data file"},
    {"bench", "General framework for benchmark suites"},
    {"buildid-cache", "Manage build-id cache."},
    {"buildid-list", "List the buildids in a perf.data file"},
    {"c2c", "Shared Data C2C/HITM Analyzer."},
    {"config", "Get and set variables in a configuration file."},
    {"daemon", "Run record sessions on background"},
    {"data", "Data file related processing"},
    {"diff", "Read perf.data files and display the differential profile"},
    {"evlist", "List the event names in a perf.data file"},
    {"ftrace", "simple wrapper for kernel's ftrace functionality"},
    {"inject", "Filter to augment the events stream with additional information"},
    {"iostat", "Show I/O performance metrics"},
    {"kallsyms", "Searches running kernel for symbols"},
    {"kvm", "Tool to trace/measure kvm guest os"},
    {"list", "List all symbolic event types"},
    {"mem", "Profile memory accesses"},
    {"record", "Run a command and record its profile into perf.data"},
    {"report", "Read perf.data (created by perf record) and display the profile"},
    {"script", "Read perf.data (created by perf record) and display trace output"},
    {"stat", "Run a command and gather performance counter statistics"},
    {"test", "Runs sanity tests."},
    {"top", "System profiling tool."},
    {"version", "display the version of perf binary"},
  #ifdef HAVE_LIBELF_SUPPORT
    {"probe", "Define new dynamic tracepoints"},
  #endif /* HAVE_LIBELF_SUPPORT */
  #if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))
    {"trace", "strace inspired tool"},
  #endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */
  #ifdef HAVE_LIBTRACEEVENT
    {"kmem", "Tool to trace/measure kernel memory properties"},
    {"kwork", "Tool to trace/measure kernel work properties (latencies)"},
    {"lock", "Analyze lock events"},
    {"sched", "Tool to trace/measure scheduler properties (latencies)"},
    {"timechart", "Tool to visualize total system behavior during a workload"},
  #endif /* HAVE_LIBTRACEEVENT */
  };

Fixes: 378ef0f5d9d7 ("perf build: Use libtraceevent from the system")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
 tools/perf/command-list.txt         | 10 +++++-----
 tools/perf/util/generate-cmdlist.sh | 19 +++++++++++++++++--
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt
index 8fcab5ad00c5..e8d2762adade 100644
--- a/tools/perf/command-list.txt
+++ b/tools/perf/command-list.txt
@@ -16,20 +16,20 @@ perf-ftrace			mainporcelain common
 perf-inject			mainporcelain common
 perf-iostat			mainporcelain common
 perf-kallsyms			mainporcelain common
-perf-kmem			mainporcelain common
+perf-kmem			mainporcelain traceevent
 perf-kvm			mainporcelain common
-perf-kwork			mainporcelain common
+perf-kwork			mainporcelain traceevent
 perf-list			mainporcelain common
-perf-lock			mainporcelain common
+perf-lock			mainporcelain traceevent
 perf-mem			mainporcelain common
 perf-probe			mainporcelain full
 perf-record			mainporcelain common
 perf-report			mainporcelain common
-perf-sched			mainporcelain common
+perf-sched			mainporcelain traceevent
 perf-script			mainporcelain common
 perf-stat			mainporcelain common
 perf-test			mainporcelain common
-perf-timechart			mainporcelain common
+perf-timechart			mainporcelain traceevent
 perf-top			mainporcelain common
 perf-trace			mainporcelain audit
 perf-version			mainporcelain common
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index c3cef36d4176..1b5140e5ce99 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -38,7 +38,7 @@ do
 done
 echo "#endif /* HAVE_LIBELF_SUPPORT */"
 
-echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)"
+echo "#if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))"
 sed -n -e 's/^perf-\([^ 	]*\)[ 	].* audit*/\1/p' command-list.txt |
 sort |
 while read cmd
@@ -51,5 +51,20 @@ do
 	    p
      }' "Documentation/perf-$cmd.txt"
 done
-echo "#endif /* HAVE_LIBELF_SUPPORT */"
+echo "#endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */"
+
+echo "#ifdef HAVE_LIBTRACEEVENT"
+sed -n -e 's/^perf-\([^ 	]*\)[ 	].* traceevent.*/\1/p' command-list.txt |
+sort |
+while read cmd
+do
+     sed -n '
+     /^NAME/,/perf-'"$cmd"'/H
+     ${
+            x
+            s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
+            p
+     }' "Documentation/perf-$cmd.txt"
+done
+echo "#endif /* HAVE_LIBTRACEEVENT */"
 echo "};"
-- 
2.17.1


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

* Re: [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands
  2022-12-26  8:57 [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands Yang Jihong
@ 2022-12-27 19:34 ` Namhyung Kim
  2023-01-02 14:52   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2022-12-27 19:34 UTC (permalink / raw)
  To: Yang Jihong
  Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	irogers, linux-perf-users, linux-kernel

Hello,

On Mon, Dec 26, 2022 at 1:00 AM Yang Jihong <yangjihong1@huawei.com> wrote:
>
> Commands such as kmem, kwork, lock, sched, trace and timechart depend on
> libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT
> macro when cmdlist generation.
>
> The output of the generate-cmdlist.sh script is as follows:
>
>   # ./util/generate-cmdlist.sh
>   /* Automatically generated by ./util/generate-cmdlist.sh */
>   struct cmdname_help
>   {
>       char name[16];
>       char help[80];
>   };
>
>   static struct cmdname_help common_cmds[] = {
>     {"annotate", "Read perf.data (created by perf record) and display annotated code"},
>     {"archive", "Create archive with object files with build-ids found in perf.data file"},
>     {"bench", "General framework for benchmark suites"},
>     {"buildid-cache", "Manage build-id cache."},
>     {"buildid-list", "List the buildids in a perf.data file"},
>     {"c2c", "Shared Data C2C/HITM Analyzer."},
>     {"config", "Get and set variables in a configuration file."},
>     {"daemon", "Run record sessions on background"},
>     {"data", "Data file related processing"},
>     {"diff", "Read perf.data files and display the differential profile"},
>     {"evlist", "List the event names in a perf.data file"},
>     {"ftrace", "simple wrapper for kernel's ftrace functionality"},
>     {"inject", "Filter to augment the events stream with additional information"},
>     {"iostat", "Show I/O performance metrics"},
>     {"kallsyms", "Searches running kernel for symbols"},
>     {"kvm", "Tool to trace/measure kvm guest os"},
>     {"list", "List all symbolic event types"},
>     {"mem", "Profile memory accesses"},
>     {"record", "Run a command and record its profile into perf.data"},
>     {"report", "Read perf.data (created by perf record) and display the profile"},
>     {"script", "Read perf.data (created by perf record) and display trace output"},
>     {"stat", "Run a command and gather performance counter statistics"},
>     {"test", "Runs sanity tests."},
>     {"top", "System profiling tool."},
>     {"version", "display the version of perf binary"},
>   #ifdef HAVE_LIBELF_SUPPORT
>     {"probe", "Define new dynamic tracepoints"},
>   #endif /* HAVE_LIBELF_SUPPORT */
>   #if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))
>     {"trace", "strace inspired tool"},
>   #endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */
>   #ifdef HAVE_LIBTRACEEVENT
>     {"kmem", "Tool to trace/measure kernel memory properties"},
>     {"kwork", "Tool to trace/measure kernel work properties (latencies)"},
>     {"lock", "Analyze lock events"},
>     {"sched", "Tool to trace/measure scheduler properties (latencies)"},
>     {"timechart", "Tool to visualize total system behavior during a workload"},
>   #endif /* HAVE_LIBTRACEEVENT */
>   };
>
> Fixes: 378ef0f5d9d7 ("perf build: Use libtraceevent from the system")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  tools/perf/command-list.txt         | 10 +++++-----
>  tools/perf/util/generate-cmdlist.sh | 19 +++++++++++++++++--
>  2 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt
> index 8fcab5ad00c5..e8d2762adade 100644
> --- a/tools/perf/command-list.txt
> +++ b/tools/perf/command-list.txt
> @@ -16,20 +16,20 @@ perf-ftrace                 mainporcelain common
>  perf-inject                    mainporcelain common
>  perf-iostat                    mainporcelain common
>  perf-kallsyms                  mainporcelain common
> -perf-kmem                      mainporcelain common
> +perf-kmem                      mainporcelain traceevent
>  perf-kvm                       mainporcelain common
> -perf-kwork                     mainporcelain common
> +perf-kwork                     mainporcelain traceevent
>  perf-list                      mainporcelain common
> -perf-lock                      mainporcelain common
> +perf-lock                      mainporcelain traceevent
>  perf-mem                       mainporcelain common
>  perf-probe                     mainporcelain full
>  perf-record                    mainporcelain common
>  perf-report                    mainporcelain common
> -perf-sched                     mainporcelain common
> +perf-sched                     mainporcelain traceevent
>  perf-script                    mainporcelain common
>  perf-stat                      mainporcelain common
>  perf-test                      mainporcelain common
> -perf-timechart                 mainporcelain common
> +perf-timechart                 mainporcelain traceevent
>  perf-top                       mainporcelain common
>  perf-trace                     mainporcelain audit
>  perf-version                   mainporcelain common
> diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
> index c3cef36d4176..1b5140e5ce99 100755
> --- a/tools/perf/util/generate-cmdlist.sh
> +++ b/tools/perf/util/generate-cmdlist.sh
> @@ -38,7 +38,7 @@ do
>  done
>  echo "#endif /* HAVE_LIBELF_SUPPORT */"
>
> -echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)"
> +echo "#if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))"
>  sed -n -e 's/^perf-\([^        ]*\)[   ].* audit*/\1/p' command-list.txt |
>  sort |
>  while read cmd
> @@ -51,5 +51,20 @@ do
>             p
>       }' "Documentation/perf-$cmd.txt"
>  done
> -echo "#endif /* HAVE_LIBELF_SUPPORT */"
> +echo "#endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */"
> +
> +echo "#ifdef HAVE_LIBTRACEEVENT"
> +sed -n -e 's/^perf-\([^        ]*\)[   ].* traceevent.*/\1/p' command-list.txt |
> +sort |
> +while read cmd
> +do
> +     sed -n '
> +     /^NAME/,/perf-'"$cmd"'/H
> +     ${
> +            x
> +            s/.*perf-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
> +            p
> +     }' "Documentation/perf-$cmd.txt"
> +done
> +echo "#endif /* HAVE_LIBTRACEEVENT */"
>  echo "};"
> --
> 2.17.1
>

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

* Re: [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands
  2022-12-27 19:34 ` Namhyung Kim
@ 2023-01-02 14:52   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-01-02 14:52 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Yang Jihong, peterz, mingo, mark.rutland, alexander.shishkin,
	jolsa, irogers, linux-perf-users, linux-kernel

Em Tue, Dec 27, 2022 at 11:34:46AM -0800, Namhyung Kim escreveu:
> Hello,
> 
> On Mon, Dec 26, 2022 at 1:00 AM Yang Jihong <yangjihong1@huawei.com> wrote:
> >
> > Commands such as kmem, kwork, lock, sched, trace and timechart depend on
> > libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT
> > macro when cmdlist generation.
> >
> > The output of the generate-cmdlist.sh script is as follows:
> >
> >   # ./util/generate-cmdlist.sh
> >   /* Automatically generated by ./util/generate-cmdlist.sh */
> >   struct cmdname_help
> >   {
> >       char name[16];
> >       char help[80];
> >   };

Thanks, applied.

- Arnaldo


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

end of thread, other threads:[~2023-01-02 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-26  8:57 [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands Yang Jihong
2022-12-27 19:34 ` Namhyung Kim
2023-01-02 14:52   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.