.NET Framework 中的性能计数器Performance Counters in the .NET Framework

本主题提供了一系列性能计数器可以中找到Windows 性能监视器This topic provides a list of performance counters you can find in the Windows Performance Monitor.

异常性能计数器Exception performance counters

性能控制台 .NET CLR Exceptions(异常)类别包含的计算取提供应用程序引发的异常的相关信息。The Performance console .NET CLR Exceptions category includes counters that provide information about the exceptions thrown by an application. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
引发的异常数# of Exceps Thrown 显示从应用程序启动以来引发的异常总数。Displays the total number of exceptions thrown since the application started. 此数值包括 .NET 异常和转换为 .NET 异常的非托管异常。This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. 例如,从非托管代码返回的 HRESULT 在托管代码中会被转换为异常。For example, an HRESULT returned from unmanaged code is converted to an exception in managed code.

此计数器包括已处理和未经处理的异常。This counter includes both handled and unhandled exceptions. 将再次计算重新引发的异常。Exceptions that are rethrown are counted again.
引发的异常数/秒# of Exceps Thrown / Sec 显示每秒引发的异常数。Displays the number of exceptions thrown per second. 此数值包括 .NET 异常和转换为 .NET 异常的非托管异常。This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. 例如,从非托管代码返回的 HRESULT 在托管代码中会被转换为异常。For example, an HRESULT returned from unmanaged code is converted to an exception in managed code.

此计数器包括已处理和未经处理的异常。This counter includes both handled and unhandled exceptions. 此数值不是一段时间内的平均值;它显示最后两个示例中观测值的差除以示例间隔所得的结果。It is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval. 此计数器是潜在的性能问题的指示器,如果一个较大 (> 100 为单位) 引发的异常数。This counter is an indicator of potential performance problems if a large (>100s) number of exceptions are thrown.
筛选次数/秒# of Filters / Sec 显示每秒执行的 .NET 异常筛选次数。Displays the number of .NET exception filters executed per second. 无论异常是否已处理,都会计算异常筛选。An exception filter evaluates regardless of whether an exception is handled.

此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
Finally 数量/秒# of Finallys / Sec 显示每秒执行的 finally 块的数量。Displays the number of finally blocks executed per second. 无论以何种方式退出 try 块,均会执行 finally 块。A finally block is guaranteed to be executed regardless of how the try block was exited. 此计数器只计算到为异常执行的 finally 块,不计算正常代码路径上的 finally 块。Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter.

此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
引发到捕获的深度/秒Throw to Catch Depth / Sec 显示从引发异常的帧到处理该异常的帧每秒遍历的堆栈帧数。Displays the number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception, per second. 此计数器在输入异常处理程序后重置为零,因此嵌入的异常显示处理程序到处理程序的堆栈深度。This counter resets to zero when an exception handler is entered, so nested exceptions show the handler-to-handler stack depth.

此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.

互操作性能计数器Interop performance counters

性能控制台 .NET CLR Interop(互操作)类别包括的计数器提供应用程序与 COM 组件、COM + 服务和外部类型库交互的相关信息。The Performance console .NET CLR Interop category includes counters that provide information about an application's interaction with COM components, COM+ services, and external type libraries. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
CCW 数目# of CCWs 显示 COM 可调用包装 (CCW) 的当前数目。Displays the current number of COM callable wrappers (CCWs). CCW 是指正在从非托管 COM 客户端引用的托管对象的代理。A CCW is a proxy for a managed object being referenced from an unmanaged COM client. 此计数器显示非托管 COM 代码所引用的托管对象数。This counter indicates the number of managed objects referenced by unmanaged COM code.
封送处理次数# of marshaling 显示从应用程序启动以来已将参数和返回值从托管代码封送至非托管代码(反之亦然)的总次数。Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started. 如果存根内联,则此计数器不会递增。This counter is not incremented if the stubs are inlined. (存根负责封送处理参数和返回值)。(Stubs are responsible for marshaling arguments and return values). 如果封送处理开销很小,存根通常为内联。Stubs are usually inlined if the marshaling overhead is small.
存根数# of Stubs 显示由公共语言运行时创建的当前存根数。Displays the current number of stubs created by the common language runtime. 存根负责在 COM 互操作调用或平台 invoke 调用期间将自变量和返回值从托管代码封送值非托管代码(或反之)。Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call.
TLB 导出次数/秒# of TLB exports / sec 留待将来使用。Reserved for future use.
TLB 导入次数/秒# of TLB imports / sec 留待将来使用。Reserved for future use.

JIT 性能计数器JIT performance counters

