找回密码
 加入
搜索
查看: 1972|回复: 4

[系统综合] 用AU3写个几百万的循环运算能用来测试电脑CPU的性能吗?

  [复制链接]
发表于 2011-10-20 18:12:07 | 显示全部楼层 |阅读模式
这样能不能用来测试CPU的速度。。。。
发表于 2011-10-23 18:09:21 | 显示全部楼层
U够用就行了 就像你的车一样
时速10000   100 1000没多打区别的
楼主要看性能的话建议  鲁大师
发表于 2011-10-23 22:32:09 | 显示全部楼层
戏不大,auto没法真正实现浮点运算
发表于 2011-10-24 10:42:34 | 显示全部楼层
这样能不能用来测试CPU的速度。。。。
漫反射 发表于 2011-10-20 18:12


你要怎样测试呢?
来,画个大红心来测试下cpu计算能力


#include <GDIPlus.au3>
#Include <Timers.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)

Global Const $iW = 400
Global Const $iH = 400
Global Const $radius = 200
Global Const $pi = ACos(-1)
Global Const $dy = 30
Global $dist, $p, $l, $r, $col, $Init, $Timer

Global $hWnd = GUICreate("GDI+ Heart Test CPU", $iW, $iH)
GUISetState()
GUISetOnEvent(-3, "_Close")

_GDIPlus_Startup()
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Global $hPen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

$Init = _Timer_Init()
Draw()
GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")

$Timer = _Timer_Diff($Init)
MsgBox(0, "绘红心费时", "窗口大小:" & $iW & " × " & $iH & @CRLF & _
                                                 "绘心时长:" & $Timer)


Func Draw()
    _GDIPlus_GraphicsClear($hBackbuffer)
    For $y = 1 To $iH
        For $x = 1 To $iW
            $dist = Sqrt((($iW / 2) - $x) ^ 2 + (($iH / 2) - $y) ^ 2)
            $p = ATan2(($iW / 2) - $x, ($iH / 2) - $y)
            $l = Abs($p) / $pi
            $r = (13 * $l - 22 * $l ^ 2 + 10 * $l ^ 3) / (6 - 5 * $l) * $radius
            If $dist <= $r Then
                $col = "FF0000"
            Else
                $col = "000000"
            EndIf
            _GDIPlus_PenSetColor($hPen, "0xFF" & $col)
            _GDIPlus_GraphicsDrawRect($hBackbuffer, $x, $y - $dy, 1, 1, $hPen)
        Next
        _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW, $iH)
    Next
EndFunc

Func ATan2($y, $x)
    Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
EndFunc

Func WM_ERASEBKGND()
        _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW, $iH)
        Return 1
EndFunc

Func _Close()
    GUIRegisterMsg($WM_ERASEBKGND, "")
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hWnd)
    Exit
EndFunc
发表于 2011-10-30 14:37:49 | 显示全部楼层
回复 4# happytc
楼主 这个脚本写的很NB
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 22:30 , Processed in 0.071749 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表