GitLab maintenance scheduled for Today, 2019-12-05, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit 77323cd7 authored by Shane Snyder's avatar Shane Snyder

add back-compat code for the POSIX module ver=2

parent 5c5e4452
......@@ -7,7 +7,7 @@
#define __DARSHAN_POSIX_LOG_FORMAT_H
/* current POSIX log format version */
#define DARSHAN_POSIX_VER 1
#define DARSHAN_POSIX_VER 2
#define POSIX_COUNTERS \
/* count of posix opens */\
......@@ -22,14 +22,6 @@
X(POSIX_STATS) \
/* count of posix mmaps */\
X(POSIX_MMAPS) \
/* count of posix fopens */\
X(POSIX_FOPENS) \
/* count of posix freads */\
X(POSIX_FREADS) \
/* count of posix fwrites */\
X(POSIX_FWRITES) \
/* count of posix fseeks */\
X(POSIX_FSEEKS) \
/* count of posix fsyncs */\
X(POSIX_FSYNCS) \
/* count of posix fdatasyncs */\
......
......@@ -1223,11 +1223,10 @@ void posix_calc_file(hash_entry_t *file_hash,
bytes = file_rec->counters[POSIX_BYTES_READ] +
file_rec->counters[POSIX_BYTES_WRITTEN];
r = (file_rec->counters[POSIX_READS]+
file_rec->counters[POSIX_FREADS]);
/* XXX: need to update this to account for stdio counters, too */
r = file_rec->counters[POSIX_READS];
w = (file_rec->counters[POSIX_WRITES]+
file_rec->counters[POSIX_FWRITES]);
w = file_rec->counters[POSIX_WRITES];
fdata->total += 1;
fdata->total_size += bytes;
......
......@@ -30,6 +30,8 @@ char *posix_f_counter_names[] = {
};
#undef X
#define DARSHAN_POSIX_FILE_SIZE_1 680
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf);
static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf, int ver);
static void darshan_log_print_posix_file(void *file_rec,
......@@ -51,19 +53,52 @@ struct darshan_mod_logutil_funcs posix_logutils =
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf)
{
struct darshan_posix_file *file;
struct darshan_posix_file *file = (struct darshan_posix_file *)posix_buf;
int rec_len;
char *buffer, *p;
int i;
int ret;
int ret = -1;
/* read the POSIX record from file, checking the version first so we
* can correctly up-convert to the current darshan version
*/
if(fd->mod_ver[DARSHAN_POSIX_MOD] == 1)
{
buffer = malloc(DARSHAN_POSIX_FILE_SIZE_1);
if(!buffer)
return(-1);
rec_len = DARSHAN_POSIX_FILE_SIZE_1;
ret = darshan_log_get_mod(fd, DARSHAN_POSIX_MOD, buffer, rec_len);
if(ret == rec_len)
{
/* copy record data directly from the temporary buffer into the
* corresponding locations in the output file record
*/
p = buffer;
memcpy(&(file->base_rec), p, sizeof(struct darshan_base_record));
p += sizeof(struct darshan_base_record);
memcpy(&(file->counters[0]), p, 6 * sizeof(int64_t));
p += (6 * sizeof(int64_t));
p += (4 * sizeof(int64_t)); /* skip old stdio counters */
memcpy(&(file->counters[6]), p, 58 * sizeof(int64_t));
p += (58 * sizeof(int64_t));
memcpy(&(file->fcounters[0]), p, 15 * sizeof(double));
}
free(buffer);
}
else if(fd->mod_ver[DARSHAN_POSIX_MOD] == 2)
{
rec_len = sizeof(struct darshan_posix_file);
ret = darshan_log_get_mod(fd, DARSHAN_POSIX_MOD, posix_buf, rec_len);
}
ret = darshan_log_get_mod(fd, DARSHAN_POSIX_MOD, posix_buf,
sizeof(struct darshan_posix_file));
if(ret < 0)
return(-1);
else if(ret < sizeof(struct darshan_posix_file))
else if(ret < rec_len)
return(0);
else
{
file = (struct darshan_posix_file *)posix_buf;
if(fd->swap_flag)
{
/* swap bytes if necessary */
......@@ -263,10 +298,6 @@ static void darshan_log_agg_posix_files(void *rec, void *agg_rec, int init_flag)
case POSIX_SEEKS:
case POSIX_STATS:
case POSIX_MMAPS:
case POSIX_FOPENS:
case POSIX_FREADS:
case POSIX_FWRITES:
case POSIX_FSEEKS:
case POSIX_FSYNCS:
case POSIX_FDSYNCS:
case POSIX_BYTES_READ:
......
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