30 #ifndef TRACELIB_UTILS_H
31 #define TRACELIB_UTILS_H
42 if (lstat(path, &statb) == -1) {
46 if (S_ISDIR(statb.st_mode)) {
59 if (mkdir(path, S_IRWXU) < 0) {
61 printf(
"Failed to make directory : %s \n", path);
76 if (lstat(path, &statb) == -1) {
91 if ( !haystack || !needle )
94 while ( (*haystack !=
'\0') && (*needle !=
'\0') ) {
95 if ( *haystack != *needle )
102 if ( *haystack != *needle )
115 while (*number !=
'\0' ) {
116 if ( (*number < 48 || 57 < *number) && ( *number !=
'.') )
135 while (*tmp !=
'\0') {
137 if (*tmp !=
'#' && *tmp !=
' ')
155 return (sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE) );
164 int core_count = sysconf(_SC_NPROCESSORS_CONF);
183 while( val[len - 1] ==
' ' )
static char * my_pad(char *val)
Removes starting and ending spaces from a string.
static int MALP_Trace_file_exists(const char *path)
Checks if a file exists.
static void MALP_Trace_try_mkdir(char *path)
Creates a directory without failing if it already exists.
static int MALP_Trace_check_dir(const char *path)
Checks if a path is a directory.
static int MALP_Trace_line_begins_with_sharp(char *line)
Checks if the first not space char of a string is a #.
static uint64_t MALP_Trace_mem_per_core()
Getter on the per core memory on the current node.
static int MALP_Trace_is_numeric(char *number)
Checks if a string contains a numerical element.
static int MALP_Trace_fast_strcmp(char *haystack, char *needle)
Fast string comparison.
static uint64_t MALP_Trace_total_mem()
Getter on the total amount of memory available on current node.