HPCToolkit
data-overrides.c File Reference
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
#include <ucontext.h>
#include <stdlib.h>
#include <malloc.h>
#include <unistd.h>
#include <sys/mman.h>
#include <messages/messages.h>
#include <safe-sampling.h>
#include <sample_event.h>
#include <monitor-exts/monitor_ext.h>
#include <sample-sources/datacentric/datacentric.h>
#include "data_tree.h"
#include "data-overrides.h"
#include <utilities/arch/inline-asm-gctxt.h>
#include <utilities/arch/mcontext.h>
Include dependency graph for data-overrides.c:

Go to the source code of this file.

Macros

#define __USE_XOPEN_EXTENDED
 
#define _XOPEN_SOURCE   600
 
#define NUM_DATA_METRICS   2
 
#define DATACENTRIC_USE_HYBRID_LAYOUT   0
 
#define DATACENTRIC_MAGIC   0x68706374
 
#define DATACENTRIC_DEFAULT_PAGESIZE   4096
 
#define HPCRUN_DATACENTRIC_PROB   "HPCRUN_DATACENTRIC_PROB"
 
#define DEFAULT_PROB   0.1
 
#define real_memalign   __libc_memalign
 
#define real_valloc   __libc_valloc
 
#define real_malloc   __libc_malloc
 
#define real_free   __libc_free
 
#define real_realloc   __libc_realloc
 

Typedefs

typedef void * memalign_fcn(size_t, size_t)
 
typedef void * valloc_fcn(size_t)
 
typedef void * malloc_fcn(size_t)
 
typedef void free_fcn(void *)
 
typedef void * realloc_fcn(void *, size_t)
 

Enumerations

enum  { DATACENTRIC_LOC_HEAD = 1, DATACENTRIC_LOC_FOOT, DATACENTRIC_LOC_NONE }
 
enum  data_overrides_status_e { OVERRIDES_UNINITIALIZED =0, OVERRIDES_INITIALIZED, OVERRIDES_ACTIVE }
 

Functions

static float string_to_prob (char *str)
 
static bool is_initialized ()
 
static int is_active ()
 
static void metric_initialize ()
 
static void datacentric_initialize (void)
 
static int datacentric_get_malloc_loc (void *sys_ptr, size_t bytes, size_t align, void **appl_ptr, datatree_info_t **info_ptr)
 
static int datacentric_get_free_loc (void *appl_ptr, void **sys_ptr, datatree_info_t **info_ptr)
 
static void datacentric_add_leakinfo (const char *name, void *sys_ptr, void *appl_ptr, datatree_info_t *info_ptr, size_t bytes, ucontext_t *uc, int loc)
 
static void * datacentric_malloc_helper (const char *name, size_t bytes, size_t align, int clear, ucontext_t *uc, int *ret)
 
int MONITOR_EXT_WRAP_NAME() posix_memalign (void **memptr, size_t alignment, size_t bytes)
 
void *MONITOR_EXT_WRAP_NAME() memalign (size_t boundary, size_t bytes)
 
void *MONITOR_EXT_WRAP_NAME() valloc (size_t bytes)
 
void *MONITOR_EXT_WRAP_NAME() malloc (size_t bytes)
 
void *MONITOR_EXT_WRAP_NAME() calloc (size_t nmemb, size_t bytes)
 
void MONITOR_EXT_WRAP_NAME() free (void *ptr)
 
void *MONITOR_EXT_WRAP_NAME() realloc (void *ptr, size_t bytes)
 
int datacentric_get_metric_addr_end ()
 
int datacentric_get_metric_addr_start ()
 

Variables

memalign_fcn real_memalign
 
valloc_fcn real_valloc
 
malloc_fcn real_malloc
 
free_fcn real_free
 
realloc_fcn real_realloc
 
static enum data_overrides_status_e overrides_status = OVERRIDES_UNINITIALIZED
 
static int use_datacentric_prob = 0
 
static float datacentric_prob = 0.0
 
static long datacentric_pagesize = DATACENTRIC_DEFAULT_PAGESIZE
 
static char * loc_name [4]
 
static int datainfo_size = sizeof(struct datatree_info_s)
 
