|
|
A question about profile my code
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: WaterLin@ymail.com
|
|
0
|
|
|
|
Reply
|
WaterLin (12)
|
12/15/2009 12:04:15 PM |
|
On 15 d=E9c, 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
|
|
0
|
|
|
|
Reply
|
Michael
|
12/15/2009 12:24:28 PM
|
|
On Dec 15, 1:04=A0pm, 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.
|
|
0
|
|
|
|
Reply
|
Gert
|
12/15/2009 12:34:35 PM
|
|
On 2009-12-15, Water Lin <WaterLin@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.
|
|
0
|
|
|
|
Reply
|
Kaz
|
12/15/2009 3:27:46 PM
|
|
Kaz Kylheku <kkylheku@gmail.com> writes:
> On 2009-12-15, Water Lin <WaterLin@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.
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.
Thanks
Water Lin
--
Water Lin's notes and pencils: http://en.waterlin.org
Email: WaterLin@ymail.com
|
|
0
|
|
|
|
Reply
|
Water
|
12/16/2009 1:07:27 AM
|
|
|
4 Replies
347 Views
(page loaded in 0.068 seconds)
|
|
|
|
|
|
|
|
|