473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Process CPU Usage

I am able to find out the process names by the code below but am
clueless how to find out the CPU Usage levels of hte process at any
given time.

Any help??

Dim myProcesses() As Process = Process.GetProcesses
Dim myProcess As Process
For Each myProcess In myProcesses
If (myProcess.ProcessName.ToLower = "buggyprocess") Then
myProcess.Kill()
End If
Next
PS: I want to monitor 'buggyprocess' and see if its 'CPU Usage'
remains above 75% over a period of time, then kill it.
Nov 20 '05 #1
1 1929
"Raghuvansh" <ra***@detel.com> wrote in message
news:5f**************************@posting.google.c om...
I am able to find out the process names by the code below but am
clueless how to find out the CPU Usage levels of hte process at any
given time.


You may be able to work something out using TotalProcessorTime, regularly
polling this value, keeping track of the difference in TotalProcessorTime,
divide by the difference in real time, divide by the number of processors,
and you have the average processor usage since the last time you polled.

Be aware that you shouldn't poll too often, and that you should Sleep() your
thread in between polls, otherwise you'll be the one eating all the CPU
time.

--
Unforgiven

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: w2jin | last post by:
Hi All Some my SQL Server are experience high memory usage. 1. How can I detect which process which process cause the big memory usage and not released? 2. Which sql server components in...
0
by: Dirk Reske | last post by:
Hello, how can I get the memory and cpu usage of a Process? I get the process infos with Process proc = Process.GetProcessByID(...) which value is the Memory usage, I get in the windows Task...
3
by: MattC | last post by:
I have an ASP.NET app that is running at around 60MB for the w3wp.exe. This often jumps very quickly to 100/120 MB before shrinking again. It is also using around 250MB of virtual memory. Is...
2
by: Sidharth | last post by:
Hello, We are experiencing some issues with the aspnet_wp process on our live servers. The problems are intermittent and we cannot reproduce it on our dev and test servers. Currently around...
1
by: Shan Yong | last post by:
I am trying to monitor the CPU usage of a particualar process in VB.NET, and the best that I can come up with is get the TotalProcessor time using the System.Diagnostic.Process object. Is there...
2
by: Mark Jacobs | last post by:
I'm having problems determining the memory usage of a process using the Process component. If I call Process.VirtualMemorySize.ToString I will get back a value that is nowhere near close to what...
35
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is...
22
by: Zen | last post by:
Hi, My production machine has 2G of memory, when aspnet_wp.exe goes up to about ~1.2G of memory usage, I start get out-of-memory exception. Other processes don't use as much memory and I added...
3
by: dittytwo | last post by:
Hi all I have been looking around the web and can't seem to find a solution the solution that i have found and manipulated seems to bring back the whole list of currently running process's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.