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

Commit 6ccaea46 authored by Shane Snyder's avatar Shane Snyder

bgq backwards compatibility code

parent f3afdb75
......@@ -11,7 +11,7 @@
#define DARSHAN_BGQ_VER 1
#define BGQ_COUNTERS \
/* control system jobid*/\
/* control system jobid */\
X(BGQ_CSJOBID) \
/* number of BGQ compute nodes */\
X(BGQ_NNODES) \
......
......@@ -30,6 +30,15 @@ char *bgq_f_counter_names[] = {
};
#undef X
/* old definitions for enforcing backwards compatibility */
struct darshan_bgq_record_1
{
struct darshan_base_record base_rec;
int alignment;
int64_t counters[BGQ_NUM_INDICES];
double fcounters[BGQ_F_NUM_INDICES];
};
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf);
static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver);
static void darshan_log_print_bgq_rec(void *file_rec,
......@@ -51,19 +60,46 @@ struct darshan_mod_logutil_funcs bgq_logutils =
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf)
{
struct darshan_bgq_record *rec;
int log_rec_len;
struct darshan_bgq_record *rec =
(struct darshan_bgq_record *)bgq_buf;
int i;
int ret;
int ret = -1;
/* read the BGQ record from file, checking the version first so we
* can read it correctly
*/
if(fd->mod_ver[DARSHAN_BGQ_MOD] == 1)
{
struct darshan_bgq_record_1 bgq_rec_1;
log_rec_len = sizeof(struct darshan_bgq_record_1);
ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, &bgq_rec_1,
log_rec_len);
if(ret == log_rec_len)
{
/* up-convert old BGQ format to new format */
rec->base_rec = bgq_rec_1.base_rec;
memcpy(rec->counters, bgq_rec_1.counters,
BGQ_NUM_INDICES * sizeof(int64_t));
memcpy(rec->fcounters, bgq_rec_1.fcounters,
BGQ_F_NUM_INDICES * sizeof(double));
}
}
else if(fd->mod_ver[DARSHAN_BGQ_MOD] == 2)
{
log_rec_len = sizeof(struct darshan_bgq_record);
ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, rec,
log_rec_len);
}
ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, bgq_buf,
sizeof(struct darshan_bgq_record));
if(ret < 0)
return(-1);
else if(ret < sizeof(struct darshan_bgq_record))
else if(ret < log_rec_len)
return(0);
else
{
rec = (struct darshan_bgq_record *)bgq_buf;
if(fd->swap_flag)
{
/* swap bytes if necessary */
......
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