The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
dymelor.c File Reference

Dynamic Memory Logger and Restorer (DyMeLoR) More...

#include <core/init.h>
#include <mm/mm.h>
#include <scheduler/scheduler.h>
+ Include dependency graph for dymelor.c:

Go to the source code of this file.

Functions

static void malloc_area_init (malloc_area *m_area, size_t size, int num_chunks)
 
malloc_statemalloc_state_init (void)
 
void malloc_state_wipe (malloc_state **state_ptr)
 
static size_t compute_size (size_t size)
 
static void find_next_free (malloc_area *m_area)
 
void * do_malloc (struct lp_struct *lp, size_t size)
 
void do_free (struct lp_struct *lp, void *ptr)
 
void dirty_mem (void *base, int size)
 
size_t get_log_size (malloc_state *logged_state)
 
void * __wrap_malloc (size_t size)
 
void __wrap_free (void *ptr)
 
void * __wrap_realloc (void *ptr, size_t size)
 
void * __wrap_calloc (size_t nmemb, size_t size)
 
void clean_buffers_on_gvt (struct lp_struct *lp, simtime_t time_barrier)
 

Detailed Description

Dynamic Memory Logger and Restorer (DyMeLoR)

LP's memory manager.

This file is part of ROOT-Sim (ROme OpTimistic Simulator).

ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.

ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Author
Roberto Toccaceli
Alessandro Pellegrini
Roberto Vitali
Francesco Quaglia
Date
April 02, 2008

Definition in file dymelor.c.

Function Documentation

void* __wrap_calloc ( size_t  nmemb,
size_t  size 
)

This is the wrapper of the real stdlib calloc(). Whenever the application level software calls calloc, the call is redirected to this piece of code which relies on wrap_malloc

Author
Roberto Vitali
Parameters
nmembThe number of elements to be allocated
sizeThe size of each allocated member
Returns
A pointer to the newly allocated buffer

Definition at line 677 of file dymelor.c.

+ Here is the call graph for this function:

void __wrap_free ( void *  ptr)

This is the wrapper of the real stdlib free(). Whenever the application level software calls free, the call is redirected to this piece of code which will set the chunk in the corresponding malloc_area as not allocated.

For further information, please see the paper: R. Toccaceli, F. Quaglia DyMeLoR: Dynamic Memory Logger and Restorer Library for Optimistic Simulation Objects with Generic Memory Layout Proceedings of the 22nd Workshop on Principles of Advanced and Distributed Simulation 2008

Author
Roberto Toccaceli
Francesco Quaglia
Parameters
ptrA memory buffer to be free'd

Definition at line 602 of file dymelor.c.

+ Here is the caller graph for this function:

void* __wrap_malloc ( size_t  size)

This is the wrapper of the real stdlib malloc(). Whenever the application level software calls malloc, the call is redirected to this piece of code which uses the memory preallocated by the DyMeLoR subsystem for serving the request. If the memory in the malloc_area is exhausted, a new one is created, relying on the stdlib malloc. In future releases, this wrapper will be integrated with the Memory Management subsystem, which is not yet ready for production.

Author
Roberto Toccaceli
Francesco Quaglia
Parameters
sizeSize of the allocation
Returns
A pointer to the allocated memory

Definition at line 566 of file dymelor.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* __wrap_realloc ( void *  ptr,
size_t  size 
)

This is the wrapper of the real stdlib realloc(). Whenever the application level software calls realloc, the call is redirected to this piece of code which rely on wrap_malloc

Author
Roberto Vitali
Parameters
ptrThe pointer to be buffer to be reallocated
sizeThe size of the allocation
Returns
A pointer to the newly allocated buffer

Definition at line 628 of file dymelor.c.

+ Here is the call graph for this function:

static size_t compute_size ( size_t  size)
static

This function corrects a size value. It changes the given value to the immediately greater power of two

Author
Alessandro Pellegrini
Roberto Vitali
Parameters
sizeThe size to correct
Returns
The new size

Definition at line 136 of file dymelor.c.

+ Here is the caller graph for this function:

void dirty_mem ( void *  base,
int  size 
)

This function marks a memory chunk as dirty. It is invoked from assembly modules invoked by calls injected by the instrumentor, and from the third-party library wrapper. Invocations from other parts of the kernel should be handled with great care.

Author
Alessandro Pellegrini
Roberto Vitali
Parameters
baseThe initial to the start address of the update
sizeThe number of bytes being updated

Definition at line 453 of file dymelor.c.

void* do_malloc ( struct lp_struct lp,
size_t  size 
)

Definition at line 172 of file dymelor.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void find_next_free ( malloc_area m_area)
static

Find the smallest idx associated with a free chunk in a given malloc_area. This function tries to keep the chunks clustered in the beginning of the malloc_area, so to enchance locality

Author
Roberto Toccaceli
Francesco Quaglia
Parameters
m_areaThe malloc_area to scan in order to find the next available chunk

Definition at line 159 of file dymelor.c.

+ Here is the caller graph for this function:

size_t get_log_size ( malloc_state logged_state)

This function returns the whole size of a state. It can be used as the total size to pack a log

Author
Alessandro Pellegrini
Roberto Vitali
Parameters
logged_stateThe pointer to the log, or to the state
Returns
The whole size of the state (metadata included)

Definition at line 534 of file dymelor.c.

+ Here is the caller graph for this function:

static void malloc_area_init ( malloc_area m_area,
size_t  size,
int  num_chunks 
)
static

This function inizializes a malloc_area

Author
Roberto Toccaceli
Francesco Quaglia
Alessandro Pellegrini
Parameters
m_areaThe pointer to the malloc_area to initialize
sizeThe chunks' size of the malloc_area
num_chunksThe number of chunk of the new malloc_area

Definition at line 49 of file dymelor.c.

+ Here is the caller graph for this function:

malloc_state* malloc_state_init ( void  )

This function inizializes a malloc_state.

Definition at line 77 of file dymelor.c.

+ Here is the call graph for this function: