Commit e8b628a9 authored by Rob Latham's avatar Rob Latham

promote server counters to 64 bits

the struct alignment is important here, as we are going to read this
struct once to get the fixed values and a second time to fill in the
extra histogram buckets.
parent 00997bbb
......@@ -63,9 +63,12 @@ struct darshan_mdhim_record
double fcounters[MDHIM_F_NUM_INDICES];
/* when we allocate this struct, we'll do so with enough extra memory to
* hold N servers. Compare to approach taken with darshan_lustre_record */
int32_t server_histogram[1];
/* be mindful of struct alignment here: If one reads "sizeof(struct
* darshan_mdhim_record)", one might end up reading more than expected.
* Second read will then end up reading less than needed */
int64_t server_histogram[1];
};
/* '-1' because d_m_r already allocated with space for one */
#define MDHIM_RECORD_SIZE(servers) (sizeof(struct darshan_mdhim_record) + sizeof(int32_t) * ((servers) - 1) )
#define MDHIM_RECORD_SIZE(servers) (sizeof(struct darshan_mdhim_record) + sizeof(int64_t) * ((servers) - 1) )
#endif /* __DARSHAN_MDHIM_LOG_FORMAT_H */
......@@ -89,7 +89,7 @@ static int darshan_log_get_mdhim_record(darshan_fd fd, void** mdhim_buf_p)
DARSHAN_BSWAP64(&tmp_rec.counters[i]);
for (i=0; i< MDHIM_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&tmp_rec.fcounters[i]);
DARSHAN_BSWAP32(&(tmp_rec.server_histogram[0]) );
DARSHAN_BSWAP64(&(tmp_rec.server_histogram[0]) );
}
if(*mdhim_buf_p == NULL)
......@@ -103,16 +103,16 @@ static int darshan_log_get_mdhim_record(darshan_fd fd, void** mdhim_buf_p)
if (rec->counters[MDHIM_SERVERS] > 1) {
ret = darshan_log_get_mod(fd, DARSHAN_MDHIM_MOD,
&(rec->server_histogram[1]),
(rec->counters[MDHIM_SERVERS] - 1)*sizeof(int32_t));
(rec->counters[MDHIM_SERVERS] - 1)*sizeof(int64_t));
if (ret < (rec->counters[MDHIM_SERVERS] -1)*sizeof(int32_t))
if (ret < (rec->counters[MDHIM_SERVERS] -1)*sizeof(int64_t))
ret = -1;
else
{
ret = 1;
if (fd->swap_flag)
for(i=1; i< rec->counters[MDHIM_SERVERS]; i++)
DARSHAN_BSWAP32(&(rec->server_histogram[i]));
DARSHAN_BSWAP64(&(rec->server_histogram[i]));
}
}
else
......
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