36#include <boost/timer/timer.hpp>
37#include <boost/uuid/uuid.hpp>
38#include <boost/uuid/random_generator.hpp>
48 template<
typename val,
int default_base>
121#ifdef WINDOWS_PLATFORM
126 class timing_guard_base
129 virtual ~timing_guard_base(){};
133 class timing_guard:
public timing_guard_base
136 timing_guard(
T& avrg):m_avrg(avrg)
138 m_start_ticks = ::GetTickCount();
143 m_avrg.push(::GetTickCount()-m_start_ticks);
151 template<
class t_timing>
152 timing_guard_base* create_timing_guard(t_timing& timing){
return new timing_guard<t_timing>(timing);}
154#define BEGIN_TIMING_ZONE(timing_var) { boost::shared_ptr<math_helper::timing_guard_base> local_timing_guard_ptr(math_helper::create_timing_guard(timing_var));
155#define END_TIMING_ZONE() }
159 template<u
int64_t default_time_window>
183 for(
size_t s = 0;
s != count;
s++)
200 std::list<uint64_t>::iterator it =
m_chicks.begin();
219 template<
class tlist>
222 for(
typename tlist::iterator it = t_list.begin();it!=t_list.end();it++)
224 size_t offset = rand()%t_list.size();
225 typename tlist::iterator it_2 = t_list.begin();
226 for(
size_t local_offset = 0;local_offset!=offset;local_offset++)
230 std::swap(*it_2, *it);
234 template<
typename get_
interval,
bool start_immediate = true>
241 GetSystemTimeAsFileTime(&fileTime);
242 unsigned __int64 present = 0;
243 present |= fileTime.dwHighDateTime;
244 present = present << 32;
245 present |= fileTime.dwLowDateTime;
250 gettimeofday(&tv, NULL);
251 return tv.tv_sec * 1000000 + tv.tv_usec;
274 template<
class functor_t>
296 template<
int default_
interval,
bool start_immediate = true>
298 template<
int default_
interval,
bool start_immediate = true>
300 template<
typename get_
interval,
bool start_immediate = true>
#define s(x, c)
Definition aesb.c:47
double get_avg()
Definition math_helper.h:93
average()
Definition math_helper.h:53
bool set_base()
Definition math_helper.h:59
std::list< value_type > m_list
Definition math_helper.h:116
double m_last_avg_val
Definition math_helper.h:115
val value_type
Definition math_helper.h:70
double update(const value_type &vl)
Definition math_helper.h:83
unsigned int m_base
Definition math_helper.h:114
critical_section m_lock
Definition math_helper.h:117
void push(const value_type &vl)
Definition math_helper.h:72
value_type get_last_val()
Definition math_helper.h:104
Definition math_helper.h:299
Definition math_helper.h:301
Definition math_helper.h:297
uint64_t m_interval
Definition math_helper.h:291
once_a_time()
Definition math_helper.h:261
void trigger()
Definition math_helper.h:269
void set_next_interval()
Definition math_helper.h:255
bool do_call(functor_t functr)
Definition math_helper.h:275
uint64_t get_time() const
Definition math_helper.h:237
uint64_t m_last_worked_time
Definition math_helper.h:290
critical_section m_lock
Definition math_helper.h:215
bool chick()
Definition math_helper.h:169
size_t m_last_speed_value
Definition math_helper.h:214
speed()
Definition math_helper.h:164
std::list< uint64_t > m_chicks
Definition math_helper.h:212
bool flush(uint64_t ticks)
Definition math_helper.h:197
uint64_t m_time_window
Definition math_helper.h:213
size_t get_speed()
Definition math_helper.h:190
bool chick(size_t count)
Definition math_helper.h:181
const char * res
Definition hmac_keccak.cpp:42
Definition math_helper.h:46
void randomize_list(tlist &t_list)
Definition math_helper.h:220
uint64_t get_tick_count()
Definition time_helper.h:82
TODO: (mj-xmr) This will be reduced in an another PR.
Definition byte_slice.h:40
unsigned __int64 uint64_t
Definition stdint.h:136
Definition math_helper.h:294
uint64_t operator()() const
Definition math_helper.h:294
#define CRITICAL_REGION_LOCAL(x)
Definition syncobj.h:153
#define CRITICAL_REGION_END()
Definition syncobj.h:158
#define CRITICAL_REGION_BEGIN(x)
Definition syncobj.h:154