Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966315AbcKOELH (ORCPT ); Mon, 14 Nov 2016 23:11:07 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:25538 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965961AbcKOEIZ (ORCPT ); Mon, 14 Nov 2016 23:08:25 -0500 From: Wang Nan To: , CC: , , , , Wang Nan , Jiri Olsa Subject: [PATCH 34/34] perf clang git: Export getpid() to perf hook Date: Tue, 15 Nov 2016 04:06:17 +0000 Message-ID: <20161115040617.69788-35-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161115040617.69788-1-wangnan0@huawei.com> References: <20161115040617.69788-1-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1677 Lines: 41 After this patch perf hooks can retrive pid of perf itself by calling getpid. It is important for excluding event from perf. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3orama@163.com --- tools/perf/util/c++/bpf-helper-str.c | 1 + tools/perf/util/c++/clang.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/perf/util/c++/bpf-helper-str.c b/tools/perf/util/c++/bpf-helper-str.c index 69aca3c..eedee89 100644 --- a/tools/perf/util/c++/bpf-helper-str.c +++ b/tools/perf/util/c++/bpf-helper-str.c @@ -13,6 +13,7 @@ const char clang_builtin_bpf_helper_str[] = "extern void test__clang_callback(int);\n" "extern int printf(const char *, ...);\n" "extern int puts(const char *);\n" +"extern int getpid(void);\n" "extern int jit_helper__map_update_elem(void *, void *, void *, void *, unsigned long);\n" "extern int jit_helper__map_lookup_elem(void *, void *, void *, void *);\n" "extern int jit_helper__map_get_next_key(void *, void *, void *, void *);\n" diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index db31fb2..d6af336 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp @@ -236,6 +236,7 @@ static std::map exported_funcs = EXPORT(test__clang_callback), EXPORT(printf), EXPORT(puts), + EXPORT(getpid), EXPORT(JIT_HELPER_FUNC_NAME(map_update_elem)), EXPORT(JIT_HELPER_FUNC_NAME(map_lookup_elem)), EXPORT(JIT_HELPER_FUNC_NAME(map_get_next_key)), -- 2.10.1