Ad Widget

Collapse

Cumulate Values of wmi.get item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neincob
    Junior Member
    • Feb 2025
    • 4

    #1

    Cumulate Values of wmi.get item

    Hello,

    I am monitoring the cpu time and ram usage of a windows service with these items:

    wmi.get["root\CIMV2", "SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name='Name_of_the_service'"]

    wmi.get["root\CIMV2", "SELECT WorkingSet FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name='Name_of_the_service'"]

    The Item for the ram usage works fine, but for the cpu time it just gives me individuall values.
    What i want to achieve with this item is displaying the cpu time the process uses, as is shown in the taskmanager. The taskmanager accumulates all the time since the process was started, so when u restart the service it goes to zero and starts counting again.
  • neincob
    Junior Member
    • Feb 2025
    • 4

    #2
    Well i got it running. I will post the items here so if anyone is looking for it the can find it:
    Code:
    wmi.get["root\CIMV2", "SELECT KernelModeTime FROM Win32_Process WHERE Name='Name_of_the_service.exe'"]
    (as an item with no value, so it collects the raw "ticks")

    Code:
    wmi.get["root\CIMV2", "SELECT UserModeTime FROM Win32_Process WHERE Name='Name_of_the_service.exe'"]
    (same as above)

    Code:
    (last(//wmi.get["root\CIMV2", "SELECT KernelModeTime FROM Win32_Process WHERE Name='Name_of_the_service.exe'"]) + last(//wmi.get["root\CIMV2", "SELECT UserModeTime FROM Win32_Process WHERE Name='Name_of_the_service.exe'"])) / 10000000
    (a calculated item which then shows the cpu time of the service)

    Comment

    Working...