HPCToolkit
mem.c File Reference
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "hpcrun-malloc.h"
#include "env.h"
#include "newmem.h"
#include "sample_event.h"
#include "thread_data.h"
#include <messages/messages.h>
Include dependency graph for mem.c:

Go to the source code of this file.

Macros

#define _IN_MEM_C   1
 
#define DEFAULT_MEMSIZE   (4 * 1024 * 1024)
 
#define MIN_LOW_MEMSIZE   (80 * 1024)
 
#define DEFAULT_PAGESIZE   4096
 

Functions

static size_t round_up (size_t size)
 
static size_t hpcrun_align_pagesize (size_t size)
 
static void hpcrun_mem_init (void)
 
static void * hpcrun_mmap_anon (size_t size)
 
void hpcrun_memory_reinit (void)
 
void hpcrun_make_memstore (hpcrun_meminfo_t *mi, int is_child)
 
void hpcrun_reclaim_freeable_mem (void)
 
void * hpcrun_malloc (size_t size)
 
void * hpcrun_malloc_freeable (size_t size)
 
void hpcrun_memory_summary (void)
 

Variables

static size_t memsize = DEFAULT_MEMSIZE
 
static size_t low_memsize = MIN_LOW_MEMSIZE
 
static size_t pagesize = DEFAULT_PAGESIZE
 
static int allow_extra_mmap = 1
 
static long num_segments = 0
 
static long total_allocation = 0
 
static long num_reclaims = 0
 
static long num_failures = 0
 
static long total_freeable = 0
 
static long total_non_freeable = 0
 
static int out_of_mem_mesg = 0
 

Macro Definition Documentation

◆ _IN_MEM_C

#define _IN_MEM_C   1

Definition at line 67 of file mem.c.

◆ DEFAULT_MEMSIZE

#define DEFAULT_MEMSIZE   (4 * 1024 * 1024)

Definition at line 78 of file mem.c.

◆ DEFAULT_PAGESIZE

#define DEFAULT_PAGESIZE   4096

Definition at line 80 of file mem.c.

◆ MIN_LOW_MEMSIZE

#define MIN_LOW_MEMSIZE   (80 * 1024)

Definition at line 79 of file mem.c.

Function Documentation

◆ hpcrun_align_pagesize()

static size_t hpcrun_align_pagesize ( size_t  size)
inlinestatic

Definition at line 107 of file mem.c.

Here is the caller graph for this function:

◆ hpcrun_make_memstore()

void hpcrun_make_memstore ( hpcrun_meminfo_t mi,
int  is_child 
)

Definition at line 224 of file mem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_malloc()

void* hpcrun_malloc ( size_t  size)

Definition at line 275 of file mem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_malloc_freeable()

void* hpcrun_malloc_freeable ( size_t  size)

Definition at line 351 of file mem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_mem_init()

static void hpcrun_mem_init ( void  )
static

Definition at line 114 of file mem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_memory_reinit()

void hpcrun_memory_reinit ( void  )

Definition at line 212 of file mem.c.

Here is the caller graph for this function:

◆ hpcrun_memory_summary()

void hpcrun_memory_summary ( void  )

Definition at line 387 of file mem.c.

Here is the caller graph for this function:

◆ hpcrun_mmap_anon()

static void* hpcrun_mmap_anon ( size_t  size)
static

Definition at line 156 of file mem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_reclaim_freeable_mem()

void hpcrun_reclaim_freeable_mem ( void  )

Definition at line 260 of file mem.c.

Here is the caller graph for this function:

◆ round_up()

static size_t round_up ( size_t  size)
inlinestatic

Definition at line 101 of file mem.c.

Here is the caller graph for this function:

Variable Documentation

◆ allow_extra_mmap

int allow_extra_mmap = 1
static

Definition at line 85 of file mem.c.

◆ low_memsize

size_t low_memsize = MIN_LOW_MEMSIZE
static

Definition at line 83 of file mem.c.

◆ memsize

size_t memsize = DEFAULT_MEMSIZE
static

Definition at line 82 of file mem.c.

◆ num_failures

long num_failures = 0
static

Definition at line 90 of file mem.c.

◆ num_reclaims

long num_reclaims = 0
static

Definition at line 89 of file mem.c.

◆ num_segments

long num_segments = 0
static

Definition at line 87 of file mem.c.

◆ out_of_mem_mesg

int out_of_mem_mesg = 0
static

Definition at line 94 of file mem.c.

◆ pagesize

size_t pagesize = DEFAULT_PAGESIZE
static

Definition at line 84 of file mem.c.

◆ total_allocation

long total_allocation = 0
static

Definition at line 88 of file mem.c.

◆ total_freeable

long total_freeable = 0
static

Definition at line 91 of file mem.c.

◆ total_non_freeable

long total_non_freeable = 0
static

Definition at line 92 of file mem.c.