Looking for

Cpu meter quad core

Does any one know of a quad core meter for CPU Usage and current temp meter either as a widget or a dock

Any Help would be greatly appreciated

1,699 views 3 replies
Reply #1 Top

I spent more than one month for searching a clear way to measure the CPU Temp through DX. But I did not reach a positive result. It's need to make some additional driver on C++ that will read this data... *_*

However the CPU core usage may be easy realized through WMI. Here is a script example (for 2 Cores):

Dim objWMI,isrunning,PRT,PRS,C0T,C0S,C1T,C1S

Sub Object_OnScriptEnter
  isrunning = False
  PRT = 0 : PRS = 0
  C0T = 0 : C0S = 0
  C1T = 0 : C1S = 0
  desktopx.ScriptObject("wlist").control.resetlist
End Sub

Sub Object_OnStateChange(state)
 On Error Resume Next
 If state = "Command executed" Then
   If Not isrunning Then
    PRT = 0 : PRS = 0
    C0T = 0 : C0S = 0
    C1T = 0 : C1S = 0
    Set objWMI = CreateObject("WbemScripting.SWbemLocator").ConnectServer(".", "root\cimv2")
    objWMI.Security_.ImpersonationLevel = 3
    Object.SetTimer 1, 500 : Object_OnTimer1
    isrunning = True
   Else
    Object.KillTimer 1
    Object.KillTimer 2
    Set objWMI = nothing
    isrunning = False
   End If
 End If
End Sub

Sub Object_OnTimer1
  Object.KillTimer 1
'< PROCESSOR >
  Set PRC = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
   PRT = PRC.Properties_.Item("PercentProcessorTime").Value
   PRS = PRC.Properties_.Item("TimeStamp_Sys100NS").Value
  Set PRC = nothing
'< CORES >
  Set CR0 = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='0'")
  Set CR1 = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='1'")
   C0T = CR0.Properties_.Item("PercentProcessorTime").Value
   C0S = CR0.Properties_.Item("TimeStamp_Sys100NS").Value
   C1T = CR1.Properties_.Item("PercentProcessorTime").Value
   C1S = CR1.Properties_.Item("TimeStamp_Sys100NS").Value
  Set CR0 = nothing
  Set CR1 = nothing
  Object.SetTimer 2, 500
End Sub 
 
Sub Object_OnTimer2
  Object.KillTimer 2
  Dim pr,c0,c1,rm
'< PROCESSOR >
  Set PRC = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='_Total'")
   PRT = PRC.Properties_.Item("PercentProcessorTime").Value - PRT
   PRS = PRC.Properties_.Item("TimeStamp_Sys100NS").Value - PRS
   pr = Calc("p",PRT,PRS)
  Set PRC = nothing
'< CORES >
  Set CR0 = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='0'")
  Set CR1 = objWMI.Get("Win32_PerfRawData_PerfOS_Processor.Name='1'")
   C0T = CR0.Properties_.Item("PercentProcessorTime").Value - C0T
   C0S = CR0.Properties_.Item("TimeStamp_Sys100NS").Value - C0S
   C1T = CR1.Properties_.Item("PercentProcessorTime").Value - C1T
   C1S = CR1.Properties_.Item("TimeStamp_Sys100NS").Value - C1S 
   c0 = Calc("p",C0T,C0S)
   c1 = Calc("p",C1T,C1S)
  Set CR0 = nothing
  Set CR1 = nothing
   '< HERE IS YOUR OUTPUT >
   'desktopx.object("TEXTOBJECT1").text = "Processor: "&pr&"%"
   'desktopx.object("TEXTOBJECT2").text = "Core 0: "&c0&"%"
   'desktopx.object("TEXTOBJECT3").text = "Core 1: "&c1&"%"
   Object.SetTimer 1, 500
End Sub

Function Calc(key,x1,x2)
 Select Case key
  Case "p" Calc = round((1 - x1 / x2) * 100)
  Case "m" Calc = round((x2 - x1) / (x2 / 100))
  End Select
End Function

Sub Object_OnScriptExit '<== Stop timers and Clear memory
   Object.KillTimer 1
   Object.KillTimer 2
   Set isrunning = nothing
   Set PRT = nothing
   Set PRS = nothing
   Set C0T = nothing
   Set C0S = nothing
   Set C1T = nothing
   Set C1S = nothing
   Set objWMI = nothing  
End Sub

Best Regards. :)

Reply #2 Top

You rock Vad!

(And I really like the new clock!) 5*

Reply #3 Top

Thank you Zu!

I'm always ready help to any one who want to know something new about DesktopX scripting. :blush: