Derecho  0.9
Distributed systems toolkit for RDMA
Classes | Macros | Functions | Variables
util.hpp File Reference
#include <derecho/utils/time.h>
#include <cstdlib>
#include <map>
#include <mutex>
#include <string>
#include <vector>
Include dependency graph for util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  event
 

Macros

#define TRACE(x)
 
#define DERECHO_LOG(sender, message_number, event_name)
 
#define LOG_EVENT(group_number, message_number, block_number, event_name)
 

Functions

template<class T , class U >
size_t index_of (T container, U elem)
 
bool file_exists (const std::string &name)
 
void create_directory (const std::string &name)
 
double compute_data_rate (size_t numBytes, uint64_t sTime, uint64_t eTime)
 
void put_flush (const char *str)
 
void reset_epoch ()
 
void query_peer_addresses (std::map< uint32_t, std::string > &addresses, uint32_t &node_rank)
 
double compute_mean (std::vector< double > v)
 
double compute_stddev (std::vector< double > v)
 
void log_event (const char *file, int line, uint32_t group_number, size_t message_number, size_t block_number, const char *event_name)
 
void flush_events ()
 
void start_flush_server ()
 
void CHECK (bool b)
 

Variables

std::vector< eventevents
 
std::mutex events_mutex
 

Class Documentation

◆ event

struct event

Definition at line 38 of file util.hpp.

Class Members
size_t block_number
const char * event_name
const char * file
uint32_t group_number
int line
size_t message_number
uint64_t time

Macro Definition Documentation

◆ DERECHO_LOG

#define DERECHO_LOG (   sender,
  message_number,
  event_name 
)
Value:
do { \
log_event(__FILE__, __LINE__, sender, message_number, -1, event_name); \
} while(0)

Definition at line 59 of file util.hpp.

◆ LOG_EVENT

#define LOG_EVENT (   group_number,
  message_number,
  block_number,
  event_name 
)
Value:
do { \
} while(0)

Definition at line 64 of file util.hpp.

◆ TRACE

#define TRACE (   x)
Value:
do { \
put_flush(x); \
} while(0)

Definition at line 33 of file util.hpp.

Function Documentation

◆ CHECK()

void CHECK ( bool  b)
inline

Definition at line 68 of file util.hpp.

◆ compute_data_rate()

double compute_data_rate ( size_t  numBytes,
uint64_t  sTime,
uint64_t  eTime 
)

Definition at line 44 of file util.cpp.

◆ compute_mean()

double compute_mean ( std::vector< double >  v)

Definition at line 108 of file util.cpp.

◆ compute_stddev()

double compute_stddev ( std::vector< double >  v)

Definition at line 112 of file util.cpp.

◆ create_directory()

void create_directory ( const std::string &  name)

Definition at line 39 of file util.cpp.

◆ file_exists()

bool file_exists ( const std::string &  name)

Definition at line 34 of file util.cpp.

◆ flush_events()

void flush_events ( )

Definition at line 130 of file util.cpp.

◆ index_of()

template<class T , class U >
size_t index_of ( container,
elem 
)

Definition at line 13 of file util.hpp.

◆ log_event()

void log_event ( const char *  file,
int  line,
uint32_t  group_number,
size_t  message_number,
size_t  block_number,
const char *  event_name 
)
inline

Definition at line 50 of file util.hpp.

◆ put_flush()

void put_flush ( const char *  str)

Definition at line 47 of file util.cpp.

◆ query_peer_addresses()

void query_peer_addresses ( std::map< uint32_t, std::string > &  addresses,
uint32_t &  node_rank 
)

Definition at line 85 of file util.cpp.

◆ reset_epoch()

void reset_epoch ( )

Definition at line 102 of file util.cpp.

◆ start_flush_server()

void start_flush_server ( )

Definition at line 120 of file util.cpp.

Variable Documentation

◆ events

std::vector<event> events

Definition at line 118 of file util.cpp.

◆ events_mutex

std::mutex events_mutex

Definition at line 119 of file util.cpp.