Up: gprof, FreeSoft

gprof sample - Line execution counts

gprof's annotated source listing duplicates the source code of the program, labelling each line of code with the number of times it was executed. In this example, we see a function that was called twice, using each branch of an if/else statement once, and including a loop that ran 26,312 times.

                ulg updcrc(s, n)
                    uch *s;
                    unsigned n;
            2 ->{
                    register ulg c;
                
                    static ulg crc = (ulg)0xffffffffL;
                
            2 ->    if (s == NULL) {
            1 ->	c = 0xffffffffL;
            1 ->    } else {
            1 ->	c = crc;
            1 ->        if (n) do {
        26312 ->            c = crc_32_tab[...];
26312,1,26311 ->        } while (--n);
                    }
            2 ->    crc = c;
            2 ->    return c ^ 0xffffffffL;
            2 ->}