linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf python: Remove PYTHON_PERF ifdefs
@ 2024-07-31 23:00 Ian Rogers
  2024-08-01 14:55 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2024-07-31 23:00 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, James Clark,
	linux-perf-users, linux-kernel

When perf code was compiled one way for the binary and another for the
python module, the PYTHON_PERF ifdef was used to remove some code from
the python module. Since switching to building the perf code as a
series of libraries, with the same libraries being used for the python
module, the ifdefs became unused as PYTHON_PERF is never defined. As
such remove the ifdefs.

Fixes: 9dabf4003423 ("perf python: Switch module to linking libraries from building source")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/evsel_fprintf.c | 2 --
 tools/perf/util/mmap.c          | 4 ----
 2 files changed, 6 deletions(-)

diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 8719b3cb5646..c2c0500d5da9 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -107,7 +107,6 @@ int evsel__fprintf(struct evsel *evsel, struct perf_attr_details *details, FILE
 	return ++printed;
 }
 
-#ifndef PYTHON_PERF
 int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
 			      unsigned int print_opts, struct callchain_cursor *cursor,
 			      struct strlist *bt_stop_list, FILE *fp)
@@ -248,4 +247,3 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,
 
 	return printed;
 }
-#endif /* PYTHON_PERF */
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 122ee198a86e..43b02293f1d2 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -230,9 +230,7 @@ void mmap__munmap(struct mmap *map)
 {
 	bitmap_free(map->affinity_mask.bits);
 
-#ifndef PYTHON_PERF
 	zstd_fini(&map->zstd_data);
-#endif
 
 	perf_mmap__aio_munmap(map);
 	if (map->data != NULL) {
@@ -295,12 +293,10 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu
 
 	map->core.flush = mp->flush;
 
-#ifndef PYTHON_PERF
 	if (zstd_init(&map->zstd_data, mp->comp_level)) {
 		pr_debug2("failed to init mmap compressor, error %d\n", errno);
 		return -1;
 	}
-#endif
 
 	if (mp->comp_level && !perf_mmap__aio_enabled(map)) {
 		map->data = mmap(NULL, mmap__mmap_len(map), PROT_READ|PROT_WRITE,
-- 
2.46.0.rc2.264.g509ed76dc8-goog


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

* Re: [PATCH v1] perf python: Remove PYTHON_PERF ifdefs
  2024-07-31 23:00 [PATCH v1] perf python: Remove PYTHON_PERF ifdefs Ian Rogers
@ 2024-08-01 14:55 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-08-01 14:55 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Kan Liang,
	James Clark, linux-perf-users, linux-kernel

On Wed, Jul 31, 2024 at 04:00:05PM -0700, Ian Rogers wrote:
> When perf code was compiled one way for the binary and another for the
> python module, the PYTHON_PERF ifdef was used to remove some code from
> the python module. Since switching to building the perf code as a
> series of libraries, with the same libraries being used for the python
> module, the ifdefs became unused as PYTHON_PERF is never defined. As
> such remove the ifdefs.
> 
> Fixes: 9dabf4003423 ("perf python: Switch module to linking libraries from building source")
> Signed-off-by: Ian Rogers <irogers@google.com>

Thanks, applied to tmp.perf-tools-next,

- Arnaldo

> ---
>  tools/perf/util/evsel_fprintf.c | 2 --
>  tools/perf/util/mmap.c          | 4 ----
>  2 files changed, 6 deletions(-)
> 
> diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
> index 8719b3cb5646..c2c0500d5da9 100644
> --- a/tools/perf/util/evsel_fprintf.c
> +++ b/tools/perf/util/evsel_fprintf.c
> @@ -107,7 +107,6 @@ int evsel__fprintf(struct evsel *evsel, struct perf_attr_details *details, FILE
>  	return ++printed;
>  }
>  
> -#ifndef PYTHON_PERF
>  int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
>  			      unsigned int print_opts, struct callchain_cursor *cursor,
>  			      struct strlist *bt_stop_list, FILE *fp)
> @@ -248,4 +247,3 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,
>  
>  	return printed;
>  }
> -#endif /* PYTHON_PERF */
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 122ee198a86e..43b02293f1d2 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -230,9 +230,7 @@ void mmap__munmap(struct mmap *map)
>  {
>  	bitmap_free(map->affinity_mask.bits);
>  
> -#ifndef PYTHON_PERF
>  	zstd_fini(&map->zstd_data);
> -#endif
>  
>  	perf_mmap__aio_munmap(map);
>  	if (map->data != NULL) {
> @@ -295,12 +293,10 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu
>  
>  	map->core.flush = mp->flush;
>  
> -#ifndef PYTHON_PERF
>  	if (zstd_init(&map->zstd_data, mp->comp_level)) {
>  		pr_debug2("failed to init mmap compressor, error %d\n", errno);
>  		return -1;
>  	}
> -#endif
>  
>  	if (mp->comp_level && !perf_mmap__aio_enabled(map)) {
>  		map->data = mmap(NULL, mmap__mmap_len(map), PROT_READ|PROT_WRITE,
> -- 
> 2.46.0.rc2.264.g509ed76dc8-goog

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

end of thread, other threads:[~2024-08-01 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 23:00 [PATCH v1] perf python: Remove PYTHON_PERF ifdefs Ian Rogers
2024-08-01 14:55 ` 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).