Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


GetProcessTimes CPU process usage percent


GetProcessTimes CPU process usage percent

Author
Message
eugene2005
eugene2005
Forum God
Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)Forum God (4K reputation)

Group: Forum Members
Posts: 19, Visits: 38


GetProcessTimes CPU process usage percent



it does not show correctly,

how to work with big numbers? 64bit



Private Sub timCPU_Timer()

On Error Resume Next



hProc = OpenProcess(PROCESS_QUERY_INFORMATION, 0, Val(txtPID))



Static ftKernelStart As FILETIME

Static ftUserStart As FILETIME

bRet = GetProcessTimes(hProc, ftCreat, ftExit, ftKernel, ftUser)

Dim PU As Double

PU = ((ftKernel.dwLowDateTime - ftKernelStart.dwLowDateTime) + (ftUser.dwLowDateTime - ftUserStart.dwLowDateTime) / 1000) * 100

PU = PU / 10000000



If PU > maxcpu And PU <= 100 Then

maxcpu = PU

txtMAX.Text = CStr(maxcpu)

End If



txtCPU.Text = CStr(PU)

ftKernelStart = ftKernel

ftUserStart = ftUser

End Sub

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search