[Darshan-commits] [Git][darshan/darshan][autoperf-mod] 3 commits: clean up string handling in darshan_log_put_mounts()
Philip Carns
xgitlab at cels.anl.gov
Thu Feb 22 14:09:08 CST 2018
Philip Carns pushed to branch autoperf-mod at darshan / darshan
Commits:
b5a2087b by Phil Carns at 2018-02-22T13:37:35-05:00
clean up string handling in darshan_log_put_mounts()
- - - - -
43a2233e by Phil Carns at 2018-02-22T15:01:01-05:00
clean up dxt print routines
- resolve warnings
- make format more consistent
- - - - -
9d2a0f3e by Phil Carns at 2018-02-22T15:08:57-05:00
Merge remote-tracking branch 'origin/master' into autoperf-mod
- - - - -
2 changed files:
- darshan-util/darshan-dxt-logutils.c
- darshan-util/darshan-logutils.c
Changes:
=====================================
darshan-util/darshan-dxt-logutils.c
=====================================
--- a/darshan-util/darshan-dxt-logutils.c
+++ b/darshan-util/darshan-dxt-logutils.c
@@ -290,8 +290,8 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
}
printf("\n# DXT, file_id: %" PRIu64 ", file_name: %s\n", f_id, file_name);
- printf("# DXT, rank: %d, hostname: %s\n", rank, hostname);
- printf("# DXT, write_count: %d, read_count: %d\n",
+ printf("# DXT, rank: %" PRId64 ", hostname: %s\n", rank, hostname);
+ printf("# DXT, write_count: %" PRId64 ", read_count: %" PRId64 "\n",
write_count, read_count);
printf("# DXT, mnt_pt: %s, fs_type: %s\n", mnt_pt, fs_type);
@@ -304,7 +304,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
printf("# DXT, Lustre OST obdidx:");
for (i = 0; i < stripe_count; i++) {
- printf(" %d", (rec->ost_ids)[i]);
+ printf(" %" PRId64, (rec->ost_ids)[i]);
}
printf("\n");
}
@@ -324,7 +324,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
start_time = io_trace[i].start_time;
end_time = io_trace[i].end_time;
- printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "X_POSIX", rank, "write", i, offset, length, start_time, end_time);
+ printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f", "X_POSIX", rank, "write", i, offset, length, start_time, end_time);
if (lustreFS) {
cur_offset = offset;
@@ -332,7 +332,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
print_count = 0;
while (cur_offset < offset + length) {
- printf(" [%3d]", (rec->ost_ids)[ost_idx]);
+ printf(" [%3" PRId64 "]", (rec->ost_ids)[ost_idx]);
cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
@@ -352,7 +352,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
start_time = io_trace[i].start_time;
end_time = io_trace[i].end_time;
- printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "X_POSIX", rank, "read", i - write_count, offset, length, start_time, end_time);
+ printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f", "X_POSIX", rank, "read", (int)(i - write_count), offset, length, start_time, end_time);
if (lustreFS) {
cur_offset = offset;
@@ -360,7 +360,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
print_count = 0;
while (cur_offset < offset + length) {
- printf(" [%3d]", (rec->ost_ids)[ost_idx]);
+ printf(" [%3" PRId64 "]", (rec->ost_ids)[ost_idx]);
cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
@@ -382,7 +382,6 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name,
struct dxt_file_record *file_rec =
(struct dxt_file_record *)mpiio_file_rec;
- int64_t offset;
int64_t length;
double start_time;
double end_time;
@@ -399,8 +398,8 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name,
((void *)file_rec + sizeof(struct dxt_file_record));
printf("\n# DXT, file_id: %" PRIu64 ", file_name: %s\n", f_id, file_name);
- printf("# DXT, rank: %d, hostname: %s\n", rank, hostname);
- printf("# DXT, write_count: %d, read_count: %d\n",
+ printf("# DXT, rank: %" PRId64 ", hostname: %s\n", rank, hostname);
+ printf("# DXT, write_count: %" PRId64 ", read_count: %" PRId64 "\n",
write_count, read_count);
printf("# DXT, mnt_pt: %s, fs_type: %s\n", mnt_pt, fs_type);
@@ -410,52 +409,24 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name,
/* Print IO Traces information */
for (i = 0; i < write_count; i++) {
- offset = io_trace[i].offset;
length = io_trace[i].length;
start_time = io_trace[i].start_time;
end_time = io_trace[i].end_time;
- printf("%8s%8d%7s%9lld%13lld%12.4f%12.4f\n", "X_MPIIO", rank, "write", i, length, start_time, end_time);
+ printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "write", i, length, start_time, end_time);
}
for (i = write_count; i < write_count + read_count; i++) {
- offset = io_trace[i].offset;
length = io_trace[i].length;
start_time = io_trace[i].start_time;
end_time = io_trace[i].end_time;
- printf("%8s%8d%7s%9lld%13lld%12.4f%12.4f\n", "X_MPIIO", rank, "read", i - write_count, length, start_time, end_time);
+ printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "read", (int)(i - write_count), length, start_time, end_time);
}
return;
}
-static void dxt_log_print_posix_description(int ver)
-{
-}
-
-static void dxt_log_print_mpiio_description(int ver)
-{
-}
-
-static void dxt_log_print_posix_file_diff(void *file_rec1, char *file_name1,
- void *file_rec2, char *file_name2)
-{
-}
-
-static void dxt_log_print_mpiio_file_diff(void *file_rec1, char *file_name1,
- void *file_rec2, char *file_name2)
-{
-}
-
-static void dxt_log_agg_posix_files(void *rec, void *agg_rec, int init_flag)
-{
-}
-
-static void dxt_log_agg_mpiio_files(void *rec, void *agg_rec, int init_flag)
-{
-}
-
/*
* Local variables:
* c-indent-level: 4
=====================================
darshan-util/darshan-logutils.c
=====================================
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -477,27 +477,32 @@ int darshan_log_put_mounts(darshan_fd fd, struct darshan_mnt_info *mnt_data_arra
{
struct darshan_fd_int_state *state = fd->state;
int i;
- char line[1024];
char mnt_dat[DARSHAN_EXE_LEN] = {0};
- int mnt_dat_sz = 0;
- char *tmp;
int ret;
+ int left = DARSHAN_EXE_LEN;
+ int pos = 0;
assert(state);
/* write each mount entry to file */
- tmp = mnt_dat;
for(i=count-1; i>=0; i--)
{
- sprintf(line, "\n%s\t%s", mnt_data_array[i].mnt_type, mnt_data_array[i].mnt_path);
-
- memcpy(tmp, line, strlen(line));
- tmp += strlen(line);
- mnt_dat_sz += strlen(line);
+ if((strlen(mnt_data_array[i].mnt_type) + strlen(mnt_data_array[i].mnt_path) + 2) < left)
+ {
+ ret = snprintf(&mnt_dat[pos], left, "\n%s\t%s", mnt_data_array[i].mnt_type, mnt_data_array[i].mnt_path);
+ left -= ret;
+ assert(left >= 0);
+ pos += ret;
+ }
+ else
+ {
+ break;
+ }
}
+ pos++;
- ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, mnt_dat, mnt_dat_sz);
- if (ret != mnt_dat_sz)
+ ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, mnt_dat, pos);
+ if (ret != pos)
{
state->err = -1;
fprintf(stderr, "Error: failed to write darshan log mount data.\n");
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/f7465b8b6ecbc7e9d09c62f4a702584bfb76e1e3...9d2a0f3e395875daaeb96c68143d35935980fdd9
---
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/f7465b8b6ecbc7e9d09c62f4a702584bfb76e1e3...9d2a0f3e395875daaeb96c68143d35935980fdd9
You're receiving this email because of your account on xgitlab.cels.anl.gov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20180222/11c223c4/attachment-0001.html>
More information about the Darshan-commits
mailing list