Jump to content

QueryPerformance


kaesereibe
 Share

Recommended Posts

QueryPerformance

This example shows just a way to calculate the TimeDiff. Otherwise please use the TimerDiff() function.

- MSDN System Information Functions: Kernel32.dll QueryPerformanceCounter

- MSDN System Information Functions: Kernel32.dll QueryPerformanceFrequency

Func QueryPerformance($N = 0)
    Static $F, $A, $Q, $P, $X
    Local $R
    If $N And Not $P Then
        $F = DllCall("Kernel32.dll", "Int", "QueryPerformanceFrequency", "Int64*", "")
        $F = $F[1]
        $P = DllCall("Kernel32.dll", "Int", "QueryPerformanceCounter", "Int64*", "")
        $P = $P[1]
        Return $F + $P + ($X = 0) + ($A = 0)
    EndIf
    $Q = DllCall("Kernel32.dll", "Int", "QueryPerformanceCounter", "Int64*", "")
    $A = $A + $Q[1] - $P
    $P = $Q[1]
    $X = $X + 1
    $R = $A / $X / $F
    Return ($N And $X = $N) ? BitShift($X = $X - 1, -64) : ($N = 0 And $R) ? ($R + ($A = 0) + ($P = 0) + ($X = 0)) : 1
EndFunc    ;==> QueryPerformance() AutoIt v3.3.12.0
Edited by kaesereibe
Link to comment
Share on other sites

Examples:

QueryPerformance(1)
Sleep(2500)
$End = QueryPerformance(0)
MsgBox(0, "QueryPerformance()", $End)



$i = 0
QueryPerformance(1)
While $i <> 10000000
    $i += 1
WEnd
$End = QueryPerformance(0)
MsgBox(0, "QueryPerformance()", $End)
Edited by kaesereibe
Link to comment
Share on other sites

This is just the same like this:

#include <Timers.au3>
Global $Start = _Timer_Init()
Sleep(200)
ConsoleWrite (_Timer_Diff($Start) & @LF)

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Like I said in my top post:

"This example shows just a way to calculate the TimeDiff. Otherwise please use the TimerDiff() function."

Its the same in short and only 1 function

QueryPerformance(1) start

QueryPerformance(0) to get the diff & reset

Edited by kaesereibe
Link to comment
Share on other sites

And

Global $Start = _Timer_Init() ;to start

ConsoleWrite (_Timer_Diff($Start) & @LF) ;to get the diff

@kaesereibe that is unnecessarily complicated, all to replace a native function that works.

But i do appreciate the effort to come up with something new. Keep it up. :)

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...