Click here to Skip to main content
15,900,258 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: January minus 2 should be November......(a little math and some SQL) Pin
#realJSOP29-Dec-09 8:05
professional#realJSOP29-Dec-09 8:05 
GeneralRe: January minus 2 should be November......(a little math and some SQL) Pin
Johnkokk29-Dec-09 20:04
Johnkokk29-Dec-09 20:04 
GeneralRe: January minus 2 should be November......(a little math and some SQL) Pin
Luc Pattyn30-Dec-09 1:06
sitebuilderLuc Pattyn30-Dec-09 1:06 
GeneralRe: January minus 2 should be November......(a little math and some SQL) Pin
#realJSOP30-Dec-09 9:49
professional#realJSOP30-Dec-09 9:49 
GeneralRe: January minus 2 should be November......(a little math and some SQL) Pin
Johnkokk30-Dec-09 23:59
Johnkokk30-Dec-09 23:59 
AnswerRe: January minus 2 should be November......(a little math and some SQL) Pin
darkelv29-Dec-09 8:13
darkelv29-Dec-09 8:13 
GeneralRe: January minus 2 should be November......(a little math and some SQL) Pin
Johnkokk29-Dec-09 21:23
Johnkokk29-Dec-09 21:23 
QuestionCPU Percentage for each running process [modified] Pin
Daniel Riek29-Dec-09 5:38
Daniel Riek29-Dec-09 5:38 
I am creating an application that will get the CPU utilization for each process similar to the TaskManager. I have created the listing below. When the procedure prints out to a console window the CPU percent is always zero. When I debug the code and step through the code line by line the procedure prints the correct CPU percentage. Why does running the code does not work? While stepping through the code works? Thanks for any help.

Dim poc() As Process = Process.GetProcesses()
Dim PCounter As New PerformanceCounter
PCounter.CategoryName = "Process"
PCounter.CounterName = "% Processor Time"

For i As Integer = 0 To poc.Length - 1
    If poc(i).ProcessName.ToString <> "system" Or poc(i).ProcessName.ToString <> "idle" Or poc(i).ProcessName.ToString <> "svchost" Then
        Try
            'PCounter.InstanceName = "_Total"
            PCounter.InstanceName = poc(i).ProcessName
            Console.WriteLine(PCounter.NextValue.ToString & " " & poc(i).ProcessName & " " & poc(i).MainModule.FileName & " " & poc(i).MainWindowTitle)
        Catch ex As Exception
            'Console.WriteLine(poc(i).ProcessName.ToString & " " & ex.Message)
        End Try
    End If
Next


modified on Tuesday, December 29, 2009 11:52 AM

AnswerRe: CPU Percentage for each running process Pin
#realJSOP29-Dec-09 8:10
professional#realJSOP29-Dec-09 8:10 
GeneralRe: CPU Percentage for each running process Pin
Daniel Riek29-Dec-09 8:32
Daniel Riek29-Dec-09 8:32 
GeneralRe: CPU Percentage for each running process Pin
#realJSOP29-Dec-09 23:31
professional#realJSOP29-Dec-09 23:31 
GeneralRe: CPU Percentage for each running process Pin
Luc Pattyn30-Dec-09 1:08
sitebuilderLuc Pattyn30-Dec-09 1:08 
Questioninstaller program Pin
mehrnoosh28-Dec-09 19:38
mehrnoosh28-Dec-09 19:38 
AnswerRe: installer program Pin
dan!sh 28-Dec-09 19:40
professional dan!sh 28-Dec-09 19:40 
AnswerRe: installer program Pin
εїзεїзεїз28-Dec-09 20:47
εїзεїзεїз28-Dec-09 20:47 
QuestionHow To Insert Bulk datas in a DataSet Into Table... Pin
shamsubava28-Dec-09 19:25
shamsubava28-Dec-09 19:25 
AnswerRe: How To Insert Bulk datas in a DataSet Into Table... Pin
dan!sh 28-Dec-09 19:36
professional dan!sh 28-Dec-09 19:36 
GeneralRe: How To Insert Bulk datas in a DataSet Into Table... Pin
shamsubava28-Dec-09 19:44
shamsubava28-Dec-09 19:44 
GeneralRe: How To Insert Bulk datas in a DataSet Into Table... Pin
dan!sh 28-Dec-09 19:48
professional dan!sh 28-Dec-09 19:48 
GeneralRe: How To Insert Bulk datas in a DataSet Into Table... Pin
shamsubava28-Dec-09 20:12
shamsubava28-Dec-09 20:12 
QuestionChanging System Short Date Format Pin
εїзεїзεїз28-Dec-09 19:23
εїзεїзεїз28-Dec-09 19:23 
AnswerRe: Changing System Short Date Format Pin
dan!sh 28-Dec-09 19:39
professional dan!sh 28-Dec-09 19:39 
GeneralRe: Changing System Short Date Format Pin
εїзεїзεїз28-Dec-09 20:20
εїзεїзεїз28-Dec-09 20:20 
GeneralRe: Changing System Short Date Format Pin
dan!sh 28-Dec-09 20:47
professional dan!sh 28-Dec-09 20:47 
AnswerRe: Changing System Short Date Format Pin
Abhinav S28-Dec-09 20:02
Abhinav S28-Dec-09 20:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.