public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/95348] New: GCC records zero functions and modules in the profiling data file, ICC does NOT
@ 2020-05-26 20:37 qinzhao at gcc dot gnu.org
  2020-05-27  7:42 ` [Bug gcov-profile/95348] " rguenth at gcc dot gnu.org
                   ` (43 more replies)
  0 siblings, 44 replies; 45+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-05-26 20:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95348

            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. 
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 NOT. 
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: 
[]$ cat lib.h 
void five (int); 
void ten (int); 
[]$ cat lib.c 
#include <stdio.h> 

void five(int n) { 
        if (n > 5) { 
           printf("%d is greater than five\n", n);     
        } else { 
           printf("%d is not greater than five\n", n);     
        } 
} 

void ten(int n) { 
        if (n > 10) { 
           printf("%d is greater than ten\n", n);     
        } else { 
           printf("%d is not greater than ten\n", n);     
        } 
} 
[]$ cat ten.c 
#include <stdlib.h> 
#include "lib.h" 

int main(int argc, char *argv[]) { 
        if (argc != 2) { 
                return 2; 
        } 

        int n = atoi(argv[1]); 
        ten(n); 
        return 0; 
} 
[]$ cat five.c 
#include "lib.h" 

void foo(int n) { 
 if (n > 0) 
   five(n); 
 return; 
} 

******ICC :
[]$ cat build_it_icc 
#!/bin/bash 
ICC=/ICC-install-dir/bin/icc 
opt="-O0 " 
opt_gen="-prof_gen" 
opt_gen="$opt_gen -prof_dir ./icc_prof_dir" 
tf1="five.c" 
tf2="ten.c" 
libf="lib.c" 

rm *.o ten 
rm -rf icc_prof_dir 
mkdir icc_prof_dir 

echo $ICC $opt $opt_gen -c $tf1 -o five.o 
$ICC $opt $opt_gen -c $tf1 -o five.o 

echo $ICC $opt $opt_gen -c $libf -o lib.o 
$ICC $opt $opt_gen -c $libf -o lib.o 

echo $ICC $opt $opt_gen -c $tf2 -o ten.o 
$ICC $opt $opt_gen -c $tf2 -o ten.o 

echo $ICC $opt $opt_gen ten.o five.o lib.o -o ten 
$ICC $opt $opt_gen ten.o five.o lib.o -o ten 

./ten 12 
echo "Done" 

[]$ sh build_it_icc
then we got the profiling data under 
./icc_prof_dir/5ec6e83f_78751.dyn 
using 
 /ICC-install-dir/bin/profmerge -dump 5ec6e83f_78751.dyn > data 

we can see, only two functions, "main" in ten.c, and "ten" in lib.c have 
records in this profiling data file. 

******GCC: with latest upstream gcc11: 
[]$ cat build_it_gcc
#!/bin/bash 
GCC=/GCC-install-dir/bin/gcc 
opt="-O0 " 
opt="$opt -fno-inline" 
opt_gen="-fprofile-generate" 
opt_gen="$opt_gen -fprofile-dir=gcc_prof_dir/%p" 
tf1="five.c" 
tf2="ten.c" 
libf="lib.c" 

rm -rf gcc_prof_dir 

echo $GCC $opt $opt_gen -c $libf 
$GCC $opt $opt_gen -c $libf -o lib.o 

echo $GCC $opt $opt_gen $tf1 
$GCC $opt $opt_gen -c $tf1 -o five.o 

echo $GCC $opt $opt_gen $tf2 
$GCC $opt $opt_gen -c $tf2 -o ten.o 
echo $GCC $opt $opt_gen ten.o five.o lib.o -o ten 
$GCC $opt $opt_gen ten.o five.o lib.o -o ten 

./ten 12 
echo "Done" 

[]$ build_it_gcc
then the profiling data are under 
./gcc_prof_dir/16856

under ~/Bugs/profile/small_gcc/gcc_prof_dir/16856 
[]$ ls -l 
total 12 
-rw-r--r-- 1 qinzhao qinzhao 100 May 26 19:18 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda 
-rw-r--r-- 1 qinzhao qinzhao 184 May 26 19:18 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda 
-rw-r--r-- 1 qinzhao qinzhao 100 May 26 19:18 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda 

