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>
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>
const char * res
Definition: hmac_keccak.cpp:42
Definition: math_helper.h:294
unsigned int m_base
Definition: math_helper.h:114
uint64_t m_interval
Definition: math_helper.h:291
const uint32_t T[512]
Definition: groestl_tables.h:36
void randomize_list(tlist &t_list)
Definition: math_helper.h:220
uint64_t get_tick_count()
Definition: time_helper.h:82
int * count
Definition: gmock_stress_test.cc:176
Definition: math_helper.h:235
critical_section m_lock
Definition: math_helper.h:117
uint64_t operator()() const
Definition: math_helper.h:294
const char * s
Definition: minissdp.c:596
bool flush(uint64_t ticks)
Definition: math_helper.h:197
void push(const value_type &vl)
Definition: math_helper.h:72
once_a_time()
Definition: math_helper.h:261
#define CRITICAL_REGION_END()
Definition: syncobj.h:158
size_t m_last_speed_value
Definition: math_helper.h:214
critical_section m_lock
Definition: math_helper.h:215
void trigger()
Definition: math_helper.h:269
void rand(size_t N, uint8_t *bytes)
Definition: crypto.h:167
value_type get_last_val()
Definition: math_helper.h:104
bool do_call(functor_t functr)
Definition: math_helper.h:275
#define CRITICAL_REGION_BEGIN(x)
Definition: syncobj.h:154
val value_type
Definition: math_helper.h:70
unsigned __int64 uint64_t
Definition: stdint.h:136
#define CRITICAL_REGION_LOCAL(x)
Definition: syncobj.h:153
uint64_t m_time_window
Definition: math_helper.h:213
void set_next_interval()
Definition: math_helper.h:255
TODO: (mj-xmr) This will be reduced in an another PR.
Definition: byte_slice.h:39
double get_avg()
Definition: math_helper.h:93
uint64_t get_time() const
Definition: math_helper.h:237
Definition: math_helper.h:299
bool chick(size_t count)
Definition: math_helper.h:181
average()
Definition: math_helper.h:53
uint64_t m_last_worked_time
Definition: math_helper.h:290
std::list< uint64_t > m_chicks
Definition: math_helper.h:212
Definition: math_helper.h:49
bool chick()
Definition: math_helper.h:169
Definition: math_helper.h:297
double m_last_avg_val
Definition: math_helper.h:115
Definition: math_helper.h:301
double update(const value_type &vl)
Definition: math_helper.h:83
std::list< value_type > m_list
Definition: math_helper.h:116
size_t get_speed()
Definition: math_helper.h:190
speed()
Definition: math_helper.h:164
bool set_base()
Definition: math_helper.h:59