<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Shane Snyder pushed to branch mmap-dev at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/4f1b27adbb70e33005ad0ba2181b1d5bb3348c5a">4f1b27ad</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2015-12-02T15:18:33Z</i>
</div>
<pre class='commit-message'>bug fix in mmap region pointer assignment</pre>
</li>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/b1791172ede7eaf95510e080a77e63d99330d67b">b1791172</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2015-12-03T16:20:34Z</i>
</div>
<pre class='commit-message'>updated logutils hash read deserialization method</pre>
</li>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/523b19e4f91597331079474f81b6791e3e6d29d8">523b19e4</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2015-12-03T16:22:25Z</i>
</div>
<pre class='commit-message'>update core runtime record hash implementation
Now, as the app executes, darshan-core persists the id->name
mapping data to the tmp log file. This is done by serializing the
id->name mapping to the mmap log file region when new records are
registered.</pre>
</li>
</ul>
<h4>3 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
darshan-runtime/darshan-core.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
darshan-runtime/lib/darshan-core.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
darshan-util/darshan-logutils.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/compare/3b0c668b50b84b4407f57b5ea40336ef14d0e9d2...523b19e4f91597331079474f81b6791e3e6d29d8#diff-0'>
<strong>
darshan-runtime/darshan-core.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/darshan-core.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/darshan-core.h
</span><span style="color: #aaaaaa">@@ -36,6 +36,8 @@
</span> #define DARSHAN_MOD_MEM_MAX (2 * 1024 * 1024) /* 2 MiB default */
#endif
<span style="color: #000000;background-color: #ddffdd">+#define DARSHAN_RECORD_BUF_SIZE (1024 * 100) /* store 1024 records, each of at most 100 bytes */
+
</span> /* Default runtime compression buffer size */
#define DARSHAN_COMP_BUF_SIZE DARSHAN_MOD_MEM_MAX
<span style="color: #aaaaaa">@@ -45,13 +47,14 @@ struct darshan_core_runtime
</span> struct darshan_header *log_hdr_p;
struct darshan_job *log_job_p;
char *log_exemnt_p;
<span style="color: #000000;background-color: #ffdddd">- /* XXX: MMAP */
- void *mmap_p;
</span><span style="color: #000000;background-color: #ddffdd">+ void *log_rec_p;
+ void *log_mod_p;
</span>
struct darshan_core_record_ref *rec_hash;
<span style="color: #000000;background-color: #ffdddd">- int rec_count;
</span><span style="color: #000000;background-color: #ddffdd">+ int rec_hash_sz;
+ int rec_hash_cnt;
</span> struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
<span style="color: #000000;background-color: #ffdddd">- char comp_buf[DARSHAN_COMP_BUF_SIZE]; /* TODO: why is this allocated statically? */
</span><span style="color: #000000;background-color: #ddffdd">+ char comp_buf[DARSHAN_COMP_BUF_SIZE]; /* TODO: why is this allocated statically? only used in shutdown */
</span> double wtime_offset;
};
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/compare/3b0c668b50b84b4407f57b5ea40336ef14d0e9d2...523b19e4f91597331079474f81b6791e3e6d29d8#diff-1'>
<strong>
darshan-runtime/lib/darshan-core.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/lib/darshan-core.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/lib/darshan-core.c
</span><span style="color: #aaaaaa">@@ -89,8 +89,6 @@ static struct mnt_data mnt_data_array[DARSHAN_MAX_MNTS];
</span> static int mnt_data_count = 0;
/* prototypes for internal helper functions */
-static void darshan_get_logfile_name(
<span style="color: #000000;background-color: #ffdddd">- char* logfile_name, int jobid, struct tm* start_tm);
</span> static void darshan_log_record_hints_and_ver(
struct darshan_core_runtime* core);
static void darshan_get_exe_and_mounts_root(
<span style="color: #aaaaaa">@@ -99,6 +97,8 @@ static void darshan_get_exe_and_mounts(
</span> struct darshan_core_runtime *core, int argc, char **argv);
static void darshan_block_size_from_path(
const char *path, int *block_size);
<span style="color: #000000;background-color: #ddffdd">+static void darshan_get_logfile_name(
+ char* logfile_name, int jobid, struct tm* start_tm);
</span> static void darshan_get_shared_records(
struct darshan_core_runtime *core, darshan_record_id **shared_recs,
int *shared_rec_cnt);
<span style="color: #aaaaaa">@@ -201,7 +201,8 @@ void darshan_core_initialize(int argc, char **argv)
</span> assert(sys_page_size > 0);
/* XXX: MMAP */
<span style="color: #000000;background-color: #ffdddd">- mmap_size = sizeof(struct darshan_header) + DARSHAN_JOB_RECORD_SIZE + DARSHAN_MOD_MEM_MAX;
</span><span style="color: #000000;background-color: #ddffdd">+ mmap_size = sizeof(struct darshan_header) + DARSHAN_JOB_RECORD_SIZE +
+ DARSHAN_MOD_MEM_MAX;
</span> if(mmap_size % sys_page_size)
mmap_size = ((mmap_size / sys_page_size) + 1) * sys_page_size;
<span style="color: #aaaaaa">@@ -237,9 +238,8 @@ void darshan_core_initialize(int argc, char **argv)
</span> /* memory map buffers for getting at least some summary i/o data
* into a log file if darshan does not shut down properly
*/
<span style="color: #000000;background-color: #ffdddd">- init_core->mmap_p = mmap(NULL, mmap_size, PROT_WRITE, MAP_SHARED,
- mmap_fd, 0);
- if(init_core->mmap_p == MAP_FAILED)
</span><span style="color: #000000;background-color: #ddffdd">+ void *mmap_p = mmap(NULL, mmap_size, PROT_WRITE, MAP_SHARED, mmap_fd, 0);
+ if(mmap_p == MAP_FAILED)
</span> {
fprintf(stderr, "darshan library warning: "
"unable to mmap darshan log file %s\n", mmap_log_name);
<span style="color: #aaaaaa">@@ -253,20 +253,23 @@ void darshan_core_initialize(int argc, char **argv)
</span> close(mmap_fd);
/* set the memory pointers for each log file region */
<span style="color: #000000;background-color: #ffdddd">- init_core->log_hdr_p = (struct darshan_header *)
- (init_core->mmap_p);
</span><span style="color: #000000;background-color: #ddffdd">+ init_core->log_hdr_p = (struct darshan_header *)mmap_p;
</span> init_core->log_job_p = (struct darshan_job *)
<span style="color: #000000;background-color: #ffdddd">- (init_core->log_hdr_p + sizeof(struct darshan_header));
</span><span style="color: #000000;background-color: #ddffdd">+ ((char *)init_core->log_hdr_p + sizeof(struct darshan_header));
</span> init_core->log_exemnt_p = (char *)
<span style="color: #000000;background-color: #ffdddd">- (((char *)init_core->log_job_p) + sizeof(struct darshan_job));
- /* TODO: file hash & module memory */
</span>-
<span style="color: #000000;background-color: #ddffdd">+ ((char *)init_core->log_job_p + sizeof(struct darshan_job));
+ init_core->log_rec_p = (void *)
+ ((char *)init_core->log_exemnt_p + DARSHAN_EXE_LEN + 1);
+ init_core->log_mod_p = (void *)
+ ((char *)init_core->log_rec_p + DARSHAN_RECORD_BUF_SIZE);
</span> /* XXX: MMAP */
/* set known header fields for the log file */
strcpy(init_core->log_hdr_p->version_string, DARSHAN_LOG_VERSION);
init_core->log_hdr_p->magic_nr = DARSHAN_MAGIC_NR;
init_core->log_hdr_p->comp_type = DARSHAN_NO_COMP;
<span style="color: #000000;background-color: #ddffdd">+ init_core->log_hdr_p->rec_map.off =
+ sizeof(struct darshan_header) + DARSHAN_JOB_RECORD_SIZE;
</span>
/* set known job-level metadata fields for the log file */
init_core->log_job_p->uid = getuid();
<span style="color: #aaaaaa">@@ -369,161 +372,6 @@ void darshan_core_shutdown()
</span>
/* *********************************** */
-/* construct the darshan log file name */
-static void darshan_get_logfile_name(char* logfile_name, int jobid, struct tm* start_tm)
-{
<span style="color: #000000;background-color: #ffdddd">- char* user_logfile_name;
- char* logpath;
- char* logname_string;
- char* logpath_override = NULL;
</span>-#ifdef __DARSHAN_LOG_ENV
<span style="color: #000000;background-color: #ffdddd">- char env_check[256];
- char* env_tok;
</span>-#endif
<span style="color: #000000;background-color: #ffdddd">- uint64_t hlevel;
- char hname[HOST_NAME_MAX];
- uint64_t logmod;
- char cuser[L_cuserid] = {0};
- int ret;
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* first, check if user specifies a complete logpath to use */
- user_logfile_name = getenv("DARSHAN_LOGFILE");
- if(user_logfile_name)
- {
- if(strlen(user_logfile_name) >= (PATH_MAX-1))
- {
- fprintf(stderr, "darshan library warning: user log file name too long.\n");
- logfile_name[0] = '\0';
- }
- else
- {
- strcpy(logfile_name, user_logfile_name);
- }
- }
- else
- {
- /* otherwise, generate the log path automatically */
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* Use DARSHAN_LOG_PATH_OVERRIDE for the value or __DARSHAN_LOG_PATH */
- logpath = getenv(DARSHAN_LOG_PATH_OVERRIDE);
- if(!logpath)
- {
</span>-#ifdef __DARSHAN_LOG_PATH
<span style="color: #000000;background-color: #ffdddd">- logpath = __DARSHAN_LOG_PATH;
</span>-#endif
<span style="color: #000000;background-color: #ffdddd">- }
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* get the username for this job. In order we will try each of the
- * following until one of them succeeds:
- *
- * - cuserid()
- * - getenv("LOGNAME")
- * - snprintf(..., geteuid());
- *
- * Note that we do not use getpwuid() because it generally will not
- * work in statically compiled binaries.
- */
</span>-
-#ifndef DARSHAN_DISABLE_CUSERID
<span style="color: #000000;background-color: #ffdddd">- cuserid(cuser);
</span>-#endif
-
<span style="color: #000000;background-color: #ffdddd">- /* if cuserid() didn't work, then check the environment */
- if(strcmp(cuser, "") == 0)
- {
- logname_string = getenv("LOGNAME");
- if(logname_string)
- {
- strncpy(cuser, logname_string, (L_cuserid-1));
- }
- }
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* if cuserid() and environment both fail, then fall back to uid */
- if(strcmp(cuser, "") == 0)
- {
- uid_t uid = geteuid();
- snprintf(cuser, sizeof(cuser), "%u", uid);
- }
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* generate a random number to help differentiate the log */
- hlevel=DARSHAN_MPI_CALL(PMPI_Wtime)() * 1000000;
- (void)gethostname(hname, sizeof(hname));
- logmod = darshan_hash((void*)hname,strlen(hname),hlevel);
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* see if darshan was configured using the --with-logpath-by-env
- * argument, which allows the user to specify an absolute path to
- * place logs via an env variable.
- */
</span>-#ifdef __DARSHAN_LOG_ENV
<span style="color: #000000;background-color: #ffdddd">- /* just silently skip if the environment variable list is too big */
- if(strlen(__DARSHAN_LOG_ENV) < 256)
- {
- /* copy env variable list to a temporary buffer */
- strcpy(env_check, __DARSHAN_LOG_ENV);
- /* tokenize the comma-separated list */
- env_tok = strtok(env_check, ",");
- if(env_tok)
- {
- do
- {
- /* check each env variable in order */
- logpath_override = getenv(env_tok);
- if(logpath_override)
- {
- /* stop as soon as we find a match */
- break;
- }
- }while((env_tok = strtok(NULL, ",")));
- }
- }
</span>-#endif
-
<span style="color: #000000;background-color: #ffdddd">- if(logpath_override)
- {
- ret = snprintf(logfile_name, PATH_MAX,
- "%s/%s_%s_id%d_%d-%d-%d-%" PRIu64 ".darshan_partial",
- logpath_override,
- cuser, __progname, jobid,
- (start_tm->tm_mon+1),
- start_tm->tm_mday,
- (start_tm->tm_hour*60*60 + start_tm->tm_min*60 + start_tm->tm_sec),
- logmod);
- if(ret == (PATH_MAX-1))
- {
- /* file name was too big; squish it down */
- snprintf(logfile_name, PATH_MAX,
- "%s/id%d.darshan_partial",
- logpath_override, jobid);
- }
- }
- else if(logpath)
- {
- ret = snprintf(logfile_name, PATH_MAX,
- "%s/%d/%d/%d/%s_%s_id%d_%d-%d-%d-%" PRIu64 ".darshan_partial",
- logpath, (start_tm->tm_year+1900),
- (start_tm->tm_mon+1), start_tm->tm_mday,
- cuser, __progname, jobid,
- (start_tm->tm_mon+1),
- start_tm->tm_mday,
- (start_tm->tm_hour*60*60 + start_tm->tm_min*60 + start_tm->tm_sec),
- logmod);
- if(ret == (PATH_MAX-1))
- {
- /* file name was too big; squish it down */
- snprintf(logfile_name, PATH_MAX,
- "%s/id%d.darshan_partial",
- logpath, jobid);
- }
- }
- else
- {
- logfile_name[0] = '\0';
- }
- }
</span>-
<span style="color: #000000;background-color: #ffdddd">- return;
</span>-}
-
/* record any hints used to write the darshan log in the job data */
static void darshan_log_record_hints_and_ver(struct darshan_core_runtime* core)
{
<span style="color: #aaaaaa">@@ -764,6 +612,53 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
</span> return;
}
<span style="color: #000000;background-color: #ddffdd">+static void darshan_add_record_hashref(struct darshan_core_runtime *core,
+ char *name, darshan_record_id id, struct darshan_core_record_ref **ref)
+{
+ int record_size = sizeof(darshan_record_id) + strlen(name) + 1;
+
+ if((record_size + core->rec_hash_sz) > DARSHAN_RECORD_BUF_SIZE)
+ return;
+
+ *ref = malloc(sizeof(**ref));
+ if(*ref)
+ {
+ memset(*ref, 0, sizeof(**ref));
+
+#if 0
+ if(!mmap)
+ {
+ ref->rec.name = malloc(strlen(name) + 1);
+ }
+ else
+#endif
+ {
+ /* store the rec id and full file path in record hash buffer */
+ void *tmp_p = (char *)core->log_rec_p + core->rec_hash_sz;
+ *(darshan_record_id *)tmp_p = id;
+
+ /* set the name pointer for this record to point to the
+ * appropriate location in the record hash buffer
+ */
+ tmp_p = (char *)tmp_p + sizeof(darshan_record_id);
+ (*ref)->rec.name = (char *)tmp_p;
+ }
+
+ /* set record ref fields */
+ (*ref)->rec.id = id;
+ if((*ref)->rec.name)
+ strcpy((*ref)->rec.name, name);
+
+ /* TODO: look at HASH_ADD_KEYPTR, use same strategy (big contig pool) for non-mmap darshan */
+ HASH_ADD(hlink, core->rec_hash, rec.id, sizeof(darshan_record_id), (*ref));
+ core->rec_hash_cnt++;
+ core->rec_hash_sz += record_size;
+ core->log_hdr_p->rec_map.len += record_size;
+ }
+
+ return;
+}
+
</span> static void darshan_block_size_from_path(const char *path, int *block_size)
{
int i;
<span style="color: #aaaaaa">@@ -781,11 +676,166 @@ static void darshan_block_size_from_path(const char *path, int *block_size)
</span> return;
}
<span style="color: #000000;background-color: #ddffdd">+/* construct the darshan log file name */
+static void darshan_get_logfile_name(char* logfile_name, int jobid, struct tm* start_tm)
+{
+ char* user_logfile_name;
+ char* logpath;
+ char* logname_string;
+ char* logpath_override = NULL;
+#ifdef __DARSHAN_LOG_ENV
+ char env_check[256];
+ char* env_tok;
+#endif
+ uint64_t hlevel;
+ char hname[HOST_NAME_MAX];
+ uint64_t logmod;
+ char cuser[L_cuserid] = {0};
+ int ret;
+
+ /* first, check if user specifies a complete logpath to use */
+ user_logfile_name = getenv("DARSHAN_LOGFILE");
+ if(user_logfile_name)
+ {
+ if(strlen(user_logfile_name) >= (PATH_MAX-1))
+ {
+ fprintf(stderr, "darshan library warning: user log file name too long.\n");
+ logfile_name[0] = '\0';
+ }
+ else
+ {
+ strcpy(logfile_name, user_logfile_name);
+ }
+ }
+ else
+ {
+ /* otherwise, generate the log path automatically */
+
+ /* Use DARSHAN_LOG_PATH_OVERRIDE for the value or __DARSHAN_LOG_PATH */
+ logpath = getenv(DARSHAN_LOG_PATH_OVERRIDE);
+ if(!logpath)
+ {
+#ifdef __DARSHAN_LOG_PATH
+ logpath = __DARSHAN_LOG_PATH;
+#endif
+ }
+
+ /* get the username for this job. In order we will try each of the
+ * following until one of them succeeds:
+ *
+ * - cuserid()
+ * - getenv("LOGNAME")
+ * - snprintf(..., geteuid());
+ *
+ * Note that we do not use getpwuid() because it generally will not
+ * work in statically compiled binaries.
+ */
+
+#ifndef DARSHAN_DISABLE_CUSERID
+ cuserid(cuser);
+#endif
+
+ /* if cuserid() didn't work, then check the environment */
+ if(strcmp(cuser, "") == 0)
+ {
+ logname_string = getenv("LOGNAME");
+ if(logname_string)
+ {
+ strncpy(cuser, logname_string, (L_cuserid-1));
+ }
+ }
+
+ /* if cuserid() and environment both fail, then fall back to uid */
+ if(strcmp(cuser, "") == 0)
+ {
+ uid_t uid = geteuid();
+ snprintf(cuser, sizeof(cuser), "%u", uid);
+ }
+
+ /* generate a random number to help differentiate the log */
+ hlevel=DARSHAN_MPI_CALL(PMPI_Wtime)() * 1000000;
+ (void)gethostname(hname, sizeof(hname));
+ logmod = darshan_hash((void*)hname,strlen(hname),hlevel);
+
+ /* see if darshan was configured using the --with-logpath-by-env
+ * argument, which allows the user to specify an absolute path to
+ * place logs via an env variable.
+ */
+#ifdef __DARSHAN_LOG_ENV
+ /* just silently skip if the environment variable list is too big */
+ if(strlen(__DARSHAN_LOG_ENV) < 256)
+ {
+ /* copy env variable list to a temporary buffer */
+ strcpy(env_check, __DARSHAN_LOG_ENV);
+ /* tokenize the comma-separated list */
+ env_tok = strtok(env_check, ",");
+ if(env_tok)
+ {
+ do
+ {
+ /* check each env variable in order */
+ logpath_override = getenv(env_tok);
+ if(logpath_override)
+ {
+ /* stop as soon as we find a match */
+ break;
+ }
+ }while((env_tok = strtok(NULL, ",")));
+ }
+ }
+#endif
+
+ if(logpath_override)
+ {
+ ret = snprintf(logfile_name, PATH_MAX,
+ "%s/%s_%s_id%d_%d-%d-%d-%" PRIu64 ".darshan_partial",
+ logpath_override,
+ cuser, __progname, jobid,
+ (start_tm->tm_mon+1),
+ start_tm->tm_mday,
+ (start_tm->tm_hour*60*60 + start_tm->tm_min*60 + start_tm->tm_sec),
+ logmod);
+ if(ret == (PATH_MAX-1))
+ {
+ /* file name was too big; squish it down */
+ snprintf(logfile_name, PATH_MAX,
+ "%s/id%d.darshan_partial",
+ logpath_override, jobid);
+ }
+ }
+ else if(logpath)
+ {
+ ret = snprintf(logfile_name, PATH_MAX,
+ "%s/%d/%d/%d/%s_%s_id%d_%d-%d-%d-%" PRIu64 ".darshan_partial",
+ logpath, (start_tm->tm_year+1900),
+ (start_tm->tm_mon+1), start_tm->tm_mday,
+ cuser, __progname, jobid,
+ (start_tm->tm_mon+1),
+ start_tm->tm_mday,
+ (start_tm->tm_hour*60*60 + start_tm->tm_min*60 + start_tm->tm_sec),
+ logmod);
+ if(ret == (PATH_MAX-1))
+ {
+ /* file name was too big; squish it down */
+ snprintf(logfile_name, PATH_MAX,
+ "%s/id%d.darshan_partial",
+ logpath, jobid);
+ }
+ }
+ else
+ {
+ logfile_name[0] = '\0';
+ }
+ }
+
+ return;
+}
+
</span> static void darshan_get_shared_records(struct darshan_core_runtime *core,
darshan_record_id **shared_recs, int *shared_rec_cnt)
{
int i, j;
<span style="color: #000000;background-color: #ffdddd">- int tmp_cnt = core->rec_count;
</span><span style="color: #000000;background-color: #ddffdd">+ int tmp_cnt = core->rec_hash_cnt;
</span> struct darshan_core_record_ref *tmp, *ref;
darshan_record_id *id_array;
uint64_t *mod_flags;
<span style="color: #aaaaaa">@@ -1020,7 +1070,7 @@ static int darshan_log_write_record_hash(MPI_File log_fh, struct darshan_core_ru
</span>
/* allocate a buffer to store at most 64 bytes for each registered record */
/* NOTE: this buffer may be reallocated if estimate is too small */
<span style="color: #000000;background-color: #ffdddd">- hash_buf_sz = core->rec_count * 64;
</span><span style="color: #000000;background-color: #ddffdd">+ hash_buf_sz = core->rec_hash_cnt * 64;
</span> hash_buf = malloc(hash_buf_sz);
if(!hash_buf)
{
<span style="color: #aaaaaa">@@ -1161,7 +1211,7 @@ static void darshan_core_cleanup(struct darshan_core_runtime* core)
</span> HASH_ITER(hlink, core->rec_hash, ref, tmp)
{
HASH_DELETE(hlink, core->rec_hash, ref);
<span style="color: #000000;background-color: #ffdddd">- free(ref->rec.name);
</span><span style="color: #000000;background-color: #ddffdd">+ /* XXX MMAP: free(ref->rec.name); */
</span> free(ref);
}
<span style="color: #aaaaaa">@@ -1200,10 +1250,6 @@ void darshan_core_register_module(
</span> if(!darshan_core || (mod_id >= DARSHAN_MAX_MODS))
return;
<span style="color: #000000;background-color: #ffdddd">- /* XXX */
- return;
- /* XXX how do we assign size and address */
</span>-
if(sys_mem_alignment)
*sys_mem_alignment = darshan_mem_alignment;
<span style="color: #aaaaaa">@@ -1219,6 +1265,10 @@ void darshan_core_register_module(
</span> return;
}
<span style="color: #000000;background-color: #ddffdd">+ /* XXX how do we assign size and address */
+ *mod_buf = darshan_core->log_mod_p;
+ *mod_buf_size = 2*1024*1024;
+
</span> /* this module has not been registered yet, allocate and initialize it */
mod = malloc(sizeof(*mod));
if(!mod)
<span style="color: #aaaaaa">@@ -1306,26 +1356,17 @@ void darshan_core_register_record(
</span> }
#endif
<span style="color: #000000;background-color: #ffdddd">- ref = malloc(sizeof(struct darshan_core_record_ref));
- if(ref)
- {
- ref->mod_flags = ref->global_mod_flags = 0;
- ref->rec.id = tmp_rec_id;
- ref->rec.name = malloc(strlen(name) + 1);
- if(ref->rec.name)
- strcpy(ref->rec.name, name);
</span>-
<span style="color: #000000;background-color: #ffdddd">- HASH_ADD(hlink, darshan_core->rec_hash, rec.id, sizeof(darshan_record_id), ref);
- darshan_core->rec_count++;
- }
</span><span style="color: #000000;background-color: #ddffdd">+ darshan_add_record_hashref(darshan_core, name, tmp_rec_id, &ref);
</span> }
<span style="color: #000000;background-color: #ffdddd">- DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
</span><span style="color: #000000;background-color: #ddffdd">+
+ if(ref)
+ DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
</span> DARSHAN_CORE_UNLOCK();
if(file_alignment)
darshan_block_size_from_path(name, file_alignment);
<span style="color: #000000;background-color: #ffdddd">- *rec_id = tmp_rec_id;
</span><span style="color: #000000;background-color: #ddffdd">+ *rec_id = 0; /* XXX */
</span> return;
}
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/compare/3b0c668b50b84b4407f57b5ea40336ef14d0e9d2...523b19e4f91597331079474f81b6791e3e6d29d8#diff-2'>
<strong>
darshan-util/darshan-logutils.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-util/darshan-logutils.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-util/darshan-logutils.c
</span><span style="color: #aaaaaa">@@ -508,12 +508,12 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
</span> int hash_buf_sz;
char *buf_ptr;
darshan_record_id *rec_id_ptr;
<span style="color: #000000;background-color: #ffdddd">- uint32_t *path_len_ptr, tmp_path_len;
</span> char *path_ptr;
<span style="color: #000000;background-color: #ddffdd">+ char *tmp_p;
</span> struct darshan_record_ref *ref;
int read;
int read_req_sz;
<span style="color: #000000;background-color: #ffdddd">- int buf_remaining = 0;
</span><span style="color: #000000;background-color: #ddffdd">+ int buf_rem = 0;
</span>
assert(state);
<span style="color: #aaaaaa">@@ -536,9 +536,9 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
</span> /* read chunks of the darshan record id -> file name mapping from log file,
* constructing a hash table in the process
*/
<span style="color: #000000;background-color: #ffdddd">- read_req_sz = hash_buf_sz - buf_remaining;
</span><span style="color: #000000;background-color: #ddffdd">+ read_req_sz = hash_buf_sz - buf_rem;
</span> read = darshan_log_dzread(fd, DARSHAN_REC_MAP_REGION_ID,
<span style="color: #000000;background-color: #ffdddd">- hash_buf + buf_remaining, read_req_sz);
</span><span style="color: #000000;background-color: #ddffdd">+ hash_buf + buf_rem, read_req_sz);
</span> if(read < 0)
{
fprintf(stderr, "Error: failed to read record hash from darshan log file.\n");
<span style="color: #aaaaaa">@@ -552,34 +552,32 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
</span> * to handle incomplete mappings temporarily here
*/
buf_ptr = hash_buf;
<span style="color: #000000;background-color: #ffdddd">- buf_remaining += read;
- while(buf_remaining > (sizeof(darshan_record_id) + sizeof(uint32_t)))
</span><span style="color: #000000;background-color: #ddffdd">+ buf_rem += read;
+ while(buf_rem > (sizeof(darshan_record_id) + 1))
</span> {
<span style="color: #000000;background-color: #ffdddd">- /* see if we have enough buf space to read in the next full record */
- tmp_path_len = *(uint32_t *)(buf_ptr + sizeof(darshan_record_id));
- if(fd->swap_flag)
- DARSHAN_BSWAP32(&tmp_path_len);
</span>-
<span style="color: #000000;background-color: #ffdddd">- /* we need to read more before we continue deserializing */
- if(buf_remaining <
- (sizeof(darshan_record_id) + sizeof(uint32_t) + tmp_path_len))
</span><span style="color: #000000;background-color: #ddffdd">+ tmp_p = buf_ptr + sizeof(darshan_record_id);
+ while(tmp_p < (buf_ptr + buf_rem))
+ {
+ /* look for terminating null character for record name */
+ if(*tmp_p == '\0')
+ break;
+ tmp_p++;
+ }
+ if(*tmp_p != '\0')
</span> break;
/* get pointers for each field of this darshan record */
/* NOTE: darshan record hash serialization method:
<span style="color: #000000;background-color: #ffdddd">- * ... darshan_record_id | (uint32_t) path_len | path ...
</span><span style="color: #000000;background-color: #ddffdd">+ * ... darshan_record_id | path '\0' ...
</span> */
rec_id_ptr = (darshan_record_id *)buf_ptr;
buf_ptr += sizeof(darshan_record_id);
<span style="color: #000000;background-color: #ffdddd">- path_len_ptr = (uint32_t *)buf_ptr;
- buf_ptr += sizeof(uint32_t);
</span> path_ptr = (char *)buf_ptr;
if(fd->swap_flag)
{
/* we need to sort out endianness issues before deserializing */
DARSHAN_BSWAP64(rec_id_ptr);
<span style="color: #000000;background-color: #ffdddd">- DARSHAN_BSWAP32(path_len_ptr);
</span> }
HASH_FIND(hlink, *hash, rec_id_ptr, sizeof(darshan_record_id), ref);
<span style="color: #aaaaaa">@@ -591,7 +589,7 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
</span> free(hash_buf);
return(-1);
}
<span style="color: #000000;background-color: #ffdddd">- ref->rec.name = malloc(*path_len_ptr + 1);
</span><span style="color: #000000;background-color: #ddffdd">+ ref->rec.name = malloc(strlen(path_ptr) + 1);
</span> if(!ref->rec.name)
{
free(ref);
<span style="color: #aaaaaa">@@ -601,26 +599,24 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
</span>
/* set the fields for this record */
ref->rec.id = *rec_id_ptr;
<span style="color: #000000;background-color: #ffdddd">- memcpy(ref->rec.name, path_ptr, *path_len_ptr);
- ref->rec.name[*path_len_ptr] = '\0';
</span><span style="color: #000000;background-color: #ddffdd">+ strcpy(ref->rec.name, path_ptr);
</span>
/* add this record to the hash */
HASH_ADD(hlink, *hash, rec.id, sizeof(darshan_record_id), ref);
}
<span style="color: #000000;background-color: #ffdddd">- buf_ptr += *path_len_ptr;
- buf_remaining -=
- (sizeof(darshan_record_id) + sizeof(uint32_t) + *path_len_ptr);
</span><span style="color: #000000;background-color: #ddffdd">+ buf_ptr += strlen(path_ptr) + 1;
+ buf_rem -= (sizeof(darshan_record_id) + strlen(path_ptr) + 1);
</span> }
/* copy any leftover data to beginning of buffer to parse next */
<span style="color: #000000;background-color: #ffdddd">- memcpy(hash_buf, buf_ptr, buf_remaining);
</span><span style="color: #000000;background-color: #ddffdd">+ memcpy(hash_buf, buf_ptr, buf_rem);
</span>
/* we keep reading until we get a short read informing us we have
* read all of the record hash
*/
} while(read == read_req_sz);
<span style="color: #000000;background-color: #ffdddd">- assert(buf_remaining == 0);
</span><span style="color: #000000;background-color: #ddffdd">+ assert(buf_rem == 0);
</span>
free(hash_buf);
return(0);
<span style="color: #aaaaaa">@@ -1178,6 +1174,7 @@ static int darshan_log_dzread(darshan_fd fd, int region_id, void *buf, int len)
</span> if(region_id != state->dz.prev_reg_id)
{
state->dz.eor = 0;
<span style="color: #000000;background-color: #ddffdd">+ state->dz.size = 0;
</span> reset_strm_flag = 1; /* reset libz/bzip2 streams */
}
<span style="color: #aaaaaa">@@ -1602,12 +1599,12 @@ static int darshan_log_noz_read(darshan_fd fd, struct darshan_log_map map,
</span> if(reset_strm_flag)
*buf_off = state->dz.size;
<span style="color: #000000;background-color: #ffdddd">- /* we just decompress until the output buffer is full, assuming there
- * is enough compressed data in file to satisfy the request size.
</span><span style="color: #000000;background-color: #ddffdd">+ /* we just read data from the given log file region until we have
+ * accumulated 'len' bytes, or until the region ends
</span> */
while(total_bytes < len)
{
<span style="color: #000000;background-color: #ffdddd">- /* check if we need more compressed data */
</span><span style="color: #000000;background-color: #ddffdd">+ /* check if we need to load more data from log file */
</span> if(*buf_off == state->dz.size)
{
/* if the eor flag is set, clear it and return -- future
<span style="color: #aaaaaa">@@ -1643,8 +1640,6 @@ static int darshan_log_dzload(darshan_fd fd, struct darshan_log_map map)
</span> unsigned int remaining;
unsigned int read_size;
<span style="color: #000000;background-color: #ffdddd">- state->dz.size = 0;
</span>-
/* seek to the appropriate portion of the log file, if out of range */
if((state->pos < map.off) || (state->pos >= (map.off + map.len)))
{
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/compare/3b0c668b50b84b4407f57b5ea40336ef14d0e9d2...523b19e4f91597331079474f81b6791e3e6d29d8">View it on GitLab</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":["merge_requests","issues","commit"],"url":"https://xgitlab.cels.anl.gov/darshan/darshan/compare/3b0c668b50b84b4407f57b5ea40336ef14d0e9d2...523b19e4f91597331079474f81b6791e3e6d29d8"}}</script>
</p>
</div>
</body>
</html>