系统性能参数详解

本文详细介绍了Windows系统中常用的性能指标及其含义,包括缓存、磁盘、内存、网络接口等关键组件的计数器和阈值,帮助读者理解如何通过这些指标评估系统的运行状况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

常用指标
Cache - Level 2 cache. Data Map Hits %
Logical Disk* - % Free Space
Memory* - Counters:
Pages/Sec - How much RAM and virtual memory on the hard drive are being swapped. If above 5 or 6 on average, more RAM is needed.
Network interface* - Counters:
Bytes Total/sec
Objects - Process and thread counts
Paging file - Virtual memory. Counters:
% Usage - The amount of the paging file being used. Create a larger paging file or add RAM if the number is near 100%.
Physical disk - Counters:
Disk Queue Length - The number of disk reads and writes in queue to be done. - If above 4 or 5 on average, a faster hard drive is needed.
Average disk Sec/Transfer
% disk time - The percent of time the disk is busy doing reads or writes. A high number near 100% indicates a disk or drive controller bottleneck.
Process - Currently running programs. Counters:
% Processor Time - The percent of time the processor is used by this process object including all its threads.
Processor* - Counters:
% Processor Time - A number close to 100% indicates the processor is a bottleneck.
Redirector
Server - Counters:
Bytes Total/Sec - The total number of bytes sent through or received through all network cards on a computer by the server service.
System - NT Performance. File Read or Write Operations/Sec
Thread - Thread performance. Counters:
% Processor Time - The percent of time the processor is used by this thread object.
http://www.comptechdoc.org/os/windows/win2k/win2kperformance.html(关于性能的大多数指标都在这里)

实例介绍
http://www.codeproject.com/KB/system/cpuusageByDudiAvramov.aspx
实例中的关键概念

1) object,instance,counter
对应的场景,计算线程IE的CPU使用率:
object -->线程
instance-->IE
counter-->CPU使用率
2)windows下的性能计算模型
在windows下,所有的性能对象(object instance 对应的counter)的数据存储在winperf.h定义的结构体中,我们要做的就是遍历这些结构体,取出我们要使用的数据。一个重要的前提是注册表中相关选项必须设置正确。
BOOL CCpuUsage::EnablePerformaceCounters(BOOL bEnable)
{
if (GetPlatform() != WIN2K_XP)
return TRUE;

CRegKey regKey;
if (regKey.Open(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\PerfOS\\Performance") != ERROR_SUCCESS)
return FALSE;

regKey.SetValue(!bEnable, "Disable Performance Counters");
regKey.Close();

if (regKey.Open(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\PerfProc\\Performance") != ERROR_SUCCESS)
return FALSE;

regKey.SetValue(!bEnable, "Disable Performance Counters");
regKey.Close();

return TRUE;
}

接着传入我们相应的object,instance,counter来获取相关数值。
#define SYSTEM_OBJECT_INDEX 2 // 'System' object
#define PROCESS_OBJECT_INDEX 230 // 'Process' object
#define PROCESSOR_OBJECT_INDEX 238 // 'Processor' object
#define TOTAL_PROCESSOR_TIME_COUNTER_INDEX 240 // '% Total processor time' counter (valid in WinNT under 'System' object)
#define PROCESSOR_TIME_COUNTER_INDEX 6 // '% processor time' counter (for Win2K/XP)
//不同的平台对应的objectindex不同
switch (Platform)
{
case WINNT:
dwObjectIndex = SYSTEM_OBJECT_INDEX;
dwCpuUsageIndex = TOTAL_PROCESSOR_TIME_COUNTER_INDEX;
break;
case WIN2K_XP:
dwObjectIndex = PROCESSOR_OBJECT_INDEX;
dwCpuUsageIndex = PROCESSOR_TIME_COUNTER_INDEX;
strcpy(szInstance,"_Total");
break;
default:
return -1;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值