Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp347935lqs; Thu, 13 Jun 2024 11:43:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgLN6hSlLCpaYunJLLuckNqsWE5NciJ/qnWnyx0hQhNrvCjOPG0YR+cOYyw5AoDU5iP+bMT82ftwg7Xg2EM9kZLCv2MkjPimr/JMSKnA== X-Google-Smtp-Source: AGHT+IEL/mIXfWb+TA/flLgPY/UXo06PAMpJmXg8soPmNDdfxmrhOvldd0nk4pPcnKC7ZwpUzG5f X-Received: by 2002:a17:906:25d5:b0:a6f:608e:c0d0 with SMTP id a640c23a62f3a-a6f60d37751mr41634366b.25.1718304210891; Thu, 13 Jun 2024 11:43:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718304210; cv=pass; d=google.com; s=arc-20160816; b=uKs13JATPd2A9pujihdZ7fwTyy630yaLEuX3R6d9BCQ205tehoWdnud7mkY0r8vjoe LdurRD9MZ3NfPGhwwqfHikg52aRqvItTp4TILgPi2eyIUBrJMFO8eDOQbqiK+jVWaaT2 Q1cYdzqZUOF5ki8Xwrl/FIBjnhcP7vvvq4inzc2ejeJ4DrbI9CCBf9IGG+AO4oL+C769 MLP96naCv9lQdMKa4ANAwTYBBXAMpxJ3FQMSljlZc2nfyN9SX3oZViHtUtemJ4I4HH9J P7UfmJV9+W4ihbpGL0+u2s4OKBNY+gLnXkBkl4j4Ipd8tF9PT232z4rYiISmmyzwEzlD k/xQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=ypeRfrMxrBCZjC38pT/Y3lCrmNLlrnXhQoa5V7sluF8=; fh=RC5pluZeX75aw5muxFI8liU0UDD+PlSGiHG8MFeqfFE=; b=yFaNeox/dYQpQoSZCYxaQOaJ3zB0zEBuf5zd7+iaEgABLpwLpoIVKcbtVLrEPx4W71 LHXHNj/HfWEle8Lfyz60HBBD1tR6wmvqrTFRkRJt2Bf+pV1dd7ffK+BazdukW+RwC+e+ Z9qReyaX978SMUEpTrwpGXZIw9p3rMwnqZUjSKuycFoKNSDomYO3LYkLqWwSWI6gBBrw CnSUCZw3wXcMKUUXpSSFpN2s22mbHg8DxZEBt3rC5YN4r5bEodcECOKMrlWWtGKIFLrt MUol7b685k/FxwHt1srcEI0YmI4tdHmbtq0gFvRpBMgD18G6zgfUpc6ESYNG4pW7TICZ lJvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J6quUZSv; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-213841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56e26fa7si96077866b.763.2024.06.13.11.43.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 11:43:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=J6quUZSv; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-213841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7E83C1F246FF for ; Thu, 13 Jun 2024 18:35:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2EDF157460; Thu, 13 Jun 2024 18:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="J6quUZSv" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69C9A156652 for ; Thu, 13 Jun 2024 18:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718303575; cv=none; b=G65dAlAA6FDhn7ZdA+1KpmIHOuh+N6o9hWNGlsK/Zluek0/7bNd2kOqWNGmxRyMGHh5ZLslZ0rZTnBC5j7BgPcCBh6ayXciqpTaMB5PaavrQzDJdeLmatRYqzwAyZHmplWP8yfnXzKjx0NYJkqk94m8pDFlWrKyii+4/CsjaRT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718303575; c=relaxed/simple; bh=jdDVD2dv1/rqbFd/3QUGMKf/GFRV78NDaLF0Z52AGZQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=J+3J6S8c7vlWptQLgJ7XczLPIKxkWp28vDnyQBCRcKItaIt2nKE3pxM3HzS+IA5xTBVYKUzc1j76rPrUce+Q4nyxGvC93SukGouUje2k0DQIP3K7L5I3CSE1Y1r5HXS1Za5daHwOakrieI9hvCfP7Hvrww9D/3EdQHHAM+3ePXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=J6quUZSv; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62fb36d7f5fso25516127b3.1 for ; Thu, 13 Jun 2024 11:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718303568; x=1718908368; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ypeRfrMxrBCZjC38pT/Y3lCrmNLlrnXhQoa5V7sluF8=; b=J6quUZSvFzJNo7bnI24SbyA9pUYuIMgYTggOhTVpt9AA3QL+XG+0PosIemhgT2E9Wv 7DKg0/FC0xW5aoJ/l5tm2LAtlkQbhwfwjCZnoNjxYRUFP0cjIIKKDv/CeQ0Sle9as46j CcioxkCFtgyyiTWiim06QHNVQTPX++qh+D+RprVxWQOeoblFyaSRFPtVM/ier2+gLFZv t2+8SXLCdZ6UYpjy2rlnyFQkBcr3Tz9sl0T87ASvBql+1Md5/esrFvm3oKT8a90Q6a/F yOSw2K2Od3lCfzA8URaXDK2OuVDcL+96CqAai+KWUJdyeC7/w1uHP4xGNONYCCzdBfoe PuvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718303568; x=1718908368; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ypeRfrMxrBCZjC38pT/Y3lCrmNLlrnXhQoa5V7sluF8=; b=ZR8oXKkBdAaWj6KK1+3AQioehvmTru+4sZlVdG6O/b1yP1f7p8W2L7OnQ4EeLPlOwr DGrKvvpoezJOm44l5y5REVANxMw1V764Q+D/pa5gfefVTU+5eKlFYY1WWFkTKjI3rOpW 1oaecOkhU+7WIQwc6N5yzdkTu4PX80PYP9T8O+ip7VacqiXDO3+bec8Emw3THwnlVKNZ d5k+X6n/uhx4DX/i/K/kKakYNdKeermwotYSVkcGOcWh8i97w2wl86WZ+/F9cJ9766/A GmZ0e937TNNFvYihffPSh6LggKIjYZoqaXO8EV70RGj7gHjH3BZx/oDJhrqiTj5uYd0C ty/g== X-Forwarded-Encrypted: i=1; AJvYcCVrt/u7Yr3AEjpkS1FwS45NtYs3y5EYQ/O8amwuWsXjyPRGhcWzfkxp3gzkjY8FJTSQSJNen14L9rMcbO41BgkcaW07XRSDp1UUCrMa X-Gm-Message-State: AOJu0Yy1uaECCFfrSLC7ujcJdv+AvgZ0oYQO2N+PnOyUhg9Y84Sz8n+g yn7FE3KrZG3LkP4SUxKpGjKVq/wlEc3xjPeyfjtEX+N8zFPlsYamdfnhpQAXX5n4MpCALGRpuQy rVNvw8Q== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:690c:6503:b0:62c:fa1a:21d2 with SMTP id 00721157ae682-6322206f2d0mr747867b3.1.1718303568410; Thu, 13 Jun 2024 11:32:48 -0700 (PDT) Date: Thu, 13 Jun 2024 11:32:23 -0700 In-Reply-To: <20240613183224.3399628-1-irogers@google.com> Message-Id: <20240613183224.3399628-8-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240613183224.3399628-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v2 7/8] perf python: Switch module to linking libraries from building source From: Ian Rogers 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 , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , Nick Terrell , Ravi Bangoria , Kees Cook , Andrei Vagin , Athira Jajeev , Oliver Upton , Ze Gao , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, coresight@lists.linaro.org, rust-for-linux@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" setup.py was building most perf sources causing setup.py to mimic the Makefile logic as well as flex/bison code to be stubbed out, due to complexity building. By using libraries fewer functions are stubbed out, the build is faster and the Makefile logic is reused which should simplify updating. The libraries are passed through LDFLAGS to avoid complexity in python. Force the -fPIC flag for libbpf.a to ensure it is suitable for linking into the perf python module. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/Makefile.config | 5 + tools/perf/Makefile.perf | 6 +- tools/perf/util/python.c | 271 ++++++++++++++----------------------- tools/perf/util/setup.py | 33 +---- 4 files changed, 110 insertions(+), 205 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 7f1e016a9253..639be696f597 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -910,6 +910,11 @@ else endif CFLAGS += -DHAVE_LIBPYTHON_SUPPORT $(call detected,CONFIG_LIBPYTHON) + ifeq ($(filter -fPIC,$(CFLAGS)),) + # Building a shared library requires position independent code. + CFLAGS += -fPIC + CXXFLAGS += -fPIC + endif endif endif endif diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ff03f0431013..4a1a9f09fa09 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -715,9 +715,9 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) # Create python binding output directory if not already present $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') -$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) $(LIBSUBCMD) +$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(PERFLIBS) $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ - CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \ + CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS)' \ $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ @@ -933,7 +933,7 @@ $(LIBAPI)-clean: $(LIBBPF): FORCE | $(LIBBPF_OUTPUT) $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \ O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \ - $@ install_headers + EXTRA_CFLAGS="-fPIC" $@ install_headers $(LIBBPF)-clean: $(call QUIET_CLEAN, libbpf) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 0aeb97c11c03..3be882b2e845 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -10,21 +10,19 @@ #endif #include #include "evlist.h" -#include "callchain.h" #include "evsel.h" #include "event.h" #include "print_binary.h" #include "thread_map.h" #include "trace-event.h" #include "mmap.h" -#include "stat.h" -#include "metricgroup.h" #include "util/bpf-filter.h" #include "util/env.h" -#include "util/pmu.h" -#include "util/pmus.h" +#include "util/kvm-stat.h" +#include "util/kwork.h" +#include "util/lock-contention.h" #include -#include "util.h" +#include "../builtin.h" #if PY_MAJOR_VERSION < 3 #define _PyUnicode_FromString(arg) \ @@ -50,166 +48,6 @@ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #endif -/* - * Avoid bringing in event parsing. - */ -int parse_event(struct evlist *evlist __maybe_unused, const char *str __maybe_unused) -{ - return 0; -} - -/* - * Provide these two so that we don't have to link against callchain.c and - * start dragging hist.c, etc. - */ -struct callchain_param callchain_param; - -int parse_callchain_record(const char *arg __maybe_unused, - struct callchain_param *param __maybe_unused) -{ - return 0; -} - -/* - * Add these not to drag util/env.c - */ -struct perf_env perf_env; - -const char *perf_env__cpuid(struct perf_env *env __maybe_unused) -{ - return NULL; -} - -// This one is a bit easier, wouldn't drag too much, but leave it as a stub we need it here -const char *perf_env__arch(struct perf_env *env __maybe_unused) -{ - return NULL; -} - -/* - * These ones are needed not to drag the PMU bandwagon, jevents generated - * pmu_sys_event_tables, etc and evsel__find_pmu() is used so far just for - * doing per PMU perf_event_attr.exclude_guest handling, not really needed, so - * far, for the perf python binding known usecases, revisit if this become - * necessary. - */ -struct perf_pmu *evsel__find_pmu(const struct evsel *evsel __maybe_unused) -{ - return NULL; -} - -int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char *fmt, ...) -{ - return EOF; -} - -const char *perf_pmu__name_from_config(struct perf_pmu *pmu __maybe_unused, u64 config __maybe_unused) -{ - return NULL; -} - -struct perf_pmu *perf_pmus__find_by_type(unsigned int type __maybe_unused) -{ - return NULL; -} - -int perf_pmus__num_core_pmus(void) -{ - return 1; -} - -bool evsel__is_aux_event(const struct evsel *evsel __maybe_unused) -{ - return false; -} - -bool perf_pmus__supports_extended_type(void) -{ - return false; -} - -/* - * Add this one here not to drag util/metricgroup.c - */ -int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp, - struct rblist *new_metric_events, - struct rblist *old_metric_events) -{ - return 0; -} - -/* - * Add this one here not to drag util/trace-event-info.c - */ -char *tracepoint_id_to_name(u64 config) -{ - return NULL; -} - -/* - * XXX: All these evsel destructors need some better mechanism, like a linked - * list of destructors registered when the relevant code indeed is used instead - * of having more and more calls in perf_evsel__delete(). -- acme - * - * For now, add some more: - * - * Not to drag the BPF bandwagon... - */ -void bpf_counter__destroy(struct evsel *evsel); -int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd); -int bpf_counter__disable(struct evsel *evsel); - -void bpf_counter__destroy(struct evsel *evsel __maybe_unused) -{ -} - -int bpf_counter__install_pe(struct evsel *evsel __maybe_unused, int cpu __maybe_unused, int fd __maybe_unused) -{ - return 0; -} - -int bpf_counter__disable(struct evsel *evsel __maybe_unused) -{ - return 0; -} - -// not to drag util/bpf-filter.c -#ifdef HAVE_BPF_SKEL -int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused) -{ - return 0; -} - -int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused) -{ - return 0; -} -#endif - -/* - * Support debug printing even though util/debug.c is not linked. That means - * implementing 'verbose' and 'eprintf'. - */ -int verbose; -int debug_kmaps; -int debug_peo_args; - -int eprintf(int level, int var, const char *fmt, ...); - -int eprintf(int level, int var, const char *fmt, ...) -{ - va_list args; - int ret = 0; - - if (var >= level) { - va_start(args, fmt); - ret = vfprintf(stderr, fmt, args); - va_end(args); - } - - return ret; -} - /* Define PyVarObject_HEAD_INIT for python 2.5 */ #ifndef PyVarObject_HEAD_INIT # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, @@ -1510,15 +1348,102 @@ PyMODINIT_FUNC PyInit_perf(void) #endif } -/* - * Dummy, to avoid dragging all the test_attr infrastructure in the python - * binding. - */ -void test_attr__open(struct perf_event_attr *attr, pid_t pid, struct perf_cpu cpu, - int fd, int group_fd, unsigned long flags) + +/* 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; +} + +bool kvm_exit_event(struct evsel *evsel __maybe_unused) +{ + return false; +} + +bool exit_event_begin(struct evsel *evsel __maybe_unused, + struct perf_sample *sample __maybe_unused, + struct event_key *key __maybe_unused) +{ + return false; +} + +bool exit_event_end(struct evsel *evsel __maybe_unused, + struct perf_sample *sample __maybe_unused, + struct event_key *key __maybe_unused) +{ + return false; +} + +void exit_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, + struct event_key *key __maybe_unused, + char *decode __maybe_unused) +{ +} + +int find_scripts(char **scripts_array __maybe_unused, char **scripts_path_array __maybe_unused, + int num __maybe_unused, int pathlen __maybe_unused) +{ + return -1; +} + +void perf_stat__set_no_csv_summary(int set __maybe_unused) +{ +} + +void perf_stat__set_big_num(int set __maybe_unused) +{ +} + +int script_spec_register(const char *spec __maybe_unused, struct scripting_ops *ops __maybe_unused) +{ + return -1; +} + +arch_syscalls__strerrno_t *arch_syscalls__strerrno_function(const char *arch __maybe_unused) +{ + return NULL; +} + +struct kwork_work *perf_kwork_add_work(struct perf_kwork *kwork __maybe_unused, + struct kwork_class *class __maybe_unused, + struct kwork_work *key __maybe_unused) +{ + return NULL; +} + +void script_fetch_insn(struct perf_sample *sample __maybe_unused, + struct thread *thread __maybe_unused, + struct machine *machine __maybe_unused) +{ +} + +int perf_sample__sprintf_flags(u32 flags __maybe_unused, char *str __maybe_unused, + size_t sz __maybe_unused) +{ + return -1; +} + +bool match_callstack_filter(struct machine *machine __maybe_unused, u64 *callstack __maybe_unused) +{ + return false; +} + +struct lock_stat *lock_stat_find(u64 addr __maybe_unused) +{ + return NULL; +} + +struct lock_stat *lock_stat_findnew(u64 addr __maybe_unused, const char *name __maybe_unused, + int flags __maybe_unused) +{ + return NULL; } -void evlist__free_stats(struct evlist *evlist) +int cmd_inject(int argc __maybe_unused, const char *argv[] __maybe_unused) { + return -1; } diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 3107f5aa8c9a..142e9d447ce7 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -60,7 +60,7 @@ class install_lib(_install_lib): cflags = getenv('CFLAGS', '').split() # switch off several checks (need to be at the end of cflags list) -cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls', '-DPYTHON_PERF' ] +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter', '-Wno-redundant-decls' ] if cc_is_clang: cflags += ["-Wno-unused-command-line-argument" ] else: @@ -72,36 +72,11 @@ cflags += [ "-Wno-declaration-after-statement" ] src_perf = getenv('srctree') + '/tools/perf' build_lib = getenv('PYTHON_EXTBUILD_LIB') build_tmp = getenv('PYTHON_EXTBUILD_TMP') -libtraceevent = getenv('LIBTRACEEVENT') -libapikfs = getenv('LIBAPI') -libperf = getenv('LIBPERF') - -ext_sources = [f.strip() for f in open('util/python-ext-sources') - if len(f.strip()) > 0 and f[0] != '#'] - -extra_libraries = [] - -if '-DHAVE_LIBTRACEEVENT' in cflags: - extra_libraries += [ 'traceevent' ] -else: - ext_sources.remove('util/trace-event.c') - ext_sources.remove('util/trace-event-parse.c') - -# use full paths with source files -ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)) - -if '-DHAVE_LIBNUMA_SUPPORT' in cflags: - extra_libraries += [ 'numa' ] -if '-DHAVE_LIBCAP_SUPPORT' in cflags: - extra_libraries += [ 'cap' ] perf = Extension('perf', - sources = ext_sources, - include_dirs = ['util/include'], - libraries = extra_libraries, - extra_compile_args = cflags, - extra_objects = [ x for x in [libtraceevent, libapikfs, libperf] - if x is not None], + sources = [ src_perf + '/util/python.c' ], + include_dirs = ['util/include'], + extra_compile_args = cflags, ) setup(name='perf', -- 2.45.2.627.g7a2c4fd464-goog