性能控制台 .NET CLR JIT 类别包括的计数器提供已进行 JIT 编译的代码的相关信息。The Performance console .NET CLR JIT category includes counters that provide information about code that has been JIT-compiled. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
实时编译的 IL 字节数# of IL Bytes JITted 显示从应用程序启动以来,由实时 (JIT) 编译器编译的 Microsoft 中间语言 (MSIL) 字节总数。Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started. 此计数器等效于“实时编译的 IL 字节总数”计数器。This counter is equivalent to the Total # of IL Bytes Jitted counter.
实时编译的方法数# of Methods JITted 显示从应用程序启动以来 JIT 编译的方法总数。Displays the total number of methods JIT-compiled since the application started. 此计数器不包括预先进行 JIT 编译的方法。This counter does not include pre-JIT-compiled methods.
JIT 所占时间百分比% Time in Jit 显示自上次 JIT 编译阶段以来 JIT 编译所用运行占用时间的百分比。Displays the percentage of elapsed time spent in JIT compilation since the last JIT compilation phase. 此计数器在每个 JIT 编译阶段结束时更新。This counter is updated at the end of every JIT compilation phase. 编译方法及其依赖关系时即发生 JIT 编译阶段。A JIT compilation phase occurs when a method and its dependencies are compiled.
实时编译的 IL 字节/秒IL Bytes Jitted / sec 显示每秒 JIT 编译的 MSIL 字节数。Displays the number of MSIL bytes that are JIT-compiled per second. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
标准 JIT 失败Standard Jit Failures 显示自应用程序启动以来 JIT 编译器编译失败的方法的高峰数量。Displays the peak number of methods the JIT compiler has failed to compile since the application started. 如果无法验证 MSIL 或者 JIT 编译器中出现内部错误,则可能发生此失败。This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler.
实时编译的 IL 字节总数Total # of IL Bytes Jitted 显示自应用程序启动以来 JIT 编译的 MSIL 字节总数。Displays the total MSIL bytes JIT-compiled since the application started. 此计数器等效于“实时编译的 IL 字节数”计数器。This counter is equivalent to the # of IL Bytes Jitted counter.

加载性能计数器Loading performance counters

性能控制台 .NET CLR Loading(加载)类别包括的计数器提供已加载的程序集、类和应用程序域的相关信息。The Performance console .NET CLR Loading category includes counters that provide information about assemblies, classes, and application domains that are loaded. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
加载时间所占百分比% Time Loading 留待将来使用。Reserved for future use.
程序集搜索长度Assembly Search Length 留待将来使用。Reserved for future use.
加载程序堆中的字节数Bytes in Loader Heap 显示所有应用程序域中类加载程序提交的当前内存大小(以字节为单位)。Displays the current size, in bytes, of the memory committed by the class loader across all application domains. 提交的内存是磁盘页面文件中保留的物理空间。Committed memory is the physical space reserved in the disk paging file.
当前 Appdomain 数Current appdomains 显示在此应用程序中加载的应用程序域的当前数目。Displays the current number of application domains loaded in this application.
当前程序集数Current Assemblies 显示当前运行的应用程序中所有应用程序域范围内已加载的当前程序集数量。Displays the current number of assemblies loaded across all application domains in the currently running application. 如果程序集以非特定于域的形式从多个应用程序域中加载,则此计数器只递增一次。If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.
当前已加载的类Current Classes Loaded 显示所有程序集中已加载类的当前数目。Displays the current number of classes loaded in all assemblies.
Appdomain 速率Rate of appdomains 显示每秒加载的应用程序域的数量。Displays the number of application domains loaded per second. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
卸载 Appdomain 的速率Rate of appdomains unloaded 显示每秒卸载的应用程序域的数量。Displays the number of application domains unloaded per second. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
程序集速率Rate of Assemblies 显示所有应用程序域范围内每秒加载的程序集数量。Displays the number of assemblies loaded per second across all application domains. 如果程序集以非特定于域的形式从多个应用程序域中加载,则此计数器只递增一次。If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.

此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
加载类的速率Rate of Classes Loaded 显示所有程序集中每秒加载的类的数量。Displays the number of classes loaded per second in all assemblies. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
加载失败的速率Rate of Load Failures 显示每秒加载失败的类的数量。Displays the number of classes that failed to load per second. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.

加载失败的原因有很多,例如安全性不够或格式无效。Load failures can occur for many reasons, such as inadequate security or invalid format. 有关详细信息,请参阅分析服务帮助。For details, see the profiling services Help.
加载失败总数Total # of Load Failures 显示自应用程序启动以来加载失败的类的高峰数量。Displays the peak number of classes that have failed to load since the application started.

加载失败的原因有很多,例如安全性不够或格式无效。Load failures can occur for many reasons, such as inadequate security or invalid format. 有关详细信息,请参阅分析服务帮助。For details, see the profiling services Help.
Appdomain 总数Total Appdomains 显示自应用程序启动以来已加载的应用程序域的高峰数量。Displays the peak number of application domains loaded since the application started.
卸载的 Appdomain 总数Total appdomains unloaded 显示自应用程序启动以来卸载的应用程序的高峰数量。Displays the total number of application domains unloaded since the application started. 如果应用程序域加载和卸载多次,则此计数器将在每次卸载应用程序域时均递增。If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded.
程序集总数Total Assemblies 显示自应用程序启动以来加载的程序集总数。Displays the total number of assemblies loaded since the application started. 如果程序集以非特定于域的形式从多个应用程序域中加载,则此计数器只递增一次。If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.
已加载的类总数Total Classes Loaded 显示自应用程序启动以来所有程序集中加载的类的累计数量。Displays the cumulative number of classes loaded in all assemblies since the application started.

