-
- 'CPU 基准测试+信息查询,好玩又防奸商,去电脑城选电脑带上一个吧!CPU信息一目了然。
- 'BY: fastslz http://bbs.cn-dos.net
- Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
- Set CPUs = objWMIService.InstancesOf("Win32_Processor")
- Set Caches = objWMIService.InstancesOf("Win32_CacheMemory")
- For Each ObjCache In Caches
- Select Case objCache.Level
- case 3
- aUsage = "一级缓存: " & objCache.MaxCacheSize & "KB (一级数据+L1缓存)"
- case 4
- aUsage = aUsage & vbCrLf & "二级缓存: " & objCache.MaxCacheSize & "KB"
- case 5
- aUsage = aUsage & vbCrLf & "三级缓存: " & objCache.MaxCacheSize & "KB"
- End Select
- Next
- For Each ObjCPU In CPUs
- Usage = "CPU 名称: " & ltrim(ObjCPU.Name) & Chr(9) & vbCrLf _
- & "CPU 构架: " & ObjCPU.Description & vbCrLf _
- & "制造厂商: " & ObjCPU.Manufacturer & vbCrLf _
- & "接口规格: " & ObjCPU.SocketDesignation & vbCrLf _
- & "地址位宽: " & ObjCPU.AddressWidth & " Bit" & vbCrLf _
- & "数据位宽: " & ObjCPU.DataWidth & " Bit" & vbCrLf _
- & "CPU 电压: " & ObjCPU.CurrentVoltage / 10 & "V" & vbCrLf _
- & "主频速度: " & ObjCPU.CurrentClockSpeed & "MHZ" & vbCrLf _
- & "总线速度: " & ObjCPU.ExtClock & "MHZ" & vbCrLf & aUsage
- Next
- MsgBox Usage ,vbInformation ,"CPU 信息"
- Dim I,T1,T2,Tempvalue,aRunTime,bRunTime
- T1 = Timer()
- For I = 1 To 200000
- Tempvalue= 2^0.5
- Next
- T2 = Timer()
- aRunTime = Formatnumber((T2-T1)*1000,2)
- MsgBox "CPU 200万次开方计算所需时间:" &aRunTime&" 毫秒" &Chr(9), vbInformation ,"CPU 基准测试"
-
- T1 = Timer()
- For I = 1 To 2000000
- Tempvalue= 1 + 1
- Next
- T2 = Timer()
- bRunTime = Formatnumber((T2-T1)*1000,2)
- MsgBox "CPU 200万次加法计算所需时间:"&bRunTime&" 毫秒" &Chr(9), vbInformation ,"CPU 基准测试"
复制代码