Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761817AbcLBPpH (ORCPT ); Fri, 2 Dec 2016 10:45:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40306 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761787AbcLBPpF (ORCPT ); Fri, 2 Dec 2016 10:45:05 -0500 Date: Fri, 2 Dec 2016 13:44:40 -0200 From: Arnaldo Carvalho de Melo To: Wang Nan Cc: ast@fb.com, lizefan@huawei.com, hekuang@huawei.com, Ingo Molnar , linux-kernel@vger.kernel.org, pi3orama@163.com, joe@ovn.org, Jiri Olsa , acme@kernel.org Subject: Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case Message-ID: <20161202154440.GB5931@redhat.com> References: <20161126070354.141764-1-wangnan0@huawei.com> <20161126070354.141764-11-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161126070354.141764-11-wangnan0@huawei.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 02 Dec 2016 15:44:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4489 Lines: 104 Em Sat, Nov 26, 2016 at 07:03:34AM +0000, Wang Nan escreveu: > Add basic clang support in clang.cpp and test__clang() testcase. The > first testcase checks if builtin clang is able to generate LLVM IR. > > tests/clang.c is a proxy. Real testcase resides in > utils/c++/clang-test.cpp in c++ and exports C interface to perf test > subsystem. > > Test result: > > $ perf test -v clang > 51: Test builtin clang support : > 51.1: Test builtin clang compile C source to IR : > --- start --- > test child forked, pid 13215 > test child finished with 0 > ---- end ---- > Test builtin clang support subtest 0: Ok While testing this I noticed that the perf binary got huge, can't this be done in some other way, i.e. using dynamic library? [root@jouet ~]# size /tmp/perf text data bss dec hex filename 75333688 1421584 23962176 100717448 600d388 /tmp/perf [root@jouet ~]# I've built it with this: make LIBCLANGLLVM=1 O=/tmp/build/perf -C tools/perf install-bin the resulting binary: [acme@jouet linux]$ [acme@jouet linux]$ ls -la ~/bin/perf -rwxr-xr-x. 2 acme acme 131689136 Dec 2 12:31 /home/acme/bin/perf [acme@jouet linux]$ ls -lah ~/bin/perf -rwxr-xr-x. 2 acme acme 126M Dec 2 12:31 /home/acme/bin/perf [acme@jouet linux]$ Huge, after stripping it: [acme@jouet linux]$ ls -la /tmp/perf -rwxr-xr-x. 1 root root 76759056 Dec 2 12:33 /tmp/perf [acme@jouet linux]$ ls -lah /tmp/perf -rwxr-xr-x. 1 root root 74M Dec 2 12:33 /tmp/perf [acme@jouet linux]$ Still huge :-\ Ok, this needs explicitely enabling, but then, for distros, if we want this feature to be enabled... I think we should try to help distributions to ship a basic perf binary in a base package that doesn't brings many libraries, like was done for the gtk UI, and also we should start providing RPM specfiles and debian (and others, hopefully contributed by other people with interest in other distros), to help in getting a sane package split, i.e. want llvm/bpf? install the 'perf-ebpf' rpm/deb/whatever package and incur in these costs. But being a n00b on llvm/clang libraries, etc, my question goes back to: can we have this using a libllvm.so or libclang.so dynamic libraries? See this, out of hand :-\ Tell me I'm doing something wrong :-) [acme@jouet linux]$ cat /etc/fedora-release Fedora release 25 (Twenty Five) [acme@jouet linux]$ rpm -qa | egrep llvm\|clang llvm-libs-3.8.0-1.fc25.x86_64 [acme@jouet linux]$ [acme@jouet linux]$ nm ~/bin/perf | grep -i clang | wc -l 204757 [acme@jouet linux]$ nm ~/bin/perf | grep -i llvm | wc -l 234036 [acme@jouet linux]$ nm ~/bin/perf | grep -i clang | tail 00000000011741ba t _ZZZN5clang7CodeGen15CodeGenFunction20EmitOMPTaskDirectiveERKNS_16OMPTaskDirectiveEENKUlRS1_E_clES5_ENKUlvE_clEv 0000000001169fee t _ZZZN5clang7CodeGen15CodeGenFunction25EmitOMPFirstprivateClauseERKNS_22OMPExecutableDirectiveERNS1_15OMPPrivateScopeEENKUlvE_clEvENKUlNS0_7AddressES8_E_clES8_S8_ 00000000038b83e0 r _ZZZN5clang9ASTReader24FindExternalLexicalDeclsEPKNS_11DeclContextEN4llvm12function_refIFbNS_4Decl4KindEEEERNS4_15SmallVectorImplIPS6_EEENKUlPNS_13serialization10ModuleFileENS4_8ArrayRefINS4_7support6detail31packed_endian_specific_integralIjLNSI_10endiannessE2ELm1EEEEEE_clESG_SN_E19__PRETTY_FUNCTION__ 0000000003934140 r _ZZZN5clang9ASTWriter12WriteASTCoreERNS_4SemaEN4llvm9StringRefERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_6ModuleEENKUljbE0_clEjbE19__PRETTY_FUNCTION__ 00000000039319e0 r _ZZZN5clang9ASTWriter12WriteASTCoreERNS_4SemaEN4llvm9StringRefERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_6ModuleEENKUlPNS_4DeclENS_13serialization17PredefinedDeclIDsEE_clESG_SI_E19__PRETTY_FUNCTION__ 000000000393b700 r _ZZZN5clang9ASTWriter17GetOrCreateTypeIDENS_8QualTypeEENKUlS1_E_clES1_E19__PRETTY_FUNCTION__ 000000000393b880 r _ZZZNK5clang9ASTWriter9getTypeIDENS_8QualTypeEENKUlS1_E_clES1_E19__PRETTY_FUNCTION__ 0000000002176480 t _ZZZZN12_GLOBAL__N_19ASTDumper11dumpLookupsEPKN5clang11DeclContextEbENKUlvE_clEvENKUlvE_clEvENKUlvE_clEv 000000000144ef0a t _ZZZZN5clang7CodeGen15CGOpenMPRuntime13emitReductionERNS0_15CodeGenFunctionENS_14SourceLocationEN4llvm8ArrayRefIPKNS_4ExprEEESA_SA_SA_bbENKUlS3_S9_S9_S9_E1_clES3_S9_S9_S9_ENKUlNS0_6RValueEE_clESC_ENKUlvE_clEv 000000000217640c t _ZZZZZN12_GLOBAL__N_19ASTDumper11dumpLookupsEPKN5clang11DeclContextEbENKUlvE_clEvENKUlvE_clEvENKUlvE_clEvENKUlPNS1_4DeclEE_clES9_ [acme@jouet linux]$ Thanks, - Arnaldo