ROSS
Data Structures | Functions | Variables
tw-util.c File Reference
#include <ross.h>

Go to the source code of this file.

Data Structures

struct  mem_pool
 

Functions

int tw_output (tw_lp *lp, const char *fmt,...)
 
void tw_printf (const char *file, int line, const char *fmt,...)
 
void tw_error (const char *file, int line, const char *fmt,...)
 
void tw_warning (const char *file, int line, const char *fmt,...)
 
static void * my_malloc (size_t len)
 
void tw_calloc_stats (size_t *bytes_alloc, size_t *bytes_wasted)
 
static void * pool_alloc (size_t len)
 
void * tw_calloc (const char *file, int line, const char *for_who, size_t e_sz, size_t n)
 

Variables

static struct mem_poolmain_pool
 
static const size_t pool_size = (512 * 1024) - 32
 
static const size_t pool_align = (( sizeof(double) ) > ( sizeof(void*) ) ? ( sizeof(double) ) : ( sizeof(void*) ))
 
static size_t total_allocated
 
static unsigned malloc_calls
 

Function Documentation

static void * my_malloc ( size_t  len)
static

Definition at line 240 of file tw-util.c.

Referenced by pool_alloc().

Here is the caller graph for this function:

static void* pool_alloc ( size_t  len)
static

Definition at line 160 of file tw-util.c.

References mem_pool::end_free, main_pool, my_malloc(), mem_pool::next_free, mem_pool::next_pool, and pool_size.

Referenced by tw_calloc().

Here is the call graph for this function:

Here is the caller graph for this function:

void* tw_calloc ( const char *  file,
int  line,
const char *  for_who,
size_t  e_sz,
size_t  n 
)
void tw_calloc_stats ( size_t *  bytes_alloc,
size_t *  bytes_wasted 
)

Definition at line 120 of file tw-util.c.

References mem_pool::end_free, mem_pool::next_free, mem_pool::next_pool, and total_allocated.

Referenced by tw_stats().

Here is the caller graph for this function:

void tw_error ( const char *  file,
int  line,
const char *  fmt,
  ... 
)
int tw_output ( tw_lp lp,
const char *  fmt,
  ... 
)

Rollback-aware printf, i.e. if the event gets rolled back, undo the printf. We can'd do that of course so we store the message in a buffer until GVT.

Definition at line 8 of file tw-util.c.

References CONSERVATIVE, tw_pe::cur_event, g_tw_synchronization_protocol, tw_kp::id, tw_lp::kp, tw_out::message, tw_out::next, tw_event::out_msgs, tw_lp::pe, SEQUENTIAL, tw_kp_grab_output_buffer(), TW_LOC, and tw_printf().

Here is the call graph for this function:

void tw_printf ( const char *  file,
int  line,
const char *  fmt,
  ... 
)

Definition at line 61 of file tw-util.c.

Referenced by avlInsert(), buddy_free(), early_sanity_check(), and tw_output().

Here is the caller graph for this function:

void tw_warning ( const char *  file,
int  line,
const char *  fmt,
  ... 
)

Definition at line 90 of file tw-util.c.

References g_tw_mynode.

Referenced by apply_opt().

Here is the caller graph for this function:

Variable Documentation

struct mem_pool* main_pool
static

Definition at line 110 of file tw-util.c.

Referenced by pool_alloc().

unsigned malloc_calls
static

Definition at line 116 of file tw-util.c.

const size_t pool_align = (( sizeof(double) ) > ( sizeof(void*) ) ? ( sizeof(double) ) : ( sizeof(void*) ))
static

Definition at line 114 of file tw-util.c.

const size_t pool_size = (512 * 1024) - 32
static

Definition at line 113 of file tw-util.c.

Referenced by pool_alloc().

size_t total_allocated
static

Definition at line 115 of file tw-util.c.

Referenced by tw_calloc_stats().