ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

use AHK to determine CPU usgae of any given process?

<< < (2/4) > >>

skwire:
In any case, the CPUtimes script reports the CPU usage to a TrayTip - not a variable.
I'm hoping to see a script example of how to have the CPU usage
of the active window reported to a variable ...-AEN007 (November 08, 2011, 02:17 AM)
--- End quote ---

The GetProcessTimes(), GetSystemTimes() and GetIdleTimes() functions in that script return the data you want.  It's up to you to dump that data into a variable:


--- Code: Autohotkey ---myVar := GetSystemTimes(); myVar will now contain the total CPU load at that moment.; Now do whatever you need to do with the variable and data.

IainB:
I am interested in this subject, because I fairly often wish to check on the relative CPU utilisation of running processes, for the purposes of comparison - i.e., which of the CPU cycle gobblers are doing what.
I do not usually want to know the CPU utilisation of just a single process in isolation.
And sometimes I want more information than just the basic CPU utilisation - e.g., I may want to know more about process I/O performance - in this case I will usually use Sysinternals' Process Explorer.

However, if it's just CPU utilisation that I am after, then the quickest most useful display that I can currently get is by:
Step 1. pressing Shift+Ctrl+Esc - which brings up the Windows Task Manager window.
Step 2. selecting the Processes tab.
Step 3. clicking on the CPU column header, to get the active processes (those that are consuming CPU) so that they are stacked in ascending order of size at the bottom of the display.
Step 4. pressing End to get the select cursor to the highest CPU number (that's the one at the bottom of the table, and is normaly the System Idle Process.

What that gives is a comparative and dynamically changing view of the active processes (many/most processes could be idle, depending on what is currently being processed).
When I have finished viewing these processes in the Windows Task Manager window, I usually:
Step 5. press Esc - which closes the window.

Once you have gone through the above steps, the window settings you selected for Windows Task Manager are retained, so you only need to go through steps 1., 4., 5., subsequently.

Based on the hypothesis that automating a repetitive process can usually save a lot of time, the most useful thing I could think of here for my purposes would be to automate these steps using (say) AHK, so that 1 hotkey action does it all, including (say) a 10-second pause to give me time to view the Windows Task Manager window before it is closed.

If anyone could give me some pointers as to how to do this (using AHK), then that could be very helpful, and it would help me to learn more about using AHK as well - which I am interested in doing.

I think automation like this is potentially highly useful, and can sometimes have unexpected spin-offs.
For example, the potential time-savings of automating the above steps could be quite significant for me over a year of computer use, and may even leave the way open to (say) automate the manual comparison/monitoring of process CPU utilisation, so that I would get an alert of a potential system CPU performance issue - rather than keep having to look and see if there is one as at present.

Similarly, I have already saved myself an inestimable amount of time and trouble by the simple act of recoding my CapsLock key (using Remapkey) to behave like the RightShift key - which also means that I can easily use key combinations such as, for example, LeftShift+RightShift+N, to bring up Notepad (or any other application I choose for "N"), without much risk of running into actual/potential conflict with any existing/preset Hotkey allocations from the system or other applications. I mean, who in their right mind is otherwise likely to be using combinations such as LeftShift+RightShift+N? Maybe an exception could be pianists, I suppose.

Stoic Joker:
However, if it's just CPU utilisation that I am after, then the quickest most useful display that I can currently get is by:
Step 1. pressing Shift+Ctrl+Esc - which brings up the Windows Task Manager window.
Step 2. selecting the Processes tab.
Step 3. clicking on the CPU column header, to get the active processes (those that are consuming CPU) so that they are stacked in ascending order of size at the bottom of the display.
Step 4. pressing End to get the select cursor to the highest CPU number (that's the one at the bottom of the table, and is normaly the System Idle Process.-IainB (November 08, 2011, 03:49 AM)
--- End quote ---

Interesting, I do much the same, with one exception. I sort the CPU utilization column so that the highest usage is at the top (which would save you a key stroke) because that is where it opens to by default.

IainB:
Interesting, I do much the same, with one exception. I sort the CPU utilization column so that the highest usage is at the top (which would save you a key stroke) because that is where it opens to by default.
-Stoic Joker (November 08, 2011, 06:53 AM)
--- End quote ---
Ahh! Good point, thanks.
I shall do that (omit Step 4) from now on, as it is more efficient that way.
The only reason I had that step 4 in the first place is simply that I prefer to see the numbers displayed that way. I don't think it alters their value to me if they are in reverse order.

anandcoral:
I will suggest Process Tamer https://www.donationcoder.com/Software/Mouser/proctamer/index.html, freeware by our own Mouser.

Not only you can see the top CPU using process (it hides the idle ones by default), it also 'tames' them by lowering their priority if any one goes beyond the limit. All work is done auto. After I started using it, I forgot when was the last time my machine freeze.

Give it a spin.

Regards,

Anand

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version