System Boot Definition

Does anyone know an elegant way to determine "System Boot", preferably using Windows performance counters? In this case, I mean "System Boot" in the classical (UNIX) sense of the word, and not in the often confused percentage of "CPU Usage".

Based on my reading ... A "system load" is usually represented as a float, which defines the number of processes in the startup state (that is, not including the number of processes that are currently blocked for one reason or another) that can be launched in a certain time. Wikipedia gives a good explanation here -http://en.wikipedia.org/wiki/Load_(computing) .

Interactive Im works in C #, so any examples in this language would be greatly appreciated.

+3
source share
1 answer

System loading, in the sense of UNIX (and if I remember correctly), is the number of processes that can be started that actually are not running on the CPU (averaged over a period of time). Utilities such as topdisplay this load, for example, the last 1, 5 and 15 minutes.

I do not think this is possible with the standard Win32 WMI classes. The process status field (ExecutionState)in WMI objects is Win32_Processdocumented as unused.

(, , , , ). Win32_Thread ExecutionState, :

  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

2 (, , 6, , ), . , .

, ThreadState :

  • 0 ( ).
  • 1 ( ).
  • 2 ().
  • 3 Standby ( , ).
  • 4 ( ).
  • 5 ( , , ).
  • 6 ( , ).
  • 7 ( ). 1 3.

, , . Microsoft WMI, , : -)

Windows- , 1- , . VBScript WMI - , , CPU , , , .

, - ( VBScript , ):

set objWmi = GetObject("winmgmts:\\.\root\cimv2")
set threadList = objWmi.ExecQuery("select * from Win32_Thread",,48)
sysLoad = 0
for each objThread in threadList
    if objThread.ThreadState = 1 or objThread.ThreadState = 3 then
        sysLoad = sysLoad + 1
    end if
next
' sysLoad now contains number of threads waiting for a CPU. '
+4

Source: https://habr.com/ru/post/1709898/


All Articles