I build GCC from git repo regularly. Unfortunately my system is old and a
full GCC build takes about 30 hours. I learnt that the maximum build time
spent is in LTO. I wrote a simple shell script to check LTO progress:

#!/bin/sh

AWKP='
BEGIN { RS=" " ; w = COLS - 19 }
END { progressbar(current, total) }

/ltrans.o/ { current++ }
/ltrans[0-9]+.o/ { total++ }

function progressbar(current, total) {
    if (total == 0) {
        printf(" %s Waiting!\r", substr("|/-\\", 1 + systime() % 4, 1))
        return
    }
    progress = current / total
    prefix = sprintf(" %d/%d [", current, total)
    suffix = sprintf("] %.1f%%", 100 * progress)
    width = COLS - length(prefix) - length(suffix)
    bar = ""
    for (col = 0; col < width; col++)
        bar = bar (col / width < progress ? "=" : " ")
    printf("%s%s%s\r", prefix, bar, suffix)
}'

while [ 1 ] ; do
    echo $(ls /tmp/*ltrans* 2> /dev/null) | gawk -v COLS=`tput cols`
 "$AWKP"
    sleep 1
done

Is there any change to have some LTO progress indicator information in
upstream GCC output? Do I need to report a bug?

I need LTO. Is there a way to have LTO in GCC, without LTOing the GCC
itself? This way my builds will be many times faster.

Regards and thanks to your awesome compilers

-- 
*Ghorban M. Tavakoly*
Phone number: +98 (902) (2²⁰+2¹⁹+2¹⁸+…+2²+2¹+2⁰)

Reply via email to