#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_pool * | main_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 |
|
static |
Definition at line 240 of file tw-util.c.
Referenced by pool_alloc().
|
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().
void* tw_calloc | ( | const char * | file, |
int | line, | ||
const char * | for_who, | ||
size_t | e_sz, | ||
size_t | n | ||
) |
Definition at line 203 of file tw-util.c.
References pool_alloc(), and tw_error().
Referenced by analysis_init(), create_buddy_table(), init_output_messages(), init_q(), rng_init(), st_buffer_allocate(), st_buffer_init(), tw_define_lps(), tw_delta_alloc(), tw_eventq_alloc(), tw_hash_create(), tw_init_kps(), tw_init_lps(), tw_kp_onpe(), tw_lp_onpe(), tw_pe_init(), tw_pq_create(), and tw_rand_init_streams().
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().
void tw_error | ( | const char * | file, |
int | line, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 74 of file tw-util.c.
References g_tw_mynode, and tw_net_abort().
Referenced by analysis_init(), apply_opt(), avl_alloc(), avlDelete(), avlInsert(), buddy_alloc(), early_sanity_check(), event_cancel(), io_event_deserialize(), io_load_events(), late_sanity_check(), main(), map_linear(), phold_event_handler(), phold_pre_run(), recv_begin(), recv_finish(), rng_gen_reverse_val(), send_begin(), send_finish(), setup_pes(), st_collect_engine_data_kps(), st_collect_engine_data_lps(), test_q(), tw_calloc(), tw_define_lps(), tw_event_new(), tw_event_send(), tw_eventq_debug(), tw_getkp(), tw_getlocal_lp(), tw_getlp(), tw_gvt_step2(), tw_hash_create(), tw_hash_remove(), tw_init(), tw_init_lps(), tw_kp_onpe(), tw_kp_rollback_event(), tw_lp_onkp(), tw_lp_onpe(), tw_lp_settype(), tw_lp_setup_types(), tw_lp_suspend(), tw_net_barrier(), tw_net_cancel(), tw_net_init(), tw_net_start(), tw_net_statistics(), tw_net_stop(), tw_opt_parse(), tw_pe_init(), tw_pe_settype(), tw_pq_compare_less_than(), tw_pq_delete_any(), tw_pre_run_lps(), tw_rand_init_streams(), tw_rand_normal01(), tw_run(), tw_sched_batch(), tw_sched_batch_realtime(), tw_sched_cancel_q(), tw_sched_event_q(), tw_scheduler_conservative(), tw_scheduler_optimistic_debug(), tw_scheduler_sequential(), tw_snapshot_delta(), tw_snapshot_restore(), and tw_wall_now().
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().
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().
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().
|
static |
Definition at line 110 of file tw-util.c.
Referenced by pool_alloc().
|
static |
|
static |
Definition at line 113 of file tw-util.c.
Referenced by pool_alloc().
|
static |
Definition at line 115 of file tw-util.c.
Referenced by tw_calloc_stats().