锁定和线程性能计数器Lock and thread performance counters

性能控制台 .NET CLR LocksAndThreads(锁定和线程)类别包括的计数器提供应用程序所使用的托管锁定和线程的相关信息。The Performance console .NET CLR LocksAndThreads category includes counters that provide information about managed locks and threads that an application uses. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
当前逻辑线程数目# of current logical Threads 显示应用程序中当前托管的线程对象的数目。Displays the number of current managed thread objects in the application. 此计数器保留正在运行和已停止的线程的计数。This counter maintains the count of both running and stopped threads. 此计数器不是一段时间内的平均值;它仅显示的上次观测的值。This counter is not an average over time; it displays only the last observed value.
当前物理线程数目# of current physical Threads 显示公共语言运行时创建和拥有以用作托管线程对象的基础线程的本机操作系统线程数。Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. 此计数器的值不包括运行时在其内部操作中使用的线程;它是操作系统进程中线程的子集。This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process.
当前已识别的线程数目# of current recognized threads 显示当前已由运行时识别的线程数。Displays the number of threads that are currently recognized by the runtime. 这些线程与对应的托管线程对象相关联。These threads are associated with a corresponding managed thread object. 运行时不创建这些线程,但它们在运行时内至少运行过一次。The runtime does not create these threads, but they have run inside the runtime at least once.

仅跟踪唯一线程;其线程 ID 与重新输入运行时或在线程退出后重新创建的线程 ID 相同的线程不会进行两次计数。Only unique threads are tracked; threads with the same thread ID that reenter the runtime or are recreated after the thread exits are not counted twice.
已识别的线程总数# of total recognized Threads 显示自应用程序启动以来已由运行时识别的线程总数。Displays the total number of threads that have been recognized by the runtime since the application started. 这些线程与对应的托管线程对象相关联。These threads are associated with a corresponding managed thread object. 运行时不创建这些线程,但它们在运行时内至少运行过一次。The runtime does not create these threads, but they have run inside the runtime at least once.

仅跟踪唯一线程;其线程 ID 与重新输入运行时或在线程退出后重新创建的线程 ID 相同的线程不会进行两次计数。Only unique threads are tracked; threads with the same thread ID that reenter the runtime or are recreated after the thread exits are not counted twice.
争用率/秒Contention Rate / Sec 显示运行时中线程尝试获取托管锁定的失败率。Displays the rate at which threads in the runtime attempt to acquire a managed lock unsuccessfully.
当前队列长度Current Queue Length 显示当前正在等待获取应用程序中托管锁定的线程总数。Displays the total number of threads that are currently waiting to acquire a managed lock in the application. 此计数器不是一段时间内的平均值;它显示上次观测的值。This counter is not an average over time; it displays the last observed value.
队列长度/秒Queue Length / sec 显示每秒内等待获取应用程序中锁定的线程数目。Displays the number of threads per second that are waiting to acquire a lock in the application. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
队列长度峰值Queue Length Peak 显示自应用程序启动以来等待获取托管锁定的线程总数。Displays the total number of threads that waited to acquire a managed lock since the application started.
已识别线程的速率/秒rate of recognized threads / sec 显示每秒内由运行时识别的线程数。Displays the number of threads per second that have been recognized by the runtime. 这些线程与对应的托管线程对象相关联。These threads are associated with a corresponding managed thread object. 运行时不创建这些线程,但它们在运行时内至少运行过一次。The runtime does not create these threads, but they have run inside the runtime at least once.

仅跟踪唯一线程;其线程 ID 与重新输入运行时或在线程退出后重新创建的线程 ID 相同的线程不会进行两次计数。Only unique threads are tracked; threads with the same thread ID that reenter the runtime or are recreated after the thread exits are not counted twice.

此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
争用总数Total # of Contentions 显示运行时中线程已尝试获取托管锁失败的总次数。Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully.

内存性能计数器Memory performance counters

性能控制台 .NET CLR Memory(内存)类别包括的计数器提供垃圾回收器的相关信息。The Performance console .NET CLR Memory category includes counters that provide information about the garbage collector. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
所有堆中的字节数# Bytes in all Heaps 显示“第 1 代堆大小”计数器、“第 2 代堆大小”计数器和“大型对象堆大小”计数器的总和。Displays the sum of the Gen 1 Heap Size, Gen 2 Heap Size, and Large Object Heap Size counters. 此计数器显示垃圾回收堆上分配的当前内存(以字节为单位)。This counter indicates the current memory allocated in bytes on the garbage collection heaps.
GC 句柄数# GC Handles 显示正在使用的垃圾回收句柄的当前数目。Displays the current number of garbage collection handles in use. 垃圾回收句柄是指公共语言运行时和托管环境外部的资源的句柄。Garbage collection handles are handles to resources external to the common language runtime and the managed environment.
第 0 代回收次数# Gen 0 Collections 显示自应用程序启动以来第 0 代对象(即最年轻、最近分配的对象)进行垃圾回收的次数。Displays the number of times the generation 0 objects (that is, the youngest, most recently allocated objects) are garbage collected since the application started.

