help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gprof - wrong time results


From: Paul Pluzhnikov
Subject: Re: gprof - wrong time results
Date: Tue, 05 Apr 2005 07:30:22 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Jan Schäfer <schaefer@neuro.informatik.uni-ulm.de> writes:

> any ideas why this does happen?

The most likely cause is that your program spends 95% of its time
in libc, and you did not link with a profiling version of libc
(you'll need glibc-prof package installed).

To understand this better, compile/run the test below, examine
gprof output, then relink it with /usr/lib/libc_p.a and repeat.

Cheers,

--- cut ---
#include <string.h>
#include <stdlib.h>

void foo(int count)
{
    int i;
    char buf[10240];
    for (i = 0; i < count; ++i)
        memset(buf, 0, sizeof(buf));
}

int main(int argc, char *argv[])
{
    int i, count = 1000000;
    if (argc > 1) count = atoi(argv[1]);
    foo(count);
    return 0;
}
--- cut ---

-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]