News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GoP

Started by donkey, August 11, 2009, 05:56:01 AM

Previous topic - Next topic

donkey

I have been thinking lately that it would be nice to have a performance profiling tool for GoAsm. Unfortunately I have no idea how to write one so I decided to get it completely wrong and do my own. I have a completed a skeleton which is meant to serve only as a starting point and to see if can be practically done the way I planned. I have included the source and a test application, no telling at this early time whether it will work with other apps. What I am looking for is ideas and practical additions to make the profiler both powerful and useful.

The concept:

In order to get timing information I have decided to write a debug mode loader for the target application and have written a set of macros to call the profiler. The debugger is about as simple as one can be and for now only works with Windows Vista however it is potentially compatible with Windows XP using downloadable libraries from Microsoft. I just haven't tried them yet.

Give me your thoughts and suggestions, code would be very welcome.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Biterider

Hi Donkey
I wrote something to get performance bottlenecks some time ago. It is based on a special prologue and epilogue so that the ticks the CPU spend executing a procedure can be counted. The counts of the profiled procs are stored in a separate segments created only for this purpose with meaningful names, so that every debugger can show you in a readable form the results of the profiling.

Biterider

dedndave

using Windows XP MCE 2005 sp2

for vista and server 2008, kernel32.dll
FileExtd.lib on Windows Server 2003 and Windows XP
i see the lib file, but no luck

donkey

Hi Dave,

After work I will try to assemble it with the libraries.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

Here is a version assembled with the libs from Microsoft. Seems to work OK on Vista, haven't tried it on XP but GetFileModuleByHandleEx no longer appears on the list of imports according to WinExplorer. I should note that I will upload the header file for the lib in the headers update.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

fixed that one Edgar   :U

donkey

Quote from: dedndave on August 12, 2009, 01:14:48 AM
fixed that one Edgar   :U

Well not so much me as Microsoft. I am currently adding PE information to a tab or tabs, it will incorporate most of the information available through WinExplorer, after all that program was intended to be a test bed for this type of thing.  The other thing I am working on is unnamed profiles that simply use INT3 without enter/exit or label information, probably wont finish those until the weekend though.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

For those who want to build the project for XP you will need the attached header files. Unzip both to your headers folder, winbase.h will be replaced and fileextd.h will be added. You will need the lib files from Microsoft:

File ID extensions for XP

If you are thinking about using the libs in your own program be sure to add a global variable labeled SessionId, I used the type HANDLE but I think DWORD32 will do.

Edgar.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

Well, work continues albeit slowly on the profiler, I should have something to offer up fairly soon. Its usefulness is questionable since there is no way I can find to allow source level profiling which is something I find useful but I can't think of a way to extrapolate a source line number from an address in the code or visa versa. I looked at the LST file but that strips the comment and vertical spacing so line numbers are not easily extracted from it, I am still working on that aspect of the profiler and hopefully I will think of something...
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable