Code Monkey home page Code Monkey logo

winapi-high_resolution_timer's Introduction

WinApi-High_Resolution_Timer

This is a wrapper for the windows API with a simple example. It measure the shortest measurable time and wait 1s.

Chrono Class

winapi.h/.cpp This file contains the winapi_timer and winapi_chrono class. The core functions it wraps are: CreateTimerQueue QueryPerformanceFrequency QueryPerformanceCounter

winapi_utils.h/.cpp

This file contains more general wrappers for the windows API Stuffs about handle, threads etc...

How it works

Using QueryPerformanceCounter require the user several steps getting QueryPerformanceFrequency calling QueryPerformanceCounter two times and use a formula to get the TeltaT the type LARGE_INTEGER is a wrapper for u64

Winapi_chrono() This class add a layer of abstraction, the timer becomes several indipendent start/stop timers

Winapi_chrono::Winapi_chrono( void ) The constructor initialize the class. Get the frequency.

Winapi_chrono::start( index ) Start the timer of index [index]

Winapi_chrono::stop( index ) Get the time elapsed since start

Winapi_chrono::stop_start( index ) Get the time elapsed since start, than restart

Winapi_chrono~Winapi_chrono( void ) Destroy all underlying structures

Hello world

float elapsed; my_timer = Winapi_chrono(); //construct timer class my_timer.start( 0 ); //start section 0 of timer //lots of fancy code elapsed = my_timer.stop( 0 ); //time past since start. //stop will NOT stop the count, another stop will return the elapsed time since start

my_timer.start( 0 )

winapi-high_resolution_timer's People

Contributors

orsoeric avatar

Watchers

 avatar

winapi-high_resolution_timer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.