第 0 代中的可用内存不能满足分配请求时,会出现第 0 代垃圾回收。Generation 0 garbage collection occurs when the available memory in generation 0 is not sufficient to satisfy an allocation request. 此计数器在第 0 代垃圾回收结束时递增。This counter is incremented at the end of a generation 0 garbage collection. 较高代的垃圾回收包含所有较低代的垃圾回收。Higher generation garbage collections include all lower generation collections. 此计数器在较高代(第 1 或第 2 代)垃圾回收发生时显示递增。This counter is explicitly incremented when a higher generation (generation 1 or 2) garbage collection occurs.

此计数器显示上次观测的值。This counter displays the last observed value. _Global_ 计数器值不准确,应当忽略。The _Global_ counter value is not accurate and should be ignored.
第 1 代回收次数# Gen 1 Collections 显示自应用程序启动以来第 1 代对象进行垃圾回收的次数。Displays the number of times the generation 1 objects are garbage collected since the application started.

此计数器在第 1 代垃圾回收结束时递增。The counter is incremented at the end of a generation 1 garbage collection. 较高代的垃圾回收包含所有较低代的垃圾回收。Higher generation garbage collections include all lower generation collections. 此计数器在较高代(第 2 代)垃圾回收发生时显式递增。This counter is explicitly incremented when a higher generation (generation 2) garbage collection occurs.

此计数器显示上次观测的值。This counter displays the last observed value. _Global_ 计数器值不准确,应当忽略。The _Global_ counter value is not accurate and should be ignored.
第 2 代回收次数# Gen 2 Collections 显示自应用程序启动以来第 2 代对象进行垃圾回收的次数。Displays the number of times the generation 2 objects are garbage collected since the application started. 此计数器在第 2 代垃圾回收结束时递增。The counter is incremented at the end of a generation 2 garbage collection (also called a full garbage collection).

此计数器显示上次观测的值。This counter displays the last observed value. _Global_ 计数器值不准确,应当忽略。The _Global_ counter value is not accurate and should be ignored.
已引发 GC 数# Induced GC 显示因显式调用 GC.Collect 而执行的垃圾回收最大次数。Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. 建议让垃圾回收器微调其回收的频率。It is good practice to let the garbage collector tune the frequency of its collections.
固定对象数目# of Pinned Objects 显示在上一次垃圾回收中遇到的固定对象的数目。Displays the number of pinned objects encountered in the last garbage collection. 钉住的对象是垃圾回收器不能移入内存的对象。A pinned object is an object that the garbage collector cannot move in memory. 此计数器只跟踪经过垃圾回收的堆中钉住的对象。This counter tracks pinned objects only in the heaps that are garbage collected. 例如,第 0 代垃圾回收只导致对第 0 代堆中的固定对象进行枚举。For example, a generation 0 garbage collection causes enumeration of pinned objects only in the generation 0 heap.
正在使用的接收器块数目# of Sink Blocks in use 显示正在使用的同步块的当前数目。Displays the current number of synchronization blocks in use. 同步块是分配的每个对象的数据结构,用于存储同步信息。Synchronization blocks are per-object data structures allocated for storing synchronization information. 它们保留对托管对象的弱引用并且必须由垃圾回收器扫描。They hold weak references to managed objects and must be scanned by the garbage collector. 同步块不限于只存储同步信息,也可以存储 COM 互操作元数据。Synchronization blocks are not limited to storing synchronization information; they can also store COM interop metadata. 此计数器指示有关大量使用同步基元的性能问题。This counter indicates performance problems with heavy use of synchronization primitives.
已提交的字节总数# Total committed Bytes 显示垃圾回收器当前已提交的虚拟内存量(以字节为单位)。Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. 提交内存是磁盘页面文件上为其保留了空间的物理内存。Committed memory is the physical memory for which space has been reserved in the disk paging file.
已保留的字节总数# Total reserved Bytes 显示垃圾回收器当前保留的虚拟内存量(以字节为单位)。Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. 保留内存是在尚未使用任何磁盘或主内存页时为应用程序保留的虚拟内存空间。Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used.
GC 所占时间百分比% Time in GC 显示执行自上次垃圾回收周期以来执行垃圾回收所用运行时间的百分比。Displays the percentage of elapsed time that was spent performing a garbage collection since the last garbage collection cycle. 此计数器通常指示垃圾回收器代表应用程序收集和压缩内存所执行的作业。This counter usually indicates the work done by the garbage collector to collect and compact memory on behalf of the application. 此计数器在每次垃圾回收结束时更新。This counter is updated only at the end of every garbage collection. 此计数器不是平均值;它反映最后观测的值。This counter is not an average; its value reflects the last observed value.
分配的字节数/秒Allocated Bytes/second 显示垃圾回收堆上每秒分配的字节数。Displays the number of bytes per second allocated on the garbage collection heap. 此计数器在每次垃圾回收结束时(而非每次分配时)更新。This counter is updated at the end of every garbage collection, not at each allocation. 此计数器不是一段时间内的平均值;它显示最近两个样本观测值的差除以取样间隔所得的结果。This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
最终存留对象Finalization Survivors 显示由于等待完成而回收后仍存在的垃圾回收对象数。Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. 如果这些对象具有对其他对象的引用,则那些对象也会存在,但是不计入此计数器内。If these objects hold references to other objects, those objects also survive but are not counted by this counter. “从第 0 代提升的终止内存”计数器代表所有由于生命终止而保留的内存。The Promoted Finalization-Memory from Gen 0 counter represents all the memory that survived due to finalization.