static int addr_end_metric_id = -1
 
static int addr_start_metric_id = -1
 
static const unsigned int MAX_CHAR_FORMULA = 32
 

Macro Definition Documentation

◆ __USE_XOPEN_EXTENDED

#define __USE_XOPEN_EXTENDED

Definition at line 59 of file data-overrides.c.

◆ _XOPEN_SOURCE

#define _XOPEN_SOURCE   600

Definition at line 72 of file data-overrides.c.

◆ DATACENTRIC_DEFAULT_PAGESIZE

#define DATACENTRIC_DEFAULT_PAGESIZE   4096

Definition at line 134 of file data-overrides.c.

◆ DATACENTRIC_MAGIC

#define DATACENTRIC_MAGIC   0x68706374

Definition at line 133 of file data-overrides.c.

◆ DATACENTRIC_USE_HYBRID_LAYOUT

#define DATACENTRIC_USE_HYBRID_LAYOUT   0

Definition at line 131 of file data-overrides.c.

◆ DEFAULT_PROB

#define DEFAULT_PROB   0.1

Definition at line 137 of file data-overrides.c.

◆ HPCRUN_DATACENTRIC_PROB

#define HPCRUN_DATACENTRIC_PROB   "HPCRUN_DATACENTRIC_PROB"

Definition at line 136 of file data-overrides.c.

◆ NUM_DATA_METRICS

#define NUM_DATA_METRICS   2

Definition at line 112 of file data-overrides.c.

◆ real_free

#define real_free   __libc_free

Definition at line 149 of file data-overrides.c.

◆ real_malloc

#define real_malloc   __libc_malloc

Definition at line 148 of file data-overrides.c.

◆ real_memalign

#define real_memalign   __libc_memalign

Definition at line 146 of file data-overrides.c.

◆ real_realloc

#define real_realloc   __libc_realloc

Definition at line 150 of file data-overrides.c.

◆ real_valloc

#define real_valloc   __libc_valloc

Definition at line 147 of file data-overrides.c.

Typedef Documentation

◆ free_fcn

typedef void free_fcn(void *)

Definition at line 122 of file data-overrides.c.

◆ malloc_fcn

typedef void* malloc_fcn(size_t)

Definition at line 121 of file data-overrides.c.

◆ memalign_fcn

typedef void* memalign_fcn(size_t, size_t)

Definition at line 119 of file data-overrides.c.

◆ realloc_fcn

typedef void* realloc_fcn(void *, size_t)

Definition at line 123 of file data-overrides.c.

◆ valloc_fcn

typedef void* valloc_fcn(size_t)

Definition at line 120 of file data-overrides.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DATACENTRIC_LOC_HEAD 
DATACENTRIC_LOC_FOOT 
DATACENTRIC_LOC_NONE 

Definition at line 160 of file data-overrides.c.

◆ data_overrides_status_e

Enumerator
OVERRIDES_UNINITIALIZED 
OVERRIDES_INITIALIZED 
OVERRIDES_ACTIVE 

Definition at line 166 of file data-overrides.c.

Function Documentation

◆ calloc()

void* MONITOR_EXT_WRAP_NAME() calloc ( size_t  nmemb,
size_t  bytes 
)

Definition at line 666 of file data-overrides.c.

Here is the call graph for this function:

◆ datacentric_add_leakinfo()

static void datacentric_add_leakinfo ( const char *  name,
void *  sys_ptr,
void *  appl_ptr,
datatree_info_t info_ptr,
size_t  bytes,
ucontext_t *  uc,
int  loc 
)
static

Definition at line 399 of file data-overrides.c.

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

◆ datacentric_get_free_loc()

static int datacentric_get_free_loc ( void *  appl_ptr,
void **  sys_ptr,
datatree_info_t **  info_ptr 
)
static

Definition at line 355 of file data-overrides.c.

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

◆ datacentric_get_malloc_loc()

static int datacentric_get_malloc_loc ( void *  sys_ptr,
size_t  bytes,
size_t  align,
void **  appl_ptr,
datatree_info_t **  info_ptr 
)
static

Definition at line 331 of file data-overrides.c.

Here is the caller graph for this function:

