Commit Graph

10 Commits

Author SHA1 Message Date
David Madl
3b63930943 move global Timer to Timer.h
Move ResetUserTime(), PrintUserTime(), GetUserTime() to Timer.h

Do not reset timer in StaticData.
2015-11-17 16:15:13 +00:00
Jeroen Vermeulen
eca5824100 Remove trailing whitespace in C++ files. 2015-04-30 12:05:11 +07:00
Jeroen Vermeulen
38d790cac0 Add cross-platform randomizer module.
The code uses two mechanisms for generating random numbers: srand()/rand(),
which is not thread-safe, and srandom()/random(), which is POSIX-specific.

Here I add a util/random.cc module that centralizes these calls, and unifies
some common usage patterns.  If the implementation is not good enough, we can
now change it in a single place.

To keep things simple, this uses the portable srand()/rand() but protects them
with a lock to avoid concurrency problems.

The hard part was to keep the regression tests passing: they rely on fixed
sequences of random numbers, so a small code change could break them very
thoroughly.  Util::rand(), for wide types like size_t, calls std::rand() not
once but twice.  This behaviour was generalized into utils::wide_rand() and
friends.
2015-04-23 23:46:04 +07:00
Jeroen Vermeulen
4c59b350df Modernize "C" includes in contrib.
This is one of those little chores in managing a long-lived C++
project: standard C headers like stdio.h and math.h now have their own
place in the C++ standard as resp. cstdio, cmath, and so on.  In this
branch the #include names are updated for the contrib/ subdirectory.

C++11 adds cstdint, but to support compilation with the previous
standard, that change is left for later.
2015-03-28 20:58:46 +07:00
Kenneth Heafield
9af5c12aa2 Eradicating CHECK 2014-01-02 11:34:04 -05:00
wlin12
f92d63c9a2 input type bug fix 2012-10-02 18:54:51 +01:00
Kenneth Heafield
15b0ae1aef Single-threaded compilation fixes 2012-09-21 18:34:48 -04:00
wlin12
dca9d8952d added some more documentation 2012-09-07 18:41:25 +01:00
wlin12
d3e19c4fb2 adding the code for relative entropy pruning to contrib/relent-filter 2012-09-07 17:35:58 +01:00
wlin12
6202c7cc60 adding the code for relative entropy pruning to contrib/relent-filter 2012-09-07 17:33:44 +01:00