[PATCH v5 04/21] perf script: Move scripting_max_stack out of builtin

Ian Rogers posted 21 patches 3 weeks, 3 days ago
There is a newer version of this series
[PATCH v5 04/21] perf script: Move scripting_max_stack out of builtin
Posted by Ian Rogers 3 weeks, 3 days ago
scripting_max_stack is used in util code which is linked into the
python module. Move the variable declaration to
util/trace-event-scripting.c to avoid conditional compilation.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/builtin-script.c             | 2 --
 tools/perf/util/python.c                | 2 --
 tools/perf/util/trace-event-scripting.c | 3 +++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 6b6d4472db6e..5d5a1a06d8c6 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -92,8 +92,6 @@ static struct dlfilter		*dlfilter;
 static int			dlargc;
 static char			**dlargv;
 
-unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
-
 enum perf_output_field {
 	PERF_OUTPUT_COMM            = 1ULL << 0,
 	PERF_OUTPUT_TID             = 1ULL << 1,
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 974578a04099..298f43981fc5 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -1306,8 +1306,6 @@ PyMODINIT_FUNC PyInit_perf(void)
 /* The following are stubs to avoid dragging in builtin-* objects. */
 /* TODO: move the code out of the builtin-* file into util. */
 
-unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
-
 bool kvm_entry_event(struct evsel *evsel __maybe_unused)
 {
 	return false;
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index bd0000300c77..8abb7a7b6888 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -16,9 +16,12 @@
 #include "debug.h"
 #include "trace-event.h"
 #include "evsel.h"
+#include <linux/perf_event.h>
 #include <linux/zalloc.h>
 #include "util/sample.h"
 
+unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
+
 struct scripting_context *scripting_context;
 
 void scripting_context__update(struct scripting_context *c,
-- 
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v5 04/21] perf script: Move scripting_max_stack out of builtin
Posted by Arnaldo Carvalho de Melo 3 weeks, 3 days ago
On Wed, Oct 30, 2024 at 06:42:35PM -0700, Ian Rogers wrote:
> scripting_max_stack is used in util code which is linked into the
> python module. Move the variable declaration to
> util/trace-event-scripting.c to avoid conditional compilation.

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/builtin-script.c             | 2 --
>  tools/perf/util/python.c                | 2 --
>  tools/perf/util/trace-event-scripting.c | 3 +++
>  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 6b6d4472db6e..5d5a1a06d8c6 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -92,8 +92,6 @@ static struct dlfilter		*dlfilter;
>  static int			dlargc;
>  static char			**dlargv;
>  
> -unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
> -
>  enum perf_output_field {
>  	PERF_OUTPUT_COMM            = 1ULL << 0,
>  	PERF_OUTPUT_TID             = 1ULL << 1,
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index 974578a04099..298f43981fc5 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -1306,8 +1306,6 @@ PyMODINIT_FUNC PyInit_perf(void)
>  /* The following are stubs to avoid dragging in builtin-* objects. */
>  /* TODO: move the code out of the builtin-* file into util. */
>  
> -unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
> -
>  bool kvm_entry_event(struct evsel *evsel __maybe_unused)
>  {
>  	return false;
> diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
> index bd0000300c77..8abb7a7b6888 100644
> --- a/tools/perf/util/trace-event-scripting.c
> +++ b/tools/perf/util/trace-event-scripting.c
> @@ -16,9 +16,12 @@
>  #include "debug.h"
>  #include "trace-event.h"
>  #include "evsel.h"
> +#include <linux/perf_event.h>
>  #include <linux/zalloc.h>
>  #include "util/sample.h"
>  
> +unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
> +
>  struct scripting_context *scripting_context;
>  
>  void scripting_context__update(struct scripting_context *c,
> -- 
> 2.47.0.163.g1226f6d8fa-goog