◆ datacentric_get_metric_addr_end()

int datacentric_get_metric_addr_end ( )

Definition at line 837 of file data-overrides.c.

Here is the caller graph for this function:

◆ datacentric_get_metric_addr_start()

int datacentric_get_metric_addr_start ( )

Definition at line 843 of file data-overrides.c.

Here is the caller graph for this function:

◆ datacentric_initialize()

static void datacentric_initialize ( void  )
static

initialize datacentric module

Definition at line 272 of file data-overrides.c.

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

◆ datacentric_malloc_helper()

static void* datacentric_malloc_helper ( const char *  name,
size_t  bytes,
size_t  align,
int  clear,
ucontext_t *  uc,
int *  ret 
)
static

Definition at line 482 of file data-overrides.c.

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

◆ free()

void MONITOR_EXT_WRAP_NAME() free ( void *  ptr)

Definition at line 699 of file data-overrides.c.

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

◆ is_active()

static int is_active ( )
static
Returns
true if the module was initialized, and active

Definition at line 231 of file data-overrides.c.

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

◆ is_initialized()

static bool is_initialized ( )
static
Returns
true if the module is initialized

Definition at line 221 of file data-overrides.c.

Here is the caller graph for this function:

◆ malloc()

void* MONITOR_EXT_WRAP_NAME() malloc ( size_t  bytes)

Definition at line 643 of file data-overrides.c.

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

◆ memalign()

void* MONITOR_EXT_WRAP_NAME() memalign ( size_t  boundary,
size_t  bytes 
)

Definition at line 597 of file data-overrides.c.

Here is the call graph for this function:

◆ metric_initialize()

static void metric_initialize ( )
static

initialize metrics if the initialization is successful, the module moves to active phase

Definition at line 244 of file data-overrides.c.

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

◆ posix_memalign()

int MONITOR_EXT_WRAP_NAME() posix_memalign ( void **  memptr,
size_t  alignment,
size_t  bytes 
)

Definition at line 572 of file data-overrides.c.

Here is the call graph for this function:

◆ realloc()

void* MONITOR_EXT_WRAP_NAME() realloc ( void *  ptr,
size_t  bytes 
)

Definition at line 735 of file data-overrides.c.

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

◆ string_to_prob()

static float string_to_prob ( char *  str)
static

Definition at line 197 of file data-overrides.c.

Here is the caller graph for this function:

◆ valloc()

void* MONITOR_EXT_WRAP_NAME() valloc ( size_t  bytes)

Definition at line 620 of file data-overrides.c.

Here is the call graph for this function:

Variable Documentation

◆ addr_end_metric_id

int addr_end_metric_id = -1
static

Definition at line 187 of file data-overrides.c.

◆ addr_start_metric_id

int addr_start_metric_id = -1
static

Definition at line 188 of file data-overrides.c.

◆ datacentric_pagesize

long datacentric_pagesize = DATACENTRIC_DEFAULT_PAGESIZE
static

Definition at line 179 of file data-overrides.c.

◆ datacentric_prob

float datacentric_prob = 0.0
static

Definition at line 177 of file data-overrides.c.

◆ datainfo_size

int datainfo_size = sizeof(struct datatree_info_s)
static

Definition at line 185 of file data-overrides.c.

◆ loc_name

char* loc_name[4]
static
Initial value:
= {
NULL, "header", "footer", "none"
}
#define NULL
Definition: ElfHelper.cpp:85

Definition at line 181 of file data-overrides.c.

◆ MAX_CHAR_FORMULA

const unsigned int MAX_CHAR_FORMULA = 32
static

Definition at line 237 of file data-overrides.c.

◆ overrides_status

enum data_overrides_status_e overrides_status = OVERRIDES_UNINITIALIZED
static

Definition at line 174 of file data-overrides.c.

◆ real_free

free_fcn real_free

◆ real_malloc

malloc_fcn real_malloc

◆ real_memalign

memalign_fcn real_memalign

◆ real_realloc

realloc_fcn real_realloc

◆ real_valloc

valloc_fcn real_valloc

◆ use_datacentric_prob

int use_datacentric_prob = 0
static

Definition at line 176 of file data-overrides.c.