Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
With today's modern computers, for novice programmers who write mostly small programs, it's not possible to tell which program / algorithm performs better. Is there a tool that measures CPU load and memory load and other performance metrics of a particular program in Windows (an .exe file, an application)? Since my small programs don't eat up much power relative to Windows' own processes or any of my computer's programs, I can't use Task Manager for this.

Essentially, in the short term, this will be useful only for my algorithms as I typically write ones that are a bit unusual and may have different performance (time and memory) than the standard algorithm of that type. In the long term, a program like this would be immensely useful, one that specifies exactly how many bytes of RAM were used by the program, how many commands the CPU ran, how much time it took, etc.

What I have tried:

Googling and searching these forums.
Posted
Updated 13-Aug-16 1:49am

1 solution

A simple timing of the program can be enough. At beginning, save the time in a variable, run the program, read time at the end, the difference is your runtime.
If program is too fast, put it in a loop and run it as many times as needed.

VB
StartTime = Timer
For RunCount = 1 to 10
    ' My Program Here
Next
EndTime = Timer
RunTime = EndTime - StartTime

if you need more details, a profiler can help.
 
Share this answer
 
Comments
Aamir Yousafi 13-Aug-16 13:19pm    
It's not only runtime that I need. In fact, when I run the .exe in Windows, I get the execution time in the MS-DOS console.

Yes, I need more details. I'll look into a good profiler.
Patrice T 13-Aug-16 14:07pm    
I was focused on timing because with modern computers, memory is not a problem it the usage is not extrem.
Aamir Yousafi 13-Aug-16 15:51pm    
Yeah, but with such small programs, the running time won't be significant anyway. The profiler will, hopefully, tell me something about the processor operations completed. This will help me analyze which of my algorithms is most efficient, since I cannot rely on the standard math available for each type of algorithm, because I didn't copy - paste that code and implemented quite a bit differently than the standard.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900