Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A question about profile my code

0 views
Skip to first unread message

Water Lin

unread,
Dec 15, 2009, 7:04:15 AM12/15/09
to

I want to profile my C++ code, so I tried to use gprof.

But I think gprof is too old for today's application. My code run just
for 0.00X ms but gprof just count 0.0X ms accuracy.

So gprof can't count the time spent on my little code.

Is there any way to adjust the accuracy and let gprof to count more
accuracy such as 0.0001 ms.

Or any other profile tools for C++ code?

Thanks

Water Lin

--
Water Lin's notes and pencils: http://en.waterlin.org
Email: Wate...@ymail.com

Michael Doubez

unread,
Dec 15, 2009, 7:24:28 AM12/15/09
to
On 15 déc, 13:04, Water Lin <Water...@ymail.invalid> wrote:
> I want to profile my C++ code, so I tried to use gprof.
[snip]

You are off-topic.

> Or any other profile tools for C++ code?

Valgrind/Callgrind

--
Michael

Gert-Jan de Vos

unread,
Dec 15, 2009, 7:34:35 AM12/15/09
to
On Dec 15, 1:04 pm, Water Lin <Water...@ymail.invalid> wrote:
> I want to profile my C++ code, so I tried to use gprof.
>
> But I think gprof is too old for today's application. My code run just
> for 0.00X ms but gprof just count 0.0X ms accuracy.
>
> So gprof can't count the time spent on my little code.

Just wrap your code in a 100x loop.

Kaz Kylheku

unread,
Dec 15, 2009, 10:27:46 AM12/15/09
to
On 2009-12-15, Water Lin <Wate...@ymail.invalid> wrote:
>
> I want to profile my C++ code, so I tried to use gprof.
>
> But I think gprof is too old for today's application. My code run just
> for 0.00X ms but gprof just count 0.0X ms accuracy.

gprof is a tool for finding where a program is spending a lot of time,
so that you know where your energy should be spent in optimizing
the program.

If your program runs in a fraction of a second, it probably doesn't need
optimizing.

> So gprof can't count the time spent on my little code.

Of course gprof can do that if you just put the little code
into a loop which repeats millions of times.

Water Lin

unread,
Dec 15, 2009, 8:07:27 PM12/15/09
to
Kaz Kylheku <kkyl...@gmail.com> writes:

OK. I think I fully understand gprof's ability now.

My code is not fast enough because it will invoke many times in my
program. So I will try to run it many times to test it.

0 new messages