Coder Social home page Coder Social logo

timing's Introduction

Stopwatches and state machine timing.

This is not meant to be very useful in userland, although it has its uses,
the idea here is to figure out the quirks in the API for kernel use.

stopwatch.h -> API for a stopwatch-like functionality.
 Stopwatches are timers that keep track of the sum of elapsed time between
 the calls to start and stop function. The stopwatch struct itself is opaque
 and should keep track in any time unit that's most convenient for the
 internal implementation. There are functions to translate this internal
 counter into more useful representations of time when that's needed. The
 point is to have time stamping as cheap as possible and do the heavy math
 when converting into something to print.

 "struct stopwatch" - opaque, but its definition must be provided by the
 header because the user has to allocate it himself.
 "stopwatch_reset" - resets the stopwatch.
 "stopwatch_start" - starts accumulating time.
 "stopwatch_stop" - stops accumulating time.
 "stopwatch_handover" - uses the same timestamp to stop the stopwatch
   in the first argument and start the stopwatch in the second argument.
 "stopwatch_snapshot" - take a current snapshot of a running stopwatch.
 "stopwatch_to_ts" - converts the internal value of the stopwatch into
   a timespec.
 "stopwatch_to_tv" - converts the internal value of the stopwatch into
   a timeval.
 "stopwatch_to_s" - converts the internal value of the stopwatch into
   a integer of number of seconds elapsed.
 "stopwatch_to_ns" - converts the internal value of the stopwatch into
   a double containing the number of nanoseconds elapsed.

state_timer.h -> API for keeping track of time spent in various states of
 a state machine. Just simple macros around stopwatches.
 
 "STATE_TIMER(nstates)" - declares a struct that will keep track of "nstates"
  states.
 "STATE_TIMER_RESET(st, nstates)" - resets a "STATE_TIMER" struct.
 "STATE_TIMER_ENTER(st, state)" - called when entering "state" which will
  start accounting time for that state and stop accounting time for the
  previous state.
 "STATE_TIMER_STOP(st)" - called to stop accounting time.
 "STATE_TIMER_STOPWATCH(st, state, res)" - returns the stopwatch for a
  particular state (presumably to do time conversions) copied into the
  "res" stopwatch struct.

timing's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.