#include <pfunc/config.h>
#include <pfunc/environ.hpp>
#include <stdlib.h>
#include <sys/time.h>
Go to the source code of this file.
Function Documentation
static int get_closest_power_of_2 |
( |
const int |
n | ) |
[inline, static] |
Returns the next highest power of two for the given number.
- Parameters:
-
[in] | n | The number for which we want to find the next closest power. |
- Returns:
- The power of 2 closest to 'n'. E.g., for 3, 4 is returned.
static double get_next_rand |
( |
| ) |
[inline, static] |
static PFUNC_INLINE double micro_time |
( |
| ) |
[static] |
Returns the time in seconds (as a double) to micro-second accuracy. This function can be used to measure the time elapsed. Eg., start = micro_time (); do_stuff (); end = micro_time () - start;
Use gettimeofday() to return the time in milliseconds
Variable Documentation
const double NORMALIZER = static_cast<double>(RAND_MAX) [static] |
All the utility functions are in the C domain on purpose. Its a lot simpler to use this way and we do not need a wrapper from C++. Returns a random double in the range (0.0,1.0]. Notice that the random number generator is never initialized --- we don't really care about :).
- Returns:
- random double in the range (0.0,1.0].