| | |
ASM Code, CPU Utilization, per CPU
![]() |
•
•
Join Date: May 2009
Posts: 2
Reputation:
Solved Threads: 0
I'm a old C++ guy, so forgive my ignorance in ASM.. I'm having issues with getting CPU utilization through perfmon, because of a small memory leak in the pdh.dll after being called every 60 seconds for weeks on end. I then tried using MS typeperf.exe, but I found that EXE will return nothing at times and get into a state where it just will not return anything until the machine is restarted. So, I've decided to drop to a lower level and see if this can be done in ASM without these kinds of issues.
Anyone have a snippet they can part with to pull CPU Utilization per CPU within ASM?
Anyone have a snippet they can part with to pull CPU Utilization per CPU within ASM?
Last edited by Chizl; May 28th, 2009 at 12:43 pm.
Microsoft has good C code with excellent descriptions at its Win32 API reference library:
http://msdn.microsoft.com/en-us/libr...78(VS.85).aspx
Click on the "Performance Counters Functions" category.
Calling the Windows API functions from assembly language is a bit more work than doing it in either C or C++, but it certainly isn't impossible and modern assemblers/packages support features that make the task easier.
You might need to make your own headers {with constant definitions, macros, function prototypes, etc.} for the more obscure API functions; but first, -- depending on which assembler/library/package you decide to go with -- you should check out the associated forums to see if headers already exist for the functions you want to use:
http://www.masm32.com/board/index.php?
http://www.asmcommunity.net/board/
http://www.artofasm.com/
http://board.flatassembler.net/
Hope I've helped!
http://msdn.microsoft.com/en-us/libr...78(VS.85).aspx
Click on the "Performance Counters Functions" category.
Calling the Windows API functions from assembly language is a bit more work than doing it in either C or C++, but it certainly isn't impossible and modern assemblers/packages support features that make the task easier.
You might need to make your own headers {with constant definitions, macros, function prototypes, etc.} for the more obscure API functions; but first, -- depending on which assembler/library/package you decide to go with -- you should check out the associated forums to see if headers already exist for the functions you want to use:
http://www.masm32.com/board/index.php?
http://www.asmcommunity.net/board/
http://www.artofasm.com/
http://board.flatassembler.net/
Hope I've helped!
while (CPU is present) {some assembly required}
![]() |
Similar Threads
- How to get cpu utilization of particular process (C++)
- API to get CPU utilization (C++)
- CPU utilization (Pascal and Delphi)
- help me,its urgent, PC Alarm clock ASM code (Assembly)
- java code that display cpu ver, cpu speed and ram size. (Java)
- cpu utilization (C#)
- svchost.exe - Windows Update - 100% CPU Utilization fix (EASY) (Windows NT / 2000 / XP)
- max cpu speed on hp ze4000-5000 serious? (Motherboards, CPUs and RAM)
- My Sample ASM Code (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: Asm program help
- Next Thread: i7 instruction costs
| Thread Tools | Search this Thread |





