Windows performance counter application (PART1)

Counters are used in Windows OS to provide information about the execution of an operating system or application, service, or driver. Counter data can help identify system resource bottlenecks. Operating systems, networks, and devices provide counter data that applications can consume to provide users with a graphical view of system health.

The System.Diagnostics namespace provides classes that allow you to interact with performance counters. The PerformanceCounter class has a different constructor. In our code, we use constructors in the following format:

public PerformanceCounter( string categoryName, string counterName, string instanceName )

Parameters:

  • categoryName: the name of the performance counter category (performance object) associated with this performance counter.

  • Counter name: the name of the performance counter.

  • i nstanceName: the name of the performance counter category instance. If the category contains a single instance, it is an empty string ("")

This constructor initializes performance counters and associates instances with existing counters on the local computer. CategoryNameCounterName and InstanceName Property must pass a value that points to an existing performance counter on the local computer.

Under some performance counters to track processor utilization, disk I / O, memory, and network

PerformanceCounter("Processor", "% Processor Time", "_Total");

PerformanceCounter("Processor", "% Privileged Time", "_Total");

PerformanceCounter("Processor", "% Interrupt Time", "_Total");

PerformanceCounter("Processor", "% DPC Time", "_Total");

PerformanceCounter("Memory", "Available MBytes", null);

PerformanceCounter("Memory", "Committed Bytes", null);

PerformanceCounter("Memory", "Commit Limit", null);

PerformanceCounter("Memory", "% Committed Bytes In Use", null);

PerformanceCounter("Memory", "Pool Paged Bytes", null);

PerformanceCounter("Memory", "Pool Nonpaged Bytes", null);

PerformanceCounter("Memory", "Cache Bytes", null);

PerformanceCounter("Paging File", "% Usage", "_Total");

PerformanceCounter("PhysicalDisk", "Avg. Disk Queue Length", "_Total");

PerformanceCounter("PhysicalDisk", "Disk Read Bytes/sec", "_Total");

PerformanceCounter("PhysicalDisk", "Disk Write Bytes/sec", "_Total");

PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Read", "_Total");

PerformanceCounter("PhysicalDisk", "Avg. Disk sec/Write", "_Total");

PerformanceCounter("PhysicalDisk", "% Disk Time", "_Total");

PerformanceCounter("Process", "Handle Count", "_Total");

PerformanceCounter("Process", "Thread Count", "_Total");

PerformanceCounter("System", "Context Switches/sec", null);

PerformanceCounter("System", "System Calls/sec", null);

PerformanceCounter("System", "Processor Queue Length", null);

2 performance counter

2.1 CategoryName: Processor

PerformanceCounter("Processor", "% Processor Time", "_Total");

The time determined by the Processor\% Processor Time counter, which is the percentage of the processor's busy thread running time measured by the idle process, and then subtracted by the percentage of 100%. Measuring the number of processor utilization

PerformanceCounter("Processor", "% Interrupt Time", "_Total");

The per second rate of the average number of emergency interrupts, and the rate at which the processor receives and processes hardware interrupts. It does not include deferred procedure calls, which are evaluated separately.

PerformanceCounter("Processor", "% DPC Time", "_Total");

The percentage of time spent by the processor on receiving and service deferred procedure calls during the sampling interval. A deferred procedure call is an interrupt whose priority is lower than the standard interrupt.

PerformanceCounter("Processor", "% Privileged Time", "_Total");

The percentage of non idle processor time spent in special mode. Special mode is a processing mode designed for operating system components and hardware manipulation drivers. It allows direct access to hardware and all memory. The alternative user pattern is a limited processing pattern designed for applications, environment subsystems, and integration subsystems. The operating system switches application threads to privileged mode to access operating system services. This includes time spent on service interruptions and delayed procedure calls (DPC s). A large number of interruptions from a failed device may result in a high privilege time. This counter displays the average busy time as a percentage of the sampling time.

Tags: Windows network

Posted on Wed, 04 Mar 2020 07:01:59 -0800 by cameeob2003