此计数器不是累积计数器;它在每次垃圾回收结束时更新为仅在特定回收后仍存在的对象的数量。This counter is not cumulative; it is updated at the end of every garbage collection with the count of the survivors during that particular collection only. 此计数器指示应用程序由于完成而可能会带来的额外系统开销。This counter indicates the extra overhead that the application might incur because of finalization.
第 0 代堆大小Gen 0 heap size 显示第 0 代中可以分配的最大字节数;它不指示第 0 代中已分配的当前字节数。Displays the maximum bytes that can be allocated in generation 0; it does not indicate the current number of bytes allocated in generation 0.

当从上一次回收以来分配的字节数超过此大小时,将触发第 0 代垃圾回收。A generation 0 garbage collection occurs when the allocations since the last collection exceed this size. 第 0 代大小是由垃圾回收器调整的,并且会在应用程序执行期间更改。The generation 0 size is tuned by the garbage collector and can change during the execution of the application. 在第 0 代回收结束时,第 0 代堆的大小实际上为 0 字节。At the end of a generation 0 collection the size of the generation 0 heap is 0 bytes. 此计数器显示将触发下一次第 0 代回收的分配的大小(以字节为单位)。This counter displays the size, in bytes, of allocations that invokes the next generation 0 garbage collection.

此计数器在垃圾回收结束时更新,不在每次分配时更新。This counter is updated at the end of a garbage collection, not at each allocation.
第 0 代提升的字节数/秒Gen 0 Promoted Bytes/Sec 显示每秒从第 0 代提升到第 1 代的字节数。Displays the bytes per second that are promoted from generation 0 to generation 1. 垃圾回收后仍存在的内存被提升。Memory is promoted when it survives a garbage collection. 此计数器是每秒创建的生存期较长的对象的指示器。This counter is an indicator of relatively long-lived objects being created per second.

计数器显示最近两个样本中观测的值的差除以样本的间隔时间所得的结果。This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
第 1 代堆大小Gen 1 heap size 显示第 1 代中的当前字节数;此计数器不显示第 1 代的最大大小。Displays the current number of bytes in generation 1; this counter does not display the maximum size of generation 1. 此代中的对象不是直接分配的;这些对象是从以前的第 0 代垃圾回收提升的。Objects are not directly allocated in this generation; they are promoted from previous generation 0 garbage collections. 此计数器在垃圾回收结束时更新,不在每次分配时更新。This counter is updated at the end of a garbage collection, not at each allocation.
第 1 代提升的字节数/秒Gen 1 Promoted Bytes/Sec 显示每秒从第 1 代提升到第 2 代的字节数。Displays the bytes per second that are promoted from generation 1 to generation 2. 此计数器中不包括仅由于等待完成而被提升的对象。Objects that are promoted only because they are waiting to be finalized are not included in this counter.

垃圾回收后仍存在的内存被提升。Memory is promoted when it survives a garbage collection. 由于第 2 代是最早的,因此不会从第 2 代提升任何内容。Nothing is promoted from generation 2 because it is the oldest generation. 此计数器是每秒创建的生存期很长的对象的指示器。This counter is an indicator of very long-lived objects being created per second.

