View Full Version : Program to time your app?
Mongrel
01-24-2004, 07:47 AM
Does anyone know of a good (freeware pref.) program to find out in which functions your app spends the most time?
Edit: Forgot to mention that I need one for Win2k
Tertiary
01-24-2004, 08:18 AM
Well, if you are prepared to use Dev-C++, you can use gprof which comes with it. I have never used gprof before, but seeing your post I just recompiled world.exe with Dev-C++ with profiling enabled ( -pg option to compiler and linker). Here is the sort of output it gives you:
http://www.rama.demon.co.uk/worldprof.txt
Trumpcard
01-24-2004, 09:25 AM
gprof is also in gcc if you use linux, it along with kprof (a KDE visual front end) , and valgrind, kcachegrind, and leaktracer have been some of my favorite tools recently.
Under MS compilers, I really dont know much other than the commerical ones. Numega tools are AWESOME..
Mongrel
01-27-2004, 07:01 AM
Finally got my app working under dev-cpp, but the profiling doesn't seem to work.
First I tried it manually by adding a -pg to the c++ compiler options like the manual says. But then the linker yelled at me that it can't find "mcount" (unresolved external). A quick search revealed that both "libgmon.a" and "libuser32.a" contain a "mcount".
libuser doesn't work though, but after linking to libgmon the game compiles fine.
Only problem is: There's no output! :(
The menu entry "profile analysis" does ... well ... something, but after running there's no .txt either.
What am I doing wrong?
Tertiary
01-27-2004, 07:18 AM
You need to put -pg in the linker parameters as well, i.e. Under project/project options/parameters, specify -pg in both the C++ compiler and the linker boxes. I just tested and omitting it from the linker options does give you the unresolved references to mcount.
Eglin
01-27-2004, 04:33 PM
Numega tools are AWESOME..Absolutely positively undoubtedly so. Matty P. is fully worthy of idolization.
Mongrel
01-27-2004, 08:21 PM
You need to put -pg in the linker parameters as well
Ok, gonna try that tonight after work. Thanks.
Trumpcard wrote:
Numega tools are AWESOME..
Absolutely positively undoubtedly so. Matty P. is fully worthy of idolization.
I wanted to try them out, but all that blah blah with the phone calls,etc... just to get a trial was too much for me. I realize that they want to protect their work, but for me that's too much of an annoyance.
So I'll stick to gprof for now :)
BLOOD_kane
01-28-2004, 02:17 AM
WinXP has a feature that shows which program you use the most...mine says:
EverQuest
Photoshop
Ad-Aware
Dreamweaver MX
Flash MX
(for some odd reason) Notepad
Microsoft Word
now are you talking about which programs you use the longest or what?
Mongrel
01-28-2004, 03:24 AM
Nah, a program that tells me which parts of my own programs consume the most time.
Trumpcard
01-28-2004, 04:11 AM
Its a performance profiler for code...
Have 3 functions, A , B and C.
It will tell you when the program executes it spent 5% of its time executing A, 90% B, and 5% C.
Helps you to find code bottlenecks..
Mongrel
01-28-2004, 08:39 PM
Yay, it works!
Well, more or less, gprof itself says that the output is invalid, but dev-c++ has no problems with it, which is good enough for me (for now at least).
75% of the time spent in the same function ... doh!
Tertiary
01-29-2004, 10:35 AM
Yay, it works!
Well, more or less, gprof itself says that the output is invalid
Not sure what your problem might be. What command are you typing and what exact error are you getting ?
When I tested it, I CDed to the directory where my exe and gmon.out where, and then did c:\dev-cpp\bin\gprof <myprog>.exe
and it worked fine.
Mongrel
01-29-2004, 08:11 PM
hmmmm, you have to run gprof on the .exe? Never tried that.
"gprof gmon.out" gives me the "not in a.out format" message. Will try it again tonight with the exe.
Trumpcard
01-29-2004, 11:52 PM
gprof will automaticlly grab the gmon file, you have to specify the binary.. I made the same mistake initially, I assumed it just needed to read the output file...
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.