From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9FE523851C0C; Tue, 26 May 2020 20:37:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FE523851C0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590525474; bh=/O8mtV0zmoxZqyDqOJESbiQ2KL2CONdGPH/bOU1fi6s=; h=From:To:Subject:Date:From; b=TbInjOESMnzZjxKUMVy9Ai+NUcfOoytRXgP+WNOwgBGmg21693BktcuJEmGvL++Ei BhNp7GRvOvEsKxN36IKFK9np8olFPPe5/AZc+oQQLv3H67gfj6CvxMnseLK/UVUHSb xUV+Vgyd588hg2k2spGb1bpQADd5FYB1dLxszYFo= From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/95348] New: GCC records zero functions and modules in the profiling data file, ICC does NOT Date: Tue, 26 May 2020 20:37:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: qinzhao at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2020 20:37:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95348 Bug ID: 95348 Summary: GCC records zero functions and modules in the profiling data file, ICC does NOT Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- when using GCC and ICC to build a big parallel application with profiling feedback, the size of the profiling feedback data of GCC is over 20x times larger than that of ICC.=20 As we studied, one of the major reason for this size difference is: GCC records all functions and modules that execute 0 times, but ICC does NO= T.=20 since I cannot expose the details of the real application that has the profiling data size issue. I come up with a small testing case to show this problem. ******testing case:=20 []$ cat lib.h=20 void five (int);=20 void ten (int);=20 []$ cat lib.c=20 #include =20 void five(int n) {=20 if (n > 5) {=20 printf("%d is greater than five\n", n);=20=20=20=20=20 } else {=20 printf("%d is not greater than five\n", n);=20=20=20=20=20 }=20 }=20 void ten(int n) {=20 if (n > 10) {=20 printf("%d is greater than ten\n", n);=20=20=20=20=20 } else {=20 printf("%d is not greater than ten\n", n);=20=20=20=20=20 }=20 }=20 []$ cat ten.c=20 #include =20 #include "lib.h"=20 int main(int argc, char *argv[]) {=20 if (argc !=3D 2) {=20 return 2;=20 }=20 int n =3D atoi(argv[1]);=20 ten(n);=20 return 0;=20 }=20 []$ cat five.c=20 #include "lib.h"=20 void foo(int n) {=20 if (n > 0)=20 five(n);=20 return;=20 }=20 ******ICC : []$ cat build_it_icc=20 #!/bin/bash=20 ICC=3D/ICC-install-dir/bin/icc=20 opt=3D"-O0 "=20 opt_gen=3D"-prof_gen"=20 opt_gen=3D"$opt_gen -prof_dir ./icc_prof_dir"=20 tf1=3D"five.c"=20 tf2=3D"ten.c"=20 libf=3D"lib.c"=20 rm *.o ten=20 rm -rf icc_prof_dir=20 mkdir icc_prof_dir=20 echo $ICC $opt $opt_gen -c $tf1 -o five.o=20 $ICC $opt $opt_gen -c $tf1 -o five.o=20 echo $ICC $opt $opt_gen -c $libf -o lib.o=20 $ICC $opt $opt_gen -c $libf -o lib.o=20 echo $ICC $opt $opt_gen -c $tf2 -o ten.o=20 $ICC $opt $opt_gen -c $tf2 -o ten.o=20 echo $ICC $opt $opt_gen ten.o five.o lib.o -o ten=20 $ICC $opt $opt_gen ten.o five.o lib.o -o ten=20 ./ten 12=20 echo "Done"=20 []$ sh build_it_icc then we got the profiling data under=20 ./icc_prof_dir/5ec6e83f_78751.dyn=20 using=20 /ICC-install-dir/bin/profmerge -dump 5ec6e83f_78751.dyn > data=20 we can see, only two functions, "main" in ten.c, and "ten" in lib.c have=20 records in this profiling data file.=20 ******GCC: with latest upstream gcc11:=20 []$ cat build_it_gcc #!/bin/bash=20 GCC=3D/GCC-install-dir/bin/gcc=20 opt=3D"-O0 "=20 opt=3D"$opt -fno-inline"=20 opt_gen=3D"-fprofile-generate"=20 opt_gen=3D"$opt_gen -fprofile-dir=3Dgcc_prof_dir/%p"=20 tf1=3D"five.c"=20 tf2=3D"ten.c"=20 libf=3D"lib.c"=20 rm -rf gcc_prof_dir=20 echo $GCC $opt $opt_gen -c $libf=20 $GCC $opt $opt_gen -c $libf -o lib.o=20 echo $GCC $opt $opt_gen $tf1=20 $GCC $opt $opt_gen -c $tf1 -o five.o=20 echo $GCC $opt $opt_gen $tf2=20 $GCC $opt $opt_gen -c $tf2 -o ten.o=20 echo $GCC $opt $opt_gen ten.o five.o lib.o -o ten=20 $GCC $opt $opt_gen ten.o five.o lib.o -o ten=20 ./ten 12=20 echo "Done"=20 []$ build_it_gcc then the profiling data are under=20 ./gcc_prof_dir/16856 under ~/Bugs/profile/small_gcc/gcc_prof_dir/16856=20 []$ ls -l=20 total 12=20 -rw-r--r-- 1 qinzhao qinzhao 100 May 26 19:18=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda=20 -rw-r--r-- 1 qinzhao qinzhao 184 May 26 19:18=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda=20 -rw-r--r-- 1 qinzhao qinzhao 100 May 26 19:18=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda=20 []$ /home/qinzhao/Install/latest/bin/gcov-dump *.gcda=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda:data:magic `gcda':version=20 `B10e'=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda:stamp 1375590637=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda: a1000000: 2:OBJECT_SUMMA= RY=20 runs=3D1, sum_max=3D1=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda: 01000000: 3:FUNCTION=20 ident=3D1636255671, lineno_checksum=3D0x13fda123, cfg_checksum=3D0xc7b3f828= =20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda: 01a10000: 6:COUNTERS=20 arcs 3 counts=20 #home#qinzhao#Bugs#profile#small_gcc#five.gcda: 01af0000: 2:COUNTERS=20 time_profiler 1 counts=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda:data:magic `gcda':version=20 `B10e'=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda:stamp 1375590591=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: a1000000: 2:OBJECT_SUMMAR= Y=20 runs=3D1, sum_max=3D1=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01000000: 3:FUNCTION=20 ident=3D1977925159, lineno_checksum=3D0x5bf41dc5, cfg_checksum=3D0xf9e50e8f= =20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01a10000: 8:COUNTERS ar= cs=20 4 counts=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01af0000: 2:COUNTERS=20 time_profiler 1 counts=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01000000: 3:FUNCTION=20 ident=3D193180204, lineno_checksum=3D0x020d7b16, cfg_checksum=3D0xf9e50e8f= =20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01a10000: 8:COUNTERS ar= cs=20 4 counts=20 #home#qinzhao#Bugs#profile#small_gcc#lib.gcda: 01af0000: 2:COUNTERS=20 time_profiler 1 counts=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda:data:magic `gcda':version=20 `B10e'=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda:stamp 1375590675=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda: a1000000: 2:OBJECT_SUMMAR= Y=20 runs=3D1, sum_max=3D1=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda: 01000000: 3:FUNCTION=20 ident=3D108032747, lineno_checksum=3D0x2fbc5f5a, cfg_checksum=3D0x5018cc66= =20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda: 01a10000: 6:COUNTERS ar= cs=20 3 counts=20 #home#qinzhao#Bugs#profile#small_gcc#ten.gcda: 01af0000: 2:COUNTERS=20 time_profiler 1 counts=20 from the above, there are records for all functions and modules that are=20 instrumented, for example, the routine "five" in lib.c, and the whole modul= e=20 "five.c". all the records for these are zero. Is it possible for GCC to only record functions and modules that have non-z= ero counts?=