计数器显示最近两个样本中观测的值的差除以样本的间隔时间所得的结果。This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
第 2 代堆大小Gen 2 heap size 显示在第 2 代中的当前字节数。Displays the current number of bytes in generation 2. 此代中的对象不是直接分配的;这些对象是在以前的第 1 代垃圾回收过程中从第 1 代提升的。Objects are not directly allocated in this generation; they are promoted from generation 1 during previous generation 1 garbage collections. 此计数器在垃圾回收结束时更新,不在每次分配时更新。This counter is updated at the end of a garbage collection, not at each allocation.
大型对象堆大小Large Object Heap size 显示大型对象堆的当前大小(以字节为单位)。Displays the current size, in bytes, of the Large Object Heap. 垃圾回收器将大于 85,000 字节左右的对象视作大对象并且直接在特殊堆中分配大对象;它们不是按照这些级别提升的。Objects that are greater than approximately 85,000 bytes are treated as large objects by the garbage collector and are directly allocated in a special heap; they are not promoted through the generations. 此计数器在垃圾回收结束时更新,不在每次分配时更新。This counter is updated at the end of a garbage collection, not at each allocation.
进程 IDProcess ID 显示被监视的 CLR 进程实例的进程 ID。Displays the process ID of the CLR process instance that is being monitored.
从第 0 代提升的终止内存Promoted Finalization-Memory from Gen 0 显示仅由于等待完成而从第 0 代提升到第 1 代的内存字节数。Displays the bytes of memory that are promoted from generation 0 to generation 1 only because they are waiting to be finalized. 此计数器不是累积计数器;它显示在上一次垃圾回收结束时观测的值。This counter is not cumulative; it displays the value observed at the end of the last garbage collection.
从第 0 代提升的内存Promoted Memory from Gen 0 显示垃圾回收后仍存在并从第 0 代提升到第 1 代的内存字节数。Displays the bytes of memory that survive garbage collection and are promoted from generation 0 to generation 1. 此计数器中不包括仅由于等待完成而被提升的对象。Objects that are promoted only because they are waiting to be finalized are not included in this counter. 此计数器不是累积计数器;它显示在上一次垃圾回收结束时观测的值。This counter is not cumulative; it displays the value observed at the end of the last garbage collection.
从第 1 代提升的内存Promoted Memory from Gen 1 显示垃圾回收后仍存在并从第 1 代提升到第 2 代的内存字节数。Displays the bytes of memory that survive garbage collection and are promoted from generation 1 to generation 2. 此计数器中不包括仅由于等待完成而被提升的对象。Objects that are promoted only because they are waiting to be finalized are not included in this counter. 此计数器不是累积计数器;它显示在上一次垃圾回收结束时观测的值。This counter is not cumulative; it displays the value observed at the end of the last garbage collection. 如果上一次垃圾回收只是第 0 代回收,则此计数器将重置为 0。This counter is reset to 0 if the last garbage collection was a generation 0 collection only.

联网性能计数器Networking performance counters

性能控制台 .NET CLR Networking(网络)类别包括的计数器提供应用程序通过网络发送和接收的数据的相关信息。The Performance console .NET CLR Networking category includes counters that provide information about data that an application sends and receives over the network. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
已接收的字节数Bytes Received 自进程启动以来,AppDomain 中的所有 Socket 对象接收到的字节的累积总数。The cumulative total number of bytes received by all Socket objects within the AppDomain since the process started. 此数字包括数据和 TCP/IP 协议未定义的任何协议信息。This number includes data and any protocol information that is not defined by TCP/IP.
已发送的字节数Bytes Sent 自进程启动以来,AppDomain 中的所有 Socket 对象已发送的字节的累积总数。The cumulative number of bytes sent by all Socket objects within the AppDomain since the process started. 此数字包括数据和 TCP/IP 协议未定义的任何协议信息。This number includes data and any protocol information that is not defined by TCP/IP.
已建立的连接Connections Established 自进程启动以来,AppDomain 中曾连接的任何流套接的 Socket 对象的累积总数。The cumulative total number of Socket objects for stream sockets that were ever connected within the AppDomain since the process started.
已接收的数据报Datagrams Received 自进程启动以来,AppDomain 中的所有 Socket 对象接收到的数据报包的累积总数。The cumulative total number of datagram packets received by all Socket objects within the AppDomain since the process started.
已发送的数据报Datagrams Sent 自进程启动以来,AppDomain 中的所有 Socket 对象已发送的数据报包的累积总数。The cumulative total number of datagram packets sent by all Socket objects within the AppDomain since the process started.
HttpWebRequest 平均生存期HttpWebRequest Average Lifetime 自进程启动以来,AppDomain 中在上一个间隔中结束的所有 HttpWebRequest 对象的平均完成时间。The average time to completion for all HttpWebRequest objects that ended in the last interval within the AppDomain since the process started.
HttpWebRequest 平均排队时间HttpWebRequest Average Queue Time 自进程启动以来,AppDomain 中在上一个间隔中结束的所有 HttpWebRequest 对象的平均排队时间。The average time-on-queue for all HttpWebRequest objects that left the queue in the last interval within the AppDomain since the process started.
创建的 HttpWebRequest/秒HttpWebRequests Created/sec AppDomain 中每秒创建的 HttpWebRequest 对象的数目。The number of HttpWebRequest objects created per second within the AppDomain.
已排队的 HttpWebRequest/秒HttpWebRequests Queued/sec AppDomain 中每秒添加到队列的 HttpWebRequest 对象的数量。The number of HttpWebRequest objects that were added to the queue per second within the AppDomain.
已中止的 HttpWebRequest/秒HttpWebRequests Aborted/sec AppDomain 中其中每秒应用程序调用 Abort 方法的 HttpWebRequest 对象的数量。The number of HttpWebRequest objects where the application called the Abort method per second within the AppDomain.
失败的 HttpWebRequest/秒HttpWebRequests Failed/sec AppDomain 中每秒从服务器接收失败状态的 HttpWebRequest 对象的数量。The number of HttpWebRequest objects that received a failed status code from the server per second within the AppDomain.

