brayniac / clocksource Goto Github PK
View Code? Open in Web Editor NEWclocksource provides TSC access with transparent fallback to clock_gettime()
License: Apache License 2.0
clocksource provides TSC access with transparent fallback to clock_gettime()
License: Apache License 2.0
Would it be possible to have a new release of clocksource?
hey -
Perhaps this should be obvious but to me it is not. How can I convert these clock readings to represent the number of nanoseconds since 1970? Is that possible? Perhaps they are only for timing things but would be nice to get a more precise and fast time out of it as part of the same deal.
Thanks!
Adding Windows support would allow tic
to function on windows brayniac/tic#64
hey,
I spent a couple hours tonight trying to work up a struct interface to a thread that periodically calibrates a Clocksource
and sends clones around to any subscribing threads. However, I was surprised to find that neither of two approaches I tried ended up being faster than calling std::time::SystemTime::now()
. It seems that the overhead of concurrency is more costly than the marginal speedup of rdtsc.
This branch has the code. Would be interested in any thoughts you have. Happy to eventually submit as a pull request if you'd like but figured I would check in first since 1) it didn't work quite as expected, 2) no idea if you want something like this in the library.
Here are some bench results:
i7 laptop:
$ RUSTFLAGS="-C target-cpu=native" cargo bench
# ...
running 11 tests
test tests::test_raw ... ignored
test tests::test_reference ... ignored
test tests::test_source ... ignored
test calibrator::tests::calibrates_a_realtime_counter_clocksource ... ignored
test calibrator::tests::cloning_a_clocksource ... bench: 1 ns/iter (+/- 0)
test calibrator::tests::mpsc_calibrator_hot_path_loop_overhead ... bench: 28 ns/iter (+/- 1)
test calibrator::tests::triple_buffer_calibrator_hot_path_loop_overhead ... bench: 28 ns/iter (+/- 3)
test tests::calls_rdtsc_directly ... bench: 11 ns/iter (+/- 0)
test tests::calls_std_instant_now ... bench: 20 ns/iter (+/- 1)
test tests::calls_std_system_time_now ... bench: 20 ns/iter (+/- 0)
test tests::it_creates_a_duration ... bench: 1 ns/iter (+/- 0)
xeon server:
$ RUSTFLAGS="-C target-cpu=native" cargo bench
# ...
running 11 tests
test tests::test_raw ... ignored
test tests::test_reference ... ignored
test tests::test_source ... ignored
test calibrator::tests::calibrates_a_realtime_counter_clocksource ... ignored
test calibrator::tests::cloning_a_clocksource ... bench: 1 ns/iter (+/- 0)
test calibrator::tests::mpsc_calibrator_hot_path_loop_overhead ... bench: 35 ns/iter (+/- 0)
test calibrator::tests::triple_buffer_calibrator_hot_path_loop_overhead ... bench: 28 ns/iter (+/- 0)
test tests::calls_rdtsc_directly ... bench: 14 ns/iter (+/- 0)
test tests::calls_std_instant_now ... bench: 25 ns/iter (+/- 0)
test tests::calls_std_system_time_now ... bench: 25 ns/iter (+/- 3)
test tests::it_creates_a_duration ... bench: 1 ns/iter (+/- 0)
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.