PDA

View Full Version : Profiling a plugin?



Dave2001
July 5th, 2002, 15:34
A while back Doom told me about this way of finding slow parts of code, called "profiling". I had never done this before. So, I went & checked "enable profiling", but the build->profile option was disabled. I assume that this is because it is a dll file. Is there any way to profile a plugin dll?

I don't believe I've never heard of profiling before...

Hacktarux
July 5th, 2002, 15:44
It's definitely something that i wanted to make when i have tried to improve the speed of the tr64 plugin. But i have never understand how it works with vc++.

And i remember that i have found something on the microsoft site that says it's a bug of vc++: on some system the profile option is disabled and they gave a .reg file to solve this problem but it didn't enable the option....

Dave2001
July 5th, 2002, 16:08
Hmm... I created a test exe & profiling seems to work just fine there. I created a test dll & the option was disabled again...

Maybe if I start the profiling from the pj64 source?

Dave2001
July 5th, 2002, 16:24
There seems to be ways to do it with dlls and such from command prompt, but the problem is that they don't create a .pbo file like they are supposed to...

Dave2001
July 5th, 2002, 16:36
Whoa!!! I somehow did it, but I'm not sure quite how yet... Here's some of the output (i didn't run anything when i used pj64)

I'll try to figure out what I did & post it here.

Func Func+Child Hit
Time % Time % Count Function
---------------------------------------------------------
0.000 0.0 0.000 0.0 1 CountCombine(void) (combine.obj)
0.000 0.0 0.000 0.0 1 INI_Close(void) (ini.obj)
0.000 0.0 0.000 0.0 1 INI_FindSection(char *) (ini.obj)
0.000 0.0 0.000 0.0 17 INI_GetInt(char *,int,int) (ini.obj)
0.000 0.0 0.000 0.0 1 INI_Open(void) (ini.obj)
0.000 0.0 0.000 0.0 1 _$E17 (main.obj)
0.000 0.0 0.000 0.0 1 _$E19 (main.obj)
0.000 0.0 0.000 0.0 1 _$E20 (main.obj)
0.000 0.0 0.000 0.0 2 _DllMain@12 (main.obj)
0.000 0.0 0.000 0.0 1 _GetDllInfo (main.obj)
0.000 0.0 0.000 0.0 1 _InitiateGFX (main.obj)
0.000 0.0 0.000 0.0 1 _ReadSettings (main.obj)
0.000 0.0 0.000 0.0 3 __mtlockinit (mtlock.obj)
...

Doomulation
July 5th, 2002, 17:31
Originally posted by Dave2001
Whoa!!! I somehow did it, but I'm not sure quite how yet... Here's some of the output (i didn't run anything when i used pj64)

I'll try to figure out what I did & post it here.

Func Func+Child Hit
Time % Time % Count Function
---------------------------------------------------------
0.000 0.0 0.000 0.0 1 CountCombine(void) (combine.obj)
0.000 0.0 0.000 0.0 1 INI_Close(void) (ini.obj)
0.000 0.0 0.000 0.0 1 INI_FindSection(char *) (ini.obj)
0.000 0.0 0.000 0.0 17 INI_GetInt(char *,int,int) (ini.obj)
0.000 0.0 0.000 0.0 1 INI_Open(void) (ini.obj)
0.000 0.0 0.000 0.0 1 _$E17 (main.obj)
0.000 0.0 0.000 0.0 1 _$E19 (main.obj)
0.000 0.0 0.000 0.0 1 _$E20 (main.obj)
0.000 0.0 0.000 0.0 2 _DllMain@12 (main.obj)
0.000 0.0 0.000 0.0 1 _GetDllInfo (main.obj)
0.000 0.0 0.000 0.0 1 _InitiateGFX (main.obj)
0.000 0.0 0.000 0.0 1 _ReadSettings (main.obj)
0.000 0.0 0.000 0.0 3 __mtlockinit (mtlock.obj)
...
That's function profiling.
It lists how many times your functions get called. It's useful to see if a function gets called lots, then you should try to optimize that function, and then you can see which functions that are NOT called. Those should be removed, saves you size ;)

There's other profiling options as well, Dave. Try them, too.

Hacktarux: Profiling isn't hard at all to use. You just need to have an EXE to do it the easy way.

You simply goto options and select "enable profiling" in debug. Then goto build-->profile and you can select a method of profiling. When selected, click OK and the app will automaticlly compile and run. After it's done, you'll see the results of the profiling.

Dave2001
July 5th, 2002, 17:35
:( i can't get it to happen again

jeez... i wrote a simple hello world application & it still does not profile like they say it should...

PREP : fatal error PRF1011: cannot open file c:\programming\proftest\release\proftest .pbo

Rice
July 5th, 2002, 21:27
Dave, you can try Intel's Vtune 5.0 or 6.0, or if you can find, try TrueTime, they are professional profiler.

I don't think you can do multi-thread profiling in VC. I tried it before, it did not work, and I remember MS said VC only support single-thread profiling.

Dave2001
July 6th, 2002, 16:17
Thanks Rice, vtune works great.

25% of the time in Glide64.dll is spent calculating vertices (transformation, lighting), which is understandable

10% is in my CopyBlock function, which can be optimized lots ;)

Doomulation
July 6th, 2002, 17:37
Originally posted by Dave2001
Thanks Rice, vtune works great.

25% of the time in Glide64.dll is spent calculating vertices (transformation, lighting), which is understandable

10% is in my CopyBlock function, which can be optimized lots ;)
Yet, more speed increase! ;)

Rice
July 6th, 2002, 21:58
Dave, are you using Windows 98 or Windows XP? On my PC, Vtune 5.0 or 6.0 can never work under Win2K or WinXP, it crashes the OS. But it works in Win98SE, I have no idea what's wrong with it.

Doomulation
July 6th, 2002, 22:56
Originally posted by Rice
Dave, are you using Windows 98 or Windows XP? On my PC, Vtune 5.0 or 6.0 can never work under Win2K or WinXP, it crashes the OS. But it works in Win98SE, I have no idea what's wrong with it.
Dave is using win98 and 2k
I dunno if it's se, though

Dave2001
July 7th, 2002, 02:04
Originally posted by Rice
Dave, are you using Windows 98 or Windows XP? On my PC, Vtune 5.0 or 6.0 can never work under Win2K or WinXP, it crashes the OS. But it works in Win98SE, I have no idea what's wrong with it.

Works fine on Win2k for me. This is vtune 6.0.

I did find that the visual c++ profiler doesn't work in 2k though. When i tried that one in 98, it worked, but again, it didn't support multithreading.

Rice
July 7th, 2002, 08:25
Weired, I have seen someone on the Net has the same problem as me, in fact, I have two PCs, both have XP, Vtune does not work on either one.

Never mind, I have 98SE to use it with.

Cyberman
July 9th, 2002, 04:38
Originally posted by Rice
Weired, I have seen someone on the Net has the same problem as me, in fact, I have two PCs, both have XP, Vtune does not work on either one.

Never mind, I have 98SE to use it with.

Windows XP is different from classic Win32 API if they work with a Win32 API (Vtune) then it will run fine. A number of programs don't work under XP because it Emulates the Win32 API but not all of it. Also any 'tricks' you used before are likely to cause problems.

I guess :linux: is a little better that way ;)

Cyb

Jsr
July 9th, 2002, 05:24
Originally posted by Dave2001


Works fine on Win2k for me. This is vtune 6.0.

I did find that the visual c++ profiler doesn't work in 2k though. When i tried that one in 98, it worked, but again, it didn't support multithreading.

Hmm, the VC++ profiler works fine for me on win 2k.