几类受支持的网络性能计数器如下:There are several classes of networking performance counters supported:

  • 事件计数器,用于测量某些事件的发生次数。Event counters that measure the number of times some event occurred.

  • 数据计数器,用于测量已发送或已接收的数据量。Data counters that measure the quantity of data sent or received.

  • 持续时间计数器,测量不同进程花费的时间。Duration counters that measure how long different processes take. 测量对象每个间隔(通常以秒计)退出不同状态后的次数。The times are measured on the objects each interval (usually in seconds) after they come out of different states.

  • 每间隔计数器,用于测量每个间隔(通常以秒计)中正在进行特定转换的对象数。Per-Interval counters that measure the number of objects that are making a particular transition per interval (normally per second).

适用于事件的网络性能计数器包括:The networking performance counters for events include the following:

  • 已建立的连接Connections Established

  • 已接收的数据报Datagrams Received

  • 已发送的数据报Datagrams Sent

这些性能计数器提供自进程启动以来的计数。These performance counters provide counts since the process started. 已建立的 Socket 连接的计数包括显式 Socket 方法调用(由已建立的流套接连接的应用程序执行)以及其他类(例如 HttpWebRequestFtpWebRequestWebClientTcpClient)对 Socket 类执行的内部调用The counts of Socket connections established includes explicit Socket method calls by an application for a stream socket connection that was established as well as internal calls made by other classes (HttpWebRequest, FtpWebRequest, WebClient, and TcpClient, for example) to Socket class

“已接收的数据报”和“已发送的数据报”的计数包括使用显式 Socket 方法调用(由应用程序执行)或由其他类(例如 UdpClient)对 Socket 执行的内部调用而发送或接收的数据报包。The counts for Datagrams Received and Datagrams Sent includes datagram packets sent or received using explicit Socket method calls by an application as well internal calls made by other classes (UdpClient, for example) to Socket. 类的新实例。class. “已接收的数据报”和“已发送的数据报”的计数也可能用于通过假定数据报的平均大小粗略测量使用数据报发送或接收的字节数。The counts Datagrams Received and Datagrams Sent may also be used to provide a very crude measure of how many bytes were sent or received using datagrams by assuming an average size for a datagram.

适用于数据的网络性能计数器包括:The networking performance counters for data include the following:

  • 已接收的字节数Bytes Received

  • 已发送的字节数Bytes Sent

上述计数器提供自进程启动以来的字节计数。The above counters provide counts of bytes since the process started.

有如下两个持续时间计数器可测量 HttpWebRequest 对象经过整个或部分生命周期所花费的时间:There are two duration counters that measure how long it took for HttpWebRequest objects to pass through either their entire life cycle or just part of it:

  • HttpWebRequest 平均生存期HttpWebRequest Average Lifetime

  • HttpWebRequest 平均排队时间HttpWebRequest Average Queue Time

对于“HttpWebRequest 平均排队时间”计数器,大多数 HttpWebRequest 对象的生存期总是开始于创建对象时,而在应用程序关闭响应流时结束。For the HttpWebRequest Average Lifetime counter, the lifetime of most HttpWebRequest objects always starts with the time that the object is created up until the time that the response stream is closed by the application. 有两种不常见的情况:There are two uncommon cases:

有 4 个计数器可在每个间隔跟踪某些 HttpWebRequest 对象问题。There are four counters that track certain HttpWebRequest object issues per interval. 这些性能计数器可帮助应用程序开发人员、管理员和支持人员更好地了解 HttpWebRequest 对象的当前行为。These performance counters can help application developers, administrators, and support staff better understand what the HttpWebRequest objects are doing. 这些计数器包括:The counters include the following:

  • 创建的 HttpWebRequest/秒HttpWebRequests Created/sec

  • 已排队的 HttpWebRequest/秒HttpWebRequests Queued/sec

  • 已中止的 HttpWebRequest/秒HttpWebRequests Aborted/sec

  • 失败的 HttpWebRequest/秒HttpWebRequests Failed/sec

“已中止的 HttpWebRequest/秒”计数器也对 Abort 的内部调用进行计数。For the HttpWebRequests Aborted/sec counter, internal calls to Abort are also counted. 这些内部调用通常由应用程序可能要测量的超时导致。These internal calls are usually caused by timeouts that an application may want to measure.

“失败的 HttpWebRequest/秒”计数器包含每秒从服务器接收失败状态代码的 HttpWebRequest 对象的数量。The HttpWebRequests Failed/sec counter contains the number of HttpWebRequest objects that received a failed status code from the server per second. 这意味着在请求结束时从 Http 服务器接收的状态代码不在 200 到 299 的范围内。This means that the status code received from the Http server at the end of the request was not in the range between 200 to 299. 已处理并引发新请求的状态代码(例如多个 401 未授权状态代码)是否失败取决于重试结果。Status codes that are handled and result in a new request (many of the 401 Unauthorized status codes, for example) will fail or not fail based on the result of the retry. 如果应用程序可基于重试查看错误,则此计数器递增。If the application would see an error based on the retry, then this counter is incremented.

