flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
scientica
Are you looking for some program that basically easures the Ticks (or milli secs) it takes to execute an procedure?
Then the explanation is quite simple why you need to give symbolic and/or debug info to the profiler, since it's just pice of dumb software, it can't guess where the funcitons begin, and when guessiung there is a risc of guessing wrong (look at your app while using ollydebug, not always does she see that there is a function under you nose). I don't know how these debug and symbolic info files/sections are contsructed (haven't found any docs on them, if you know any please post a link), maybe it can be done relativley simple to make them by hand/macros. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
![]() |
|
keenin
Yes, basically, it should measure the complete execution time of each procedure; so the most time consuming procedure can be spotted and, thus, be optimized.
Yes, there are awfully few informations about debugging data like symbol tables available. The most common ones under Windows are CodeView (a little bit older) and PDB (in seperate file). Generally, STABS is also widely used (but not understood by OllyDbg:). I only found out that the PDB format is described in the book 'Undocumented Windows 2000 Secrets: A Programmer's Cookbook' - maybe anyone ownes that? If unlikely allowed in the license (I don't know it), the file DBGHELP.DLL from Windows (also included in OllyDbg) can be analyzed as it handles that part for a lot of debuggers, but that may be too much work. Hopefully, you know other resources or applicable techniques or both. keenin. |
|||
![]() |
|
Tomasz Grysztar
You should try Maverick's profiler, I'm attaching it here, but can also get it from the original thread on Win32ASM message board: http://board.win32asmcommunity.net/showthread.php?s=&threadid=7510
(read provided documentation carefully).
|
|||||||||||
![]() |
|
keenin
Thanks for the suggestion, I did not know Maverick's Profiler; it is really good for optimizing code. I tried it out and think that it is best used with different version of one procedure to determine which one is faster. I have searched exactly that kind of line-by-line profiler!
Yet, I am searching a function profiler to spot the functions that have to be optimized - with help of Maverick's Profiler:). keenin. |
|||
![]() |
|
Tomasz Grysztar
BTW, I've made a nice small skeleton interface for it, for anyone wanting to quickly profile some code. Just put your code after the "function" label in the source below and compile it with the profile.bin in the same directory:
Code: include '%include%\win32ax.inc' entry start section '.func' code readable executable ; function to be profiled function: ret section '.prof' code readable writeable executable profiler file 'profile.bin' rb (profiler+2000h)-$ label init at profiler+559 label profile at profiler+1 label cycles qword at profiler+1000h label cycles_low dword at cycles label cycles_high dword at cycles+4 section '.bss' readable writeable strbuffer rb 100h section '.text' code readable executable start: call init stdcall profile,function cinvoke wsprintf,strbuffer,'Function is taking %d cycles.',[cycles_low] invoke MessageBox,0,strbuffer,'Profiler',MB_OK invoke ExitProcess,0 section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ ExitProcess,'ExitProcess' import user,\ wsprintf,'wsprintfA',\ MessageBox,'MessageBoxA' |
|||
![]() |
|
GuyonAsm
yay thanks, i can use this for one of my science projects for school to test how fast an algo is(is this tool efficient enough?).
_________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
roticv
Didn't maverick said something about loading profiler.bin into memory returned by VirtualAlloc to make it 64k aligned or something like that?
|
|||
![]() |
|
keenin
Maverick said that it should be 4k aligned. As each section is that, Privalov defines a new section for PROFILE.BIN and for the function.
I did it a little bit different, though; I would add the function anywhere else to profile more than one function and copy that function to the aligned space. Code: function_aligned: ... function_1: ... ret function_1_size = $-function_1 function_n: ... ret function_n_size = $-function_n ... call init mov ecx,function_1_size mov esi,function_1 mov edi,function_aligned rep movsb pushd function_aligned call profile ... |
|||
![]() |
|
roticv
My mistake then.
I just find my results weird. 8 nops in 1 cycle, while 9 nops in 0 cycle. |
|||
![]() |
|
keenin
Two NOP should be 1 cycle.
You could try using align(1024*4) profiler rb 1024*8 function_aligned rb 1024*8 and copying PROFILE.BIN to profiler or (is larger) align(1024*4) profiler file 'profile.bin' rb 1024*8-$+profiler function_aligned rb 1024*8 Maybe that works for you. keenin. |
|||
![]() |
|
Tomasz Grysztar
roticv wrote: I just find my results weird. Yes, it still seems to a bit unrealiable in some case - we should talk to Maverick, but unfortunatly he's not with us right now. |
|||
![]() |
|
GuyonAsm
are you trying to say that he is deceased? i hope not
![]() _________________ I shall not evade what is predestined because every battle, is another lesson - GuyonAsm. A Believer of The System. |
|||
![]() |
|
comrade
he stopped asm, at least win32asmboard after some scuffle on it
http://board.win32asmcommunity.net/showthread.php?s=&postid=110517#post110517 Quote: Maverick wrote: |
|||
![]() |
|
vid
i once wrote my own profiler, which overloaded "ENTER" and "RETURN" macros, with code that saved profiling info, and it worked nice.
|
|||
![]() |
|
decard
can you post it?
|
|||
![]() |
|
vid
I used my own "proc" macro, so it won't be vary useful. But anyway, here it is. I also used few more own macros there, but i think you can figure out idea from it.
btw, this way isn't good for serious profiling, because it misses multitasking aspect, and sometimes it even displays negative values (?bug), but it gave me idea which procedure wastes most time. I think it would be possible to write something such for FASM's standard procedure macro.
|
|||||||||||
![]() |
|
decard
I have similar problem with Maverick's profiler. For example when my proc is just "xor eax,eax", than it shows "-2" cycles...
![]() |
|||
![]() |
|
vid
i quess it's something with multitasking, but dont know...
|
|||
![]() |
|
roticv
Maybe it is pairing of instructions.
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.