[]$ /home/qinzhao/Install/latest/bin/gcov-dump *.gcda 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:data:magic `gcda':version 
`B10e' 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:stamp 1375590637 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:  a1000000:   2:OBJECT_SUMMARY 
runs=1, sum_max=1 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:  01000000:   3:FUNCTION 
ident=1636255671, lineno_checksum=0x13fda123, cfg_checksum=0xc7b3f828 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:    01a10000:   6:COUNTERS 
arcs 3 counts 
#home#qinzhao#Bugs#profile#small_gcc#five.gcda:    01af0000:   2:COUNTERS 
time_profiler 1 counts 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:data:magic `gcda':version 
`B10e' 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:stamp 1375590591 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:  a1000000:   2:OBJECT_SUMMARY 
runs=1, sum_max=1 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:  01000000:   3:FUNCTION 
ident=1977925159, lineno_checksum=0x5bf41dc5, cfg_checksum=0xf9e50e8f 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:    01a10000:   8:COUNTERS arcs 
4 counts 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:    01af0000:   2:COUNTERS 
time_profiler 1 counts 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:  01000000:   3:FUNCTION 
ident=193180204, lineno_checksum=0x020d7b16, cfg_checksum=0xf9e50e8f 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:    01a10000:   8:COUNTERS arcs 
4 counts 
#home#qinzhao#Bugs#profile#small_gcc#lib.gcda:    01af0000:   2:COUNTERS 
time_profiler 1 counts 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:data:magic `gcda':version 
`B10e' 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:stamp 1375590675 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:  a1000000:   2:OBJECT_SUMMARY 
runs=1, sum_max=1 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:  01000000:   3:FUNCTION 
ident=108032747, lineno_checksum=0x2fbc5f5a, cfg_checksum=0x5018cc66 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:    01a10000:   6:COUNTERS arcs 
3 counts 
#home#qinzhao#Bugs#profile#small_gcc#ten.gcda:    01af0000:   2:COUNTERS 
time_profiler 1 counts 

from the above, there are records for all functions and modules that are 
instrumented, for example, the routine "five" in lib.c, and the whole module 
"five.c".  all the records for these are zero.

Is it possible for GCC to only record functions and modules that have non-zero
counts?

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2021-07-28  7:04 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 20:37 [Bug gcov-profile/95348] New: GCC records zero functions and modules in the profiling data file, ICC does NOT qinzhao at gcc dot gnu.org
2020-05-27  7:42 ` [Bug gcov-profile/95348] " rguenth at gcc dot gnu.org
2020-05-27  9:31 ` marxin at gcc dot gnu.org
2020-05-27 14:13 ` qinzhao at gcc dot gnu.org
2020-05-27 14:22 ` marxin at gcc dot gnu.org
2020-05-27 20:36 ` qinzhao at gcc dot gnu.org
2020-05-28 14:08 ` marxin at gcc dot gnu.org
2020-05-29  9:11 ` marxin at gcc dot gnu.org
2020-05-29 15:28 ` qinzhao at gcc dot gnu.org
2020-05-29 15:31 ` qinzhao at gcc dot gnu.org
2020-05-29 15:38 ` marxin at gcc dot gnu.org
2020-05-29 15:40 ` marxin at gcc dot gnu.org
2020-05-29 15:43 ` marxin at gcc dot gnu.org
2020-05-29 16:37 ` qing.zhao at oracle dot com
2020-05-29 16:40 ` qing.zhao at oracle dot com
2020-05-29 16:42 ` qinzhao at gcc dot gnu.org
2020-05-30  7:23 ` marxin at gcc dot gnu.org
2020-06-01 15:24 ` qinzhao at gcc dot gnu.org
2020-06-01 15:39 ` qinzhao at gcc dot gnu.org
2020-06-01 15:45 ` qing.zhao at oracle dot com
2020-06-01 15:45 ` qing.zhao at oracle dot com
2020-06-02  8:23 ` marxin at gcc dot gnu.org
2020-06-02 17:42 ` qinzhao at gcc dot gnu.org
2020-06-03  6:35 ` marxin at gcc dot gnu.org
2020-06-03 15:17 ` qing.zhao at oracle dot com
2020-06-10  8:16 ` marxin at gcc dot gnu.org
2020-06-10  8:21 ` marxin at gcc dot gnu.org
2020-06-10 14:49 ` qing.zhao at oracle dot com
2020-06-10 19:43 ` marxin at gcc dot gnu.org
2020-06-10 20:17 ` qing.zhao at oracle dot com
2020-06-10 20:26 ` qing.zhao at oracle dot com
2020-06-11  9:14 ` marxin at gcc dot gnu.org
2020-06-11 14:12 ` qing.zhao at oracle dot com
2020-06-11 18:08 ` marxin at gcc dot gnu.org
2020-06-15 19:54 ` qinzhao at gcc dot gnu.org
2020-06-15 19:56 ` qinzhao at gcc dot gnu.org
2020-06-16 12:53 ` marxin at gcc dot gnu.org
2020-06-16 15:58 ` qinzhao at gcc dot gnu.org
2020-06-17  6:35 ` marxin at gcc dot gnu.org
2020-06-24  9:06 ` marxin at gcc dot gnu.org
2020-07-02  8:16 ` cvs-commit at gcc dot gnu.org
2020-07-02  8:24 ` marxin at gcc dot gnu.org
2020-07-02  8:24 ` marxin at gcc dot gnu.org
2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-07-28  7:04 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).