Commit cc619189 authored by Shane Snyder's avatar Shane Snyder
Browse files

bug fix in bgq back compat code

parent c522d7f9
...@@ -30,7 +30,9 @@ char *bgq_f_counter_names[] = { ...@@ -30,7 +30,9 @@ char *bgq_f_counter_names[] = {
}; };
#undef X #undef X
#define DARSHAN_BGQ_FILE_SIZE_1 (112 + sizeof(int)) /* NOTE:
*/
#define DARSHAN_BGQ_FILE_SIZE_1 (112 + 8)
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf); 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 int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver);
...@@ -70,16 +72,18 @@ static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf) ...@@ -70,16 +72,18 @@ static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf)
rec_len = DARSHAN_BGQ_FILE_SIZE_1; rec_len = DARSHAN_BGQ_FILE_SIZE_1;
ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, buffer, rec_len); ret = darshan_log_get_mod(fd, DARSHAN_BGQ_MOD, buffer, rec_len);
if(ret == rec_len) if(ret > 0)
{ {
/* up-convert old BGQ format to new format */ /* up-convert old BGQ format to new format */
p = buffer; p = buffer;
memcpy(&(rec->base_rec), p, sizeof(struct darshan_base_record)); memcpy(&(rec->base_rec), p, sizeof(struct darshan_base_record));
p += sizeof(struct darshan_base_record); /* skip however long int+padding is */
p += sizeof(int); p += (rec_len - (BGQ_NUM_INDICES * sizeof(int64_t)) -
(BGQ_F_NUM_INDICES * sizeof(double)));
memcpy(&(rec->counters[0]), p, BGQ_NUM_INDICES * sizeof(int64_t)); memcpy(&(rec->counters[0]), p, BGQ_NUM_INDICES * sizeof(int64_t));
p += (BGQ_NUM_INDICES * sizeof(int64_t)); p += (BGQ_NUM_INDICES * sizeof(int64_t));
memcpy(&(rec->fcounters[0]), p, BGQ_F_NUM_INDICES * sizeof(double)); memcpy(&(rec->fcounters[0]), p, BGQ_F_NUM_INDICES * sizeof(double));
ret = rec_len;
} }
free(buffer); free(buffer);
} }
......
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