本帖最后由 fastslz 于 2011-6-17 11:33 编辑
我也来一个vbs的
cn-dos旧作- 'CPU 基准测试+信息查询,好玩又防奸商,去电脑城选电脑带上一个吧!CPU信息一目了然。
- 'CPUtest.vbs BY: fastslz http://bbs.cn-dos.net http://bbs.bathome.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.NumberOfCores & 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
- If (Lcase(Right(Wscript.FullName,11)) = "wscript.exe") Then
- MsgBox Usage , vbInformation ,"CPU 基准测试"
- Else
- WScript.Echo Usage
- End If
- Dim I,T1,T2,Tempvalue,aRunTime,bRunTime
- T1 = Timer()
- For I = 1 To 2000000
- Tempvalue= 2^0.5
- Next
- T2 = Timer()
- aRunTime = FormatNumber((T2-T1)*1000,2)
- NumMsg = "CPU 200万次开方计算所需时间:" &aRunTime&" 毫秒" &Chr(9)
-
- T1 = Timer()
- For I = 1 To 6000000
- Tempvalue= 1 + 1
- Next
- T2 = Timer()
- bRunTime = FormatNumber((T2-T1)*1000,2)
- NumMsg = NumMsg & vbCrLf & "CPU 600万次加法计算所需时间:"&bRunTime&" 毫秒" &Chr(9)
- If (Lcase(Right(Wscript.FullName,11)) = "wscript.exe") Then
- MsgBox NumMsg , vbInformation ,"CPU 基准测试"
- Else
- WScript.Echo NumMsg
- End If
复制代码
|