Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp475766lqs; Thu, 13 Jun 2024 16:34:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0KRjw3PpXVHTCYf9e3xjtcv8zhCOvqPrU4gAH1cEiQyE401p1XABkmgCGH5aVrPn2PnEod0/aoUwwUAY2LrXAcp2IL3FRX2WYhwvIkw== X-Google-Smtp-Source: AGHT+IHCdvnLNSlySR341v9yoN5c3nHkWel6tST9vzOux6uUYgQ3uGxswTuOSO4C6MN5QkX1zPcl X-Received: by 2002:a05:6a20:3949:b0:1b4:772d:288a with SMTP id adf61e73a8af0-1bae7eb284dmr1599654637.23.1718321675240; Thu, 13 Jun 2024 16:34:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718321675; cv=pass; d=google.com; s=arc-20160816; b=JG7qhWGfIULZH42FpRM5dXOBcxhmt9qZErkcXK3rL3A3AkEu8531B0jbNbLaMWImwO hVglKfEXIkcHC4OHpvJAJ/BJyxlu5v29wDm+UH7ORlV1qWRu06S8IsRKOupeIliPTAzq mcdlcbqp2wSZPtmtwQAQhFtHHoM6rNqxyl9AQnjCVQ1JMXpzeCBNbtB3lCwZxWWC1VDu D1gRobFleS/TQqEro3fYYCb5WWs8nIlI+r/OwVKdkUCf7MmU91WRkf8CX5lmtxPyyvqX jQar6yC6kmCsVjIk00hVYAyFpFX34z/DPikTTs+IITSa3mYbQl7FcOwfDjaD+i4IIdTy P7XQ== 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=319rFXJJxXGumXlKA01sQh0rJcji8PzeM5gat0YaUVc=; b=htHaaz2DANzmeFnGgGzy8Evt28z6ClMKBtLvc8rfCLkPf7uDZDiqIpvWWHWeet8qWD Y5+NMCWZgFi1X/0vYxmyZ4BaNtKtcONxKocvulPlGT3roXB/aSRav9JHA29rndPvDvof niItm7vbjuckdE0XvqDAlGSzNLR7Ow+tnA1pDn6HpkOhpWrYbbFQoOOZYiHTIuhMZlro vguoTV72ycG+Y3CfClinoux2m1c0iSLfulU4+fQw764N+f+i6WV0UjYy8hEzP0nTYNyK qD5lfh9gDuipqyHpFHupjA83fCPah3OAXbuLQpeAv/t5c9vhgVuyrI2Sw1ll3niUl8ya hsKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ckzpfkWI; 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-214105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214105-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee310ce4fsi2210552a12.336.2024.06.13.16.34.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 16:34:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ckzpfkWI; 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-214105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214105-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D5AC0285BA1 for ; Thu, 13 Jun 2024 23:34:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 525461586F7; Thu, 13 Jun 2024 23:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ckzpfkWI" 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 9C0BD158213 for ; Thu, 13 Jun 2024 23:31:56 +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=1718321518; cv=none; b=q4oOmQnnUxGBOOiVRcy1NOnfM/7qY0m0SA0ivZ8Fhdi6ANMIb0ioKtfZxMvHr46vWuKJ5oEH8SS5tmeSYYtVSXgKwO6mWcHT4EBCza6dvQd9sEMNqVChbhIvRUmIEl+TC8ASgarVZEWORPGD7h1+hQlCIivmSFSoJXMdX9wPriE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718321518; c=relaxed/simple; bh=jdDVD2dv1/rqbFd/3QUGMKf/GFRV78NDaLF0Z52AGZQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=OClHklH73sHqizIEpH3MfKQ5PQKpuVvRq3W/5xFQYxpj5EdZ/Z4Ze7G4TjCVvAhCzhYAMlb2B6otH0jNR4D7CNOgeuUQs0RrwvSWFxVXaZ00epVg4Zad67GxI2ztmAjya1cWhSXV+5GS9oURntmF016u06kKaHJlxop/PyWnAwE= 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=ckzpfkWI; 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-632591a256bso2766707b3.1 for ; Thu, 13 Jun 2024 16:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718321515; x=1718926315; 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=ckzpfkWIygC7VUDfqRy09zLyNvT4ne994HXsn+8JY5puHHPv6MR2wKIShwnzVvw3B1 thFHiGZVAjlUPIPEduWPGZpzeolhVhWzvF7qfRBxDAXFzqhPVtnJSzBbQIG799ghmAPS tMooMCfzStcGSTzAsqdZR2dwqZ0Xzrb62CrYPESEkepOpH2tywNH4cdZnSZbornQF4HD 8BVXv0SAOh72JlSqdXWTUxrQKK7PRwWMLu1ry3/5+AhODdJlX8wOnIBl8hPNXawMq2lR gdieRwTuk0s2sk4KyOGut4rlxe5Wy8B07UcaIMctCZ0JUycW7xxKjrKHgznT+ws7M/pi 5QCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718321515; x=1718926315; 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=RBuyI3lg1LVs8nnGMrift98WanikIcypL0PalhAglArKMMxltpz+paiBgCXtv6+O6i stxcR487RjEssVe6SyVY5pmr674XA9Q0vmmKvJe64QqboEAJTmSg+GXYplYDFo0u7fe6 LIE7spJjQKlVkc1LzgGpgdmPawXruGgEBdkdV9uckcGhqcttsm6oVU+MZKsqHrwjwzMD 33RikwoMerzHHTd1dHNvxn64MEwZDgzjhQ3z/J5VCsy7MpwOuhdE3fO7rDmfWp8YAL/X 5HuoBibMKCM/PHD+sLhf9oHT9t0TwTIwdkaRNQJXNHCBzje5MqcqIx3iMAyhrVU7+KHB c1gg== X-Forwarded-Encrypted: i=1; AJvYcCXKIXctlgfvNI0LdZ4jy/N3wXEcGwN56skZRogi/xC/fEtcVC45QguTB/bmTIiR3osLPntHIwlERFgiDwWyhT/Y0yOugPmz+pXSyNSc X-Gm-Message-State: AOJu0YyQtrO6z60fQXiWINCvK2TeNApVTp2E/8mtJT8b0cVx5zvnfszt KFhV7tOGBaeWxpS6tHc8k0UdnUaDp8MQnDRWzmPtZKTVReGlTsl5tp0C7THoe4eirqkyvz3Hsit qe4/yDQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:96dd:26a6:1493:53c8]) (user=irogers job=sendgmr) by 2002:a05:6902:1104:b0:dfa:6ea5:c8d5 with SMTP id 3f1490d57ef6-dff1543a47dmr220005276.10.1718321515414; Thu, 13 Jun 2024 16:31:55 -0700 (PDT) Date: Thu, 13 Jun 2024 16:31:21 -0700 In-Reply-To: <20240613233122.3564730-1-irogers@google.com> Message-Id: <20240613233122.3564730-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: <20240613233122.3564730-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Subject: [PATCH v3 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