Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate gettimeofday cached #66

Merged
merged 3 commits into from May 1, 2018

Conversation

Labels
None yet
Projects
None yet
4 participants
@nmathewson
Copy link
Contributor

@nmathewson nmathewson commented Apr 27, 2018

No description provided.

nmathewson added 3 commits Apr 26, 2018
This part of the code was the only part that used "cached
getttimeofday" feature, which wasn't monotonic, which we updated at
slight expense, and which I'd rather not maintain.
Previously were using this value to have a cheap highish-resolution
timer.  But we were only using it in one place, and current dogma is
to use monotime_coarse_t for this kind of thing.
Our main function, though accurate on all platforms, can be very
slow on 32-bit hosts.  This one is faster on all 32-bit hosts, and
accurate everywhere except apple, where it will typically be off by
1%.  But since 32-bit apple is a relic anyway, I think we should be
fine.
@coveralls
Copy link

@coveralls coveralls commented Apr 27, 2018

Pull Request Test Coverage Report for Build 603

  • 28 of 28 (100.0%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 58.934%

Files with Coverage Reduction New Missed Lines %
src/or/circuitstats.c 2 78.35%
Totals Coverage Status
Change from base Build 602: 0.03%
Covered Lines: 40518
Relevant Lines: 68752

💛 - Coveralls

if (ewma_ticks_initialized)
return;
monotime_coarse_get(&start_of_current_tick);
crypto_rand((char*)&current_tick_num, sizeof(current_tick_num));
Copy link
Contributor

@dgoulet-tor dgoulet-tor May 1, 2018

Oh wow, I guess this is an upgraded security feature that we didn't have? That is starting the EWMA tick number at a random value! :) +1

Copy link
Contributor Author

@nmathewson nmathewson May 1, 2018

I don't think it's a security feature, since we don't actually expose tick numbers.

My motivation here was to make sure that we would observe tick rollover sometimes, even on relays that aren't up for long enough to overflow the tick counter. Otherwise, overflow would be very difficult to test.

@tor-bot tor-bot merged commit 9abf541 into torproject:master May 1, 2018
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment