flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Performance Counter V2.1.3 [x86-64]+[x86]

Author
Thread Post new topic Reply to topic
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 08 Jun 2012, 15:42
Well hello, I'd like to present the thing I have been working on since the release of the last 32bit PFC - the 64bit version.

This version is far superior to the old one in that it has an actual GUI, the ability to run sequential tests without recompilation and automatic file creation with the results. The best part? It's still a macro.

Image

The code has extensive comments, making it easy to navigate and to understand.

The files are saved in the project directory (i.e. where the executable is), with a name pattern as follows: 'PerformanceReport_(yyyy-MM-dd)_(HH-mm).txt'.



Now, the GUI is still on the main thread, which means that the GUI is unresponsive if a test is being run. It's a setback, but I consider it to be a minor shortcoming - there's nothing that interesting you can do when a test is in progress anyway.
Also, you can no longer set the priority class. I doubt anyone used it anyway (It's still changeable via the code, all you need is still there). I can add it on request.

This has taken me very long to create, so I hope you like it and in any case, I'd be happy to get at least some feedback.

Version 2.1.3:
- Now in x86 and x86-64

Version 2.1.2:
- Register preservation

Version 2.1.1:
- Fixed a problem with creating a file, I accidentally broke it in 2.1.0 update.

Version 2.1.0:
- I have made additional changes that make this macro very reliable. The results are now as accurate as possible.


Description:
Download
Filename: PerformanceCounter_V2.1.3_x86-64.zip
Filesize: 4.58 KB
Downloaded: 274 Time(s)

Description: Fixed the time output.
Download
Filename: PerformanceCounter_V2.1.4_x86.zip
Filesize: 4.57 KB
Downloaded: 278 Time(s)



Last edited by Inagawa on 14 Jun 2012, 20:20; edited 22 times in total
Post 08 Jun 2012, 15:42
View user's profile Send private message Reply with quote
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 08 Jun 2012, 15:43
The macro uses the following functions:
Code:
  import kernel32,\        
        CloseHandle, 'CloseHandle',\
        CreateFile, 'CreateFileA',\
        ExitProcess,'ExitProcess',\
        GetCurrentProcess, 'GetCurrentProcess',\
        GetDateFormat, 'GetDateFormatA',\
        GetModuleHandle, 'GetModuleHandleA',\
        GetTimeFormat, 'GetTimeFormatA',\
        HeapAlloc, 'HeapAlloc',\
        QueryPerformanceFrequency, 'QueryPerformanceFrequency',\
        SetPriorityClass, 'SetPriorityClass',\
        Sleep, 'Sleep',\
        WriteFile, 'WriteFile'

  import user32,\
        DialogBoxParam, 'DialogBoxParamA',\
        EndDialog, 'EndDialog',\
        GetDlgItem, 'GetDlgItem',\
        GetDlgItemInt, 'GetDlgItemInt',\
        MessageBox, 'MessageBoxA',\
        ShowScrollBar, 'ShowScrollBar',\
        SendMessage, 'SendMessageA',\
        wsprintf, 'wsprintfA'

  import msvcrt,\
        getchar, 'getchar',\
        sprintf, 'sprintf'
    


Last edited by Inagawa on 08 Jun 2012, 22:06; edited 2 times in total
Post 08 Jun 2012, 15:43
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1635
Location: Toronto, Canada
AsmGuru62 08 Jun 2012, 16:16
Good stuff!
Can it measure any code sequence?
How do I tell it what sequence to measure?
Post 08 Jun 2012, 16:16
View user's profile Send private message Send e-mail Reply with quote
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 08 Jun 2012, 17:17
Yes, it measures anything that RDTSC can, that you put between StartPerformanceCounter and EndPerformanceCounter, the rest is set in the GUI. Smile
Post 08 Jun 2012, 17:17
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Jun 2012, 17:47
Very good tool. I think now how to use it in Fresh IDE. The idea is to select the code snippet in the editor and click on "Measure performance" button in order to run your tool.
Post 08 Jun 2012, 17:47
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 08 Jun 2012, 18:57
Thanks for the praise, I have fixed the file saving now. Having it in Fresh IDE would be really cool btw!
Post 08 Jun 2012, 18:57
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1635
Location: Toronto, Canada
AsmGuru62 08 Jun 2012, 19:41
So, to measure a piece of code, I need to put it between calls and RE-COMPILE the GUI?
Can it be done with no recompiling?
Post 08 Jun 2012, 19:41
View user's profile Send private message Send e-mail Reply with quote
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 08 Jun 2012, 19:48
Ah, I see what you mean. The first test needs compiling, the sequential tests, i.e. different amounts of loops/passes do not. I should've made myself more clear.

Edit: I don't know, can it? Razz
Post 08 Jun 2012, 19:48
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1635
Location: Toronto, Canada
AsmGuru62 08 Jun 2012, 21:44
It would have been nice to have an internal assembler there.
User types some code and assembler makes a binary piece from the sequence.
Then you call that piece in between calls to Start/End and get results.
That is too complex, however, but may be useful for CPU research.
The assembler does not need a full blown abilities, just a sequence of few commands.
I know, ... challenging ...
Post 08 Jun 2012, 21:44
View user's profile Send private message Send e-mail Reply with quote
Inagawa



Joined: 24 Mar 2012
Posts: 153
Inagawa 14 Jun 2012, 18:41
Now also in 32 bit. Smile
Post 14 Jun 2012, 18:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.