art4711 / timing Goto Github PK
View Code? Open in Web Editor NEWAPI for timing stuff
API for timing stuff
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.