Commit bdb2a5f0 authored by Shane Snyder's avatar Shane Snyder

runtime now mmaps header and job data to tmp log

parent 799d9890
...@@ -77,6 +77,7 @@ static char * const darshan_module_names[] = ...@@ -77,6 +77,7 @@ static char * const darshan_module_names[] =
/* compression method used on darshan log file */ /* compression method used on darshan log file */
enum darshan_comp_type enum darshan_comp_type
{ {
DARSHAN_NO_COMP,
DARSHAN_ZLIB_COMP, DARSHAN_ZLIB_COMP,
DARSHAN_BZIP2_COMP, DARSHAN_BZIP2_COMP,
}; };
......
all: lib/libdarshan.a lib/libdarshan-stubs.a lib/darshan-null.o all: lib/libdarshan.a lib/libdarshan-stubs.a
#TODO: lib/darshan-null.o
#TODO: each module provides own makefile with module-specific objects, build options, etc. #TODO: each module provides own makefile with module-specific objects, build options, etc.
......
...@@ -42,17 +42,16 @@ ...@@ -42,17 +42,16 @@
/* in memory structure to keep up with job level data */ /* in memory structure to keep up with job level data */
struct darshan_core_runtime struct darshan_core_runtime
{ {
/* XXX-MMAP */ struct darshan_header *log_hdr_p;
struct darshan_job *log_job_p;
char *log_exemnt_p;
/* XXX: MMAP */
void *mmap_p; void *mmap_p;
struct darshan_job *mmap_job_p;
char *mmap_exe_mnt_p;
void *mmap_mod_p;
/* XXX-MMAP */
struct darshan_core_record_ref *rec_hash; struct darshan_core_record_ref *rec_hash;
int rec_count; int rec_count;
struct darshan_core_module* mod_array[DARSHAN_MAX_MODS]; struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
char comp_buf[DARSHAN_COMP_BUF_SIZE]; char comp_buf[DARSHAN_COMP_BUF_SIZE]; /* TODO: why is this allocated statically? */
double wtime_offset; double wtime_offset;
}; };
......
...@@ -98,10 +98,9 @@ struct darshan_module_funcs ...@@ -98,10 +98,9 @@ struct darshan_module_funcs
void darshan_core_register_module( void darshan_core_register_module(
darshan_module_id mod_id, darshan_module_id mod_id,
struct darshan_module_funcs *funcs, struct darshan_module_funcs *funcs,
void **mod_buf,
int *mod_buf_size,
int *my_rank, int *my_rank,
int *mod_mem_limit,
void **mmap_buf,
int *mmap_buf_size,
int *sys_mem_alignment); int *sys_mem_alignment);
/* darshan_core_unregister_module() /* darshan_core_unregister_module()
......
This diff is collapsed.
...@@ -177,8 +177,6 @@ struct posix_runtime ...@@ -177,8 +177,6 @@ struct posix_runtime
int file_array_ndx; int file_array_ndx;
struct posix_file_runtime* file_hash; struct posix_file_runtime* file_hash;
struct posix_file_runtime_ref* fd_hash; struct posix_file_runtime_ref* fd_hash;
struct posix_file_runtime agg_file_runtime;
}; };
static struct posix_runtime *posix_runtime = NULL; static struct posix_runtime *posix_runtime = NULL;
...@@ -1625,9 +1623,8 @@ static void posix_runtime_initialize() ...@@ -1625,9 +1623,8 @@ static void posix_runtime_initialize()
.get_output_data = &posix_get_output_data, .get_output_data = &posix_get_output_data,
.shutdown = &posix_shutdown .shutdown = &posix_shutdown
}; };
int mem_limit; void *psx_buf;
void *mmap_buf; int psx_buf_size;
int mmap_buf_size;
/* don't do anything if already initialized or instrumenation is disabled */ /* don't do anything if already initialized or instrumenation is disabled */
if(posix_runtime || instrumentation_disabled) if(posix_runtime || instrumentation_disabled)
...@@ -1637,14 +1634,13 @@ static void posix_runtime_initialize() ...@@ -1637,14 +1634,13 @@ static void posix_runtime_initialize()
darshan_core_register_module( darshan_core_register_module(
DARSHAN_POSIX_MOD, DARSHAN_POSIX_MOD,
&posix_mod_fns, &posix_mod_fns,
&psx_buf,
&psx_buf_size,
&my_rank, &my_rank,
&mem_limit,
&mmap_buf,
&mmap_buf_size,
&darshan_mem_alignment); &darshan_mem_alignment);
/* return if no memory assigned by darshan core */ /* return if no memory assigned by darshan-core */
if(mem_limit == 0) if(psx_buf_size == 0)
return; return;
posix_runtime = malloc(sizeof(*posix_runtime)); posix_runtime = malloc(sizeof(*posix_runtime));
...@@ -1654,35 +1650,22 @@ static void posix_runtime_initialize() ...@@ -1654,35 +1650,22 @@ static void posix_runtime_initialize()
/* set maximum number of file records according to max memory limit */ /* set maximum number of file records according to max memory limit */
/* NOTE: maximum number of records is based on the size of a posix file record */ /* NOTE: maximum number of records is based on the size of a posix file record */
/* TODO: should we base memory usage off file record or total runtime structure sizes? */ posix_runtime->file_array_size = psx_buf_size / sizeof(struct darshan_posix_file);
posix_runtime->file_array_size = mem_limit / sizeof(struct darshan_posix_file);
posix_runtime->file_array_ndx = 0; posix_runtime->file_array_ndx = 0;
/* allocate array of runtime file records */ /* allocate array of runtime file records */
posix_runtime->file_runtime_array = malloc(posix_runtime->file_array_size * posix_runtime->file_runtime_array = malloc(posix_runtime->file_array_size *
sizeof(struct posix_file_runtime)); sizeof(struct posix_file_runtime));
posix_runtime->file_record_array = malloc(posix_runtime->file_array_size * if(!posix_runtime->file_runtime_array)
sizeof(struct darshan_posix_file));
if(!posix_runtime->file_runtime_array || !posix_runtime->file_record_array)
{ {
posix_runtime->file_array_size = 0; posix_runtime->file_array_size = 0;
return; return;
} }
memset(posix_runtime->file_runtime_array, 0, posix_runtime->file_array_size * memset(posix_runtime->file_runtime_array, 0, posix_runtime->file_array_size *
sizeof(struct posix_file_runtime)); sizeof(struct posix_file_runtime));
memset(posix_runtime->file_record_array, 0, posix_runtime->file_array_size *
sizeof(struct darshan_posix_file));
/* XXX-MMAP */ /* store pointer to POSIX record buffer given by darshan-core */
if(mmap_buf_size >= sizeof(struct darshan_posix_file)) posix_runtime->file_record_array = (struct darshan_posix_file *)psx_buf;
{
memset(&(posix_runtime->agg_file_runtime), 0,
sizeof(struct posix_file_runtime));
posix_runtime->agg_file_runtime.file_record =
(struct darshan_posix_file *)mmap_buf;
posix_runtime->agg_file_runtime.file_record->f_id = DARSHAN_POSIX_MOD;
posix_runtime->agg_file_runtime.file_record->rank = my_rank;
}
return; return;
} }
...@@ -1699,8 +1682,6 @@ static struct posix_file_runtime* posix_file_by_name(const char *name) ...@@ -1699,8 +1682,6 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
if(!posix_runtime || instrumentation_disabled) if(!posix_runtime || instrumentation_disabled)
return(NULL); return(NULL);
return(&(posix_runtime->agg_file_runtime));
#if 0
newname = darshan_clean_file_path(name); newname = darshan_clean_file_path(name);
if(!newname) if(!newname)
newname = (char*)name; newname = (char*)name;
...@@ -1751,7 +1732,6 @@ static struct posix_file_runtime* posix_file_by_name(const char *name) ...@@ -1751,7 +1732,6 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
if(newname != name) if(newname != name)
free(newname); free(newname);
return(file); return(file);
#endif
} }
/* get a POSIX file record for the given file path, and also create a /* get a POSIX file record for the given file path, and also create a
...@@ -1768,7 +1748,6 @@ static struct posix_file_runtime* posix_file_by_name_setfd(const char* name, int ...@@ -1768,7 +1748,6 @@ static struct posix_file_runtime* posix_file_by_name_setfd(const char* name, int
/* find file record by name first */ /* find file record by name first */
file = posix_file_by_name(name); file = posix_file_by_name(name);
#if 0
if(!file) if(!file)
return(NULL); return(NULL);
...@@ -1794,7 +1773,6 @@ static struct posix_file_runtime* posix_file_by_name_setfd(const char* name, int ...@@ -1794,7 +1773,6 @@ static struct posix_file_runtime* posix_file_by_name_setfd(const char* name, int
ref->file = file; ref->file = file;
ref->fd = fd; ref->fd = fd;
HASH_ADD(hlink, posix_runtime->fd_hash, fd, sizeof(int), ref); HASH_ADD(hlink, posix_runtime->fd_hash, fd, sizeof(int), ref);
#endif
return(file); return(file);
} }
...@@ -1807,16 +1785,12 @@ static struct posix_file_runtime* posix_file_by_fd(int fd) ...@@ -1807,16 +1785,12 @@ static struct posix_file_runtime* posix_file_by_fd(int fd)
if(!posix_runtime || instrumentation_disabled) if(!posix_runtime || instrumentation_disabled)
return(NULL); return(NULL);
return(posix_file_by_name(NULL));
#if 0
/* search hash table for existing file ref for this fd */ /* search hash table for existing file ref for this fd */
HASH_FIND(hlink, posix_runtime->fd_hash, &fd, sizeof(int), ref); HASH_FIND(hlink, posix_runtime->fd_hash, &fd, sizeof(int), ref);
if(ref) if(ref)
return(ref->file); return(ref->file);
return(NULL); return(NULL);
#endif
} }
/* free up reference data structures for the given file descriptor */ /* free up reference data structures for the given file descriptor */
...@@ -1827,7 +1801,6 @@ static void posix_file_close_fd(int fd) ...@@ -1827,7 +1801,6 @@ static void posix_file_close_fd(int fd)
if(!posix_runtime || instrumentation_disabled) if(!posix_runtime || instrumentation_disabled)
return; return;
#if 0
/* search hash table for this fd */ /* search hash table for this fd */
HASH_FIND(hlink, posix_runtime->fd_hash, &fd, sizeof(int), ref); HASH_FIND(hlink, posix_runtime->fd_hash, &fd, sizeof(int), ref);
if(ref) if(ref)
...@@ -1836,7 +1809,6 @@ static void posix_file_close_fd(int fd) ...@@ -1836,7 +1809,6 @@ static void posix_file_close_fd(int fd)
HASH_DELETE(hlink, posix_runtime->fd_hash, ref); HASH_DELETE(hlink, posix_runtime->fd_hash, ref);
free(ref); free(ref);
} }
#endif
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment