Skip to content

Commit 8583db0

Browse files
committed
darshan-parser.c add command-line option --version to print Darshan version
1 parent b8f3dd8 commit 8583db0

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

darshan-util/darshan-parser.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
/*
2828
* Options
2929
*/
30-
#define OPTION_BASE (1 << 0) /* darshan log fields */
31-
#define OPTION_TOTAL (1 << 1) /* aggregated fields */
32-
#define OPTION_PERF (1 << 2) /* derived performance */
33-
#define OPTION_FILE (1 << 3) /* file count totals */
30+
#define OPTION_BASE (1 << 0) /* Darshan log fields */
31+
#define OPTION_TOTAL (1 << 1) /* aggregated fields */
32+
#define OPTION_PERF (1 << 2) /* derived performance */
33+
#define OPTION_FILE (1 << 3) /* file count totals */
34+
#define OPTION_VERSION (1 << 4) /* print Darshan version number */
3435
#define OPTION_SHOW_INCOMPLETE (1 << 7) /* show what we have, even if log is incomplete */
3536
#define OPTION_ALL (\
3637
OPTION_BASE|\
@@ -57,11 +58,13 @@ void daos_print_total_file(struct darshan_daos_object *pfile, int daos_ver);
5758
int usage (char *exename)
5859
{
5960
fprintf(stderr, "Usage: %s [options] <filename>\n", exename);
60-
fprintf(stderr, " --all : all sub-options are enabled\n");
61-
fprintf(stderr, " --base : darshan log field data [default]\n");
62-
fprintf(stderr, " --file : total file counts\n");
63-
fprintf(stderr, " --perf : derived perf data\n");
64-
fprintf(stderr, " --total : aggregated darshan field data\n");
61+
fprintf(stderr, " --help : prints this help message and exits\n");
62+
fprintf(stderr, " --version : prints Darshan version number and exits\n");
63+
fprintf(stderr, " --all : all sub-options are enabled\n");
64+
fprintf(stderr, " --base : Darshan log field data [default]\n");
65+
fprintf(stderr, " --file : total file counts\n");
66+
fprintf(stderr, " --perf : derived perf data\n");
67+
fprintf(stderr, " --total : aggregated Darshan field data\n");
6568
fprintf(stderr, " --show-incomplete : display results even if log is incomplete\n");
6669

6770
exit(1);
@@ -80,6 +83,7 @@ int parse_args (int argc, char **argv, char **filename)
8083
{"total", 0, NULL, OPTION_TOTAL},
8184
{"show-incomplete", 0, NULL, OPTION_SHOW_INCOMPLETE},
8285
{"help", 0, NULL, 0},
86+
{"version", 0, NULL, OPTION_VERSION},
8387
{0, 0, 0, 0}
8488
};
8589

@@ -101,6 +105,9 @@ int parse_args (int argc, char **argv, char **filename)
101105
case OPTION_SHOW_INCOMPLETE:
102106
mask |= c;
103107
break;
108+
case OPTION_VERSION:
109+
printf("%s\n",VERSION);
110+
exit(0);
104111
case 0:
105112
case '?':
106113
default:
@@ -349,7 +356,7 @@ int main(int argc, char **argv)
349356
"\n# To avoid this error, consult the darshan-runtime\n"
350357
"# documentation and consider setting the\n"
351358
"# DARSHAN_EXCLUDE_DIRS environment variable to prevent\n"
352-
"# Darshan from instrumenting unecessary files.\n");
359+
"# Darshan from instrumenting unnecessary files.\n");
353360
if(fd->mod_map[i].len == 0)
354361
continue; // no data to parse
355362
}
@@ -365,7 +372,7 @@ int main(int argc, char **argv)
365372
"\n# To avoid this error, consult the darshan-runtime\n"
366373
"# documentation and consider setting the\n"
367374
"# DARSHAN_EXCLUDE_DIRS environment variable to prevent\n"
368-
"# Darshan from instrumenting unecessary files.\n");
375+
"# Darshan from instrumenting unnecessary files.\n");
369376
fprintf(stderr,
370377
"\n# You can display the (incomplete) data that is\n"
371378
"# present in this log using the --show-incomplete\n"

0 commit comments

Comments
 (0)