Giter Site home page Giter Site logo

tsccal's Introduction

TSC Calibrator

Gets the frequency of the TSC so that values from rdtsc can be converted to time, much faster than system calls and should work with any compiler (i think).

Usage

tsc_calibrate()
Gets the TSC frequency using the default parameters defined in tsc.c
With default parameters calibration takes a bit over a second.

_tsc_calibrate(uint64_t warmup_count, uint64_t sample_count, uint64_t sample_duration, uint64_t deviation)
Gets the TSC frequency using the passed parameters.
warmup_count is the number of the first samples to be used as a warmup (not used for finding the frequency)
sample_count is the number of samples desired to be used for calculating the frequency
sample_duration is the duration of each sample in nanoseconds, higher sample duration means higher accuracy, but too high sample duration increases the chance of the process scheduler ruining the sample
deviation is value representing how tight of a standard deviation should be used for processing the results (higher is tighter)

tsc_toNano(uint64_t ticks)
returns ticks as a number of nanoseconds as a uint64_t

tsc_toMicro(uint64_t ticks)
returns ticks as a number of microseconds as a uint64_t

tsc_toMilli(uint64_t ticks)
returns ticks as a number of milliseconds as a uint64_t

tsc_toSec(uint64_t ticks)
returns ticks as a number of seconds as a uint64_t

tsc_toNanoF(double ticks)
returns ticks as a number of nanoseconds as a double

tsc_toMicroF(double ticks)
returns ticks as a number of microseconds as a double

tsc_toMilliF(double ticks)
returns ticks as a number of milliseconds as a double

tsc_toSecF(double ticks)
returns ticks as a number of seconds as a double

tsccal's People

Contributors

magnusah avatar

Watchers

 avatar

tsccal's Issues

work amazing but little issue

best to force the calibration in first core by using SetThreadAffinityMask function cause rdtsc not work well with multi core since SetThreadAffinityMask not work well on my windows i use the command /affinity and thats work better

start /affinity 1 tsc.exe / for HyperThreading/SMT off
start /affinity 3 tsc.exe / for SMT/HyperThreading On

same goes to SetThreadAffinityMask

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.