Ad Widget

Collapse

CPU Usage by processes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poxeron
    Member
    • Sep 2020
    • 52

    #1

    CPU Usage by processes

    Hi there.
    I know that many of you have solved the problem of getting data about CPU usage by any process or group of processes on Windows platforms-in a different way.
    But I would like to share our experience. May be it will save time and nervous for some one.

    under test :
    Windows 10, few windows of "MS Edge" and online CPU stress test tabs ( https://cpux.net/cpu-stress-test-online )
    PS, instead of "sqlsrvr" on screenshots - use "msedge"

    this task was resolved by few different way :
    1) PowerShell script on local computer
    2) PowerShell command through zabbix checks
    3) WMI.

    by after testing under load (check attachments), the most preferable way - only one (WMI)

    Click image for larger version  Name:	3 ways.png Views:	0 Size:	10.3 KB ID:	428745

    To implement this way, you should :

    1) create 3 item :
    a) Click image for larger version  Name:	1 item.png Views:	0 Size:	41.8 KB ID:	428746
    with key = wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]

    b) Click image for larger version  Name:	2item.png Views:	0 Size:	45.3 KB ID:	428748
    c) with preprocessing steps:
    var line_array = value.split(',');
    var result = 0.0;
    for (var i=0; i<line_array.length; i++) {
    cur_value = line_array[i].match(/[(\d.)]+/g);
    if ('' != cur_value) {
    result += parseFloat(cur_value);
    }
    }
    return result;


    Click image for larger version  Name:	2a.png Views:	0 Size:	18.5 KB ID:	428749
    3) with formula :
    last("wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]")/last("system.cpu.num")

    Click image for larger version  Name:	3.png Views:	0 Size:	52.2 KB ID:	428750

    As result, you will get pretty similar data as in Task Manager
    Attached Files
  • AlexDiamantopulo
    Junior Member
    • Mar 2016
    • 6

    #2
    Looks like this needs to be divided by the core count?

    Comment

    Working...