网络性能计数器可以通过使用 System.Diagnostics 命名空间中的 PerformanceCounter 和相关类进行访问和管理。Networking performance counters can be accessed and managed using the PerformanceCounter and related classes in the System.Diagnostics namespace. 它还可以通过使用 Windows 性能监视器控制台进行查看。Networking performance counters can also be viewed with the Windows Performance Monitor console.

需要在要使用的配置文件中启用网络性能计数器。Networking performance counters need to be enabled in the configuration file to be used. 通过配置文件中的单个设置即可启用或禁用所有网络性能计数器。All networking performance counters are enabled or disabled with a single setting in the configuration file. 不能启用或禁用单个网络性能计数器。Individual networking performance counters cannot be enabled or disabled. 有关详细信息,请参阅 <performanceCounter> 元素(网络设置)For more information, see <performanceCounter> Element (Network Settings).

如果启用了网络计数器,此操作将创建并更新每个 AppDomain 和全局性能计数器。If networking counters are enabled, this will create and update both per-AppDomain and global performance counters. 如果禁用,则应用程序将不提供任何网络性能计数器数据。If disabled, the application will not provide any networking performance counter data.

性能计数器均分组到类别中。Performance counters are grouped into Categories. 应用程序可列出具有以下示例代码的所有类别:An application can list all of the categories with the following example code:

PerformanceCounterCategory[] Array = PerformanceCounterCategory.GetCategories();  
for (int i = 0; i < Array.Length; i++)  
{  
    Console.Out.WriteLine("{0}. Name={1} Help={2}", i, Array[i].CategoryName, Array[i].CategoryHelp);  
}  

网络性能计数器包含在连个类别中:The networking performance counters are listed in two categories:

  • “.NET CLR 网络”- .NET Framework 版本 2 上引入且在 .NET Framework 版本 2 及更高版本上受支持的原始性能计数器。".NET CLR Networking" - the original performance counters introduced on .NET Framework Version 2 and supported on .NET Framework Version 2 and later.

  • “.NET CLR 网络 4.0.0.0”- 所有上述套接计数器和 .NET Framework 版本 4 及更高版本上受支持的新的性能计数器。".NET CLR Networking 4.0.0.0" - All of the above socket counters plus the new performance counters supported on .NET Framework Version 4 and later. 这些新的计数器提供有关 HttpWebRequest 对象的性能信息。These new counters provide performance information on HttpWebRequest objects.

有关访问和管理应用程序中性能计数器的详细信息,请参阅性能计数器For more information on accessing and managing performance counters in an application, see Performance Counters.

安全性能计数器Security performance counters

性能控制台 .NET CLR Security(安全性)类别包括的计数器提供公共语言运行时针对应用程序执行的安全检查的相关信息。The Performance console .NET CLR Security category includes counters that provide information about the security checks that the common language runtime performs for an application. 下表描述这些性能计数器。The following table describes these performance counters.

性能计数器Performance counter 描述Description
链接时检查次数# Link Time Checks 显示自应用程序启动以来链接时代码访问安全检查的总次数。Displays the total number of link-time code access security checks since the application started. 当调用方要求实时 (JIT) 编译时的特定权限时,执行链接时代码访问安全检查。Link-time code access security checks are performed when a caller demands a particular permission at just-in-time (JIT) compile time. 每个调用方执行一次链接时检查。A link-time check is performed once per caller. 此计数不指示严重的性能问题;它仅指示安全系统活动。This count is not indicative of serious performance issues; it is merely indicative of the security system activity.
RT 检查所占的时间百分比% Time in RT checks 此计数器显示自上一次取样以来执行运行时代码访问安全检查所用运行时间的百分比。Displays the percentage of elapsed time spent performing runtime code access security checks since the last sample. 此计数器在 .NET Framework 安全检查结束时更新。This counter is updated at the end of a .NET Framework security check. 它不是平均值;而表示上次观测的值。It is not an average; it represents the last observed value.
Sig 身份验证所占时间百分比% Time Sig Authenticating 留待将来使用。Reserved for future use.
堆栈审核深度Stack Walk Depth 显示在上次运行时代码访问安全检查期间的堆栈深度。Displays the depth of the stack during that last runtime code access security check. 运行时代码访问安全检查通过审核堆栈执行。Runtime code access security checks are performed by walking the stack. 此计数器不是平均值;它仅显示最后观测的值。This counter is not an average; it displays only the last observed value.
运行时检查总数Total Runtime Checks 显示自应用程序启动以来执行的运行时代码访问安全检查的总数。Displays the total number of runtime code access security checks performed since the application started. 当调用方要求特定权限时,执行运行时代码访问安全检查。Runtime code access security checks are performed when a caller demands a particular permission. 运行时检查在调用方每次调用时都会执行,并会检查调用方的当前线程堆栈。The runtime check is made on every call by the caller and examines the current thread stack of the caller. 此计数器与“堆栈审阅深度”计数器一起使用时可指示安全检查出现的性能损失。When used with the Stack Walk Depth counter, this counter indicates the performance penalty that occurs for security checks.

请参阅See also