Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
darshan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
72
Issues
72
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
darshan
darshan
Commits
1e5a8cb7
Commit
1e5a8cb7
authored
Apr 06, 2015
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mpiio parser
parent
13b92a1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
221 additions
and
2 deletions
+221
-2
darshan-util/Makefile.in
darshan-util/Makefile.in
+7
-2
darshan-util/darshan-mpiio-parser.c
darshan-util/darshan-mpiio-parser.c
+214
-0
No files found.
darshan-util/Makefile.in
View file @
1e5a8cb7
all
:
libdarshan-util.a darshan-posix-parser
all
:
libdarshan-util.a darshan-posix-parser
darshan-mpiio-parser
DESTDIR
=
srcdir
=
@srcdir@
...
...
@@ -68,6 +68,10 @@ jenkins: util/bin/jenkins.o lookup3.o
darshan-posix-parser
:
darshan-posix-parser.c darshan-logutils.h darshan-posix-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h libdarshan-util.a | uthash-1.9.2
$(CC)
$(CFLAGS)
$(LDFLAGS)
$^
-o
$@
$(LIBS)
darshan-mpiio-parser
:
darshan-mpiio-parser.c darshan-logutils.h darshan-mpiio-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h libdarshan-util.a | uthash-1.9.2
$(CC)
$(CFLAGS)
$(LDFLAGS)
$^
-o
$@
$(LIBS)
#darshan-parser: darshan-parser.c $(DARSHAN_LOG_FORMAT) darshan-logutils.h darshan-logutils.o | uthash-1.9.2
# $(CC) $(CFLAGS) $(LDFLAGS) $< darshan-logutils.o -o $@ $(LIBS)
...
...
@@ -101,6 +105,7 @@ install:: all
install
-d
$(pkgconfigdir)
# install -m 755 darshan-parser $(bindir)
install
-m
755
darshan-posix-parser
$(bindir)
install
-m
755
darshan-mpiio-parser
$(bindir)
# install -m 755 darshan-convert $(bindir)
# install -m 755 darshan-diff $(bindir)
# install -m 755 darshan-analyzer $(bindir)
...
...
@@ -123,7 +128,7 @@ endif
clean
::
rm
-f
*
.o
*
.a darshan-posix-parser
rm
-f
*
.o
*
.a darshan-posix-parser
darshan-mpiio-parser
distclean
::
clean
rm
-f
darshan-runtime-config.h aclocal.m4 autom4te.cache/
*
config.status config.log Makefile util/bin/darshan-job-summary.pl
...
...
darshan-util/darshan-mpiio-parser.c
0 → 100644
View file @
1e5a8cb7
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <zlib.h>
#include <time.h>
#include <stdlib.h>
#include <getopt.h>
#include <assert.h>
#include "darshan-logutils.h"
#include "darshan-mpiio-logutils.h"
#include "uthash-1.9.2/src/uthash.h"
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
;
int
i
;
char
*
filename
;
char
tmp_string
[
4096
];
darshan_fd
fd
;
struct
darshan_header
header
;
struct
darshan_job
job
;
struct
darshan_record_ref
*
rec_hash
=
NULL
;
struct
darshan_record_ref
*
ref
;
int
mount_count
;
char
**
mnt_pts
;
char
**
fs_types
;
time_t
tmp_time
=
0
;
char
*
token
;
char
*
save
;
char
buffer
[
DARSHAN_JOB_METADATA_LEN
];
struct
darshan_mpiio_file
next_file
;
assert
(
argc
==
2
);
filename
=
argv
[
1
];
struct
stat
sbuf
;
stat
(
filename
,
&
sbuf
);
fd
=
darshan_log_open
(
filename
,
"r"
);
if
(
!
fd
)
{
fprintf
(
stderr
,
"darshan_log_open() failed to open %s
\n
."
,
filename
);
return
(
-
1
);
}
/**************************************************************/
/* TODO: some of this code should be shared or in a separate executable
* instead of repeated in each module parser
*/
/* read darshan log header */
ret
=
darshan_log_getheader
(
fd
,
&
header
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"darshan_log_getheader() failed to read log header.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
/* read darshan job info */
ret
=
darshan_log_getjob
(
fd
,
&
job
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"darshan_log_getjob() failed to read job data.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
/* get the original command line for this job */
ret
=
darshan_log_getexe
(
fd
,
tmp_string
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Error: unable to read trailing job information.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
/* print job summary */
printf
(
"# darshan log version: %s
\n
"
,
header
.
version_string
);
printf
(
"# size of MPIIO file statistics: %zu bytes
\n
"
,
sizeof
(
struct
darshan_mpiio_file
));
printf
(
"# size of job statistics: %zu bytes
\n
"
,
sizeof
(
struct
darshan_job
));
printf
(
"# exe: %s
\n
"
,
tmp_string
);
printf
(
"# uid: %"
PRId64
"
\n
"
,
job
.
uid
);
printf
(
"# jobid: %"
PRId64
"
\n
"
,
job
.
jobid
);
printf
(
"# start_time: %"
PRId64
"
\n
"
,
job
.
start_time
);
tmp_time
+=
job
.
start_time
;
printf
(
"# start_time_asci: %s"
,
ctime
(
&
tmp_time
));
printf
(
"# end_time: %"
PRId64
"
\n
"
,
job
.
end_time
);
tmp_time
=
0
;
tmp_time
+=
job
.
end_time
;
printf
(
"# end_time_asci: %s"
,
ctime
(
&
tmp_time
));
printf
(
"# nprocs: %"
PRId64
"
\n
"
,
job
.
nprocs
);
printf
(
"# run time: %"
PRId64
"
\n
"
,
job
.
end_time
-
job
.
start_time
+
1
);
for
(
token
=
strtok_r
(
job
.
metadata
,
"
\n
"
,
&
save
);
token
!=
NULL
;
token
=
strtok_r
(
NULL
,
"
\n
"
,
&
save
))
{
char
*
key
;
char
*
value
;
/* NOTE: we intentionally only split on the first = character.
* There may be additional = characters in the value portion
* (for example, when storing mpi-io hints).
*/
strcpy
(
buffer
,
token
);
key
=
buffer
;
value
=
index
(
buffer
,
'='
);
if
(
!
value
)
continue
;
/* convert = to a null terminator to split key and value */
value
[
0
]
=
'\0'
;
value
++
;
printf
(
"# metadata: %s = %s
\n
"
,
key
,
value
);
}
/* get the mount information for this log */
ret
=
darshan_log_getmounts
(
fd
,
&
mnt_pts
,
&
fs_types
,
&
mount_count
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"darshan_log_getmounts() failed to read mount information.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
/* print table of mounted file systems */
printf
(
"
\n
# mounted file systems (mount point and fs type)
\n
"
);
printf
(
"# -------------------------------------------------------
\n
"
);
for
(
i
=
0
;
i
<
mount_count
;
i
++
)
{
printf
(
"# mount entry:
\t
%s
\t
%s
\n
"
,
mnt_pts
[
i
],
fs_types
[
i
]);
}
/* read hash of darshan records */
ret
=
darshan_log_gethash
(
fd
,
&
rec_hash
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"darshan_log_getmap() failed to read record map.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
/* end TODO */
/*******************************************/
printf
(
"
\n
*** FILE RECORD DATA ***
\n
"
);
ret
=
darshan_log_get_mpiio_file
(
fd
,
&
next_file
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"darshan_log_get_mpiio_file() failed to read next record.
\n
"
);
darshan_log_close
(
fd
);
return
(
-
1
);
}
if
(
ret
==
0
)
{
printf
(
"# no files opened.
\n
"
);
darshan_log_close
(
fd
);
return
(
0
);
}
/* loop over each stored MPIIO file record and print counters */
i
=
1
;
do
{
/* get the pathname for this record */
HASH_FIND
(
hlink
,
rec_hash
,
&
next_file
.
f_id
,
sizeof
(
darshan_record_id
),
ref
);
assert
(
ref
);
printf
(
"
\t
Record %d: id=%"
PRIu64
" (path=%s, rank=%"
PRId64
")
\n
"
,
i
,
next_file
.
f_id
,
ref
->
rec
.
name
,
next_file
.
rank
);
/* TODO: does it make sense to put these in a header or something?
* Down side of listing them here is ordering dependency between enum
* in header and names here.
*/
printf
(
"
\t\t
MPIIO_INDEP_OPENS:
\t
%"
PRIu64
"
\n
"
"
\t\t
MPIIO_COLL_OPENS:
\t
%"
PRIu64
"
\n
"
"
\t\t
MPIIO_HINTS:
\t
%"
PRIu64
"
\n
"
"
\t\t
MPIIO_F_META_TIME:
\t
%lf
\n
"
"
\t\t
MPIIO_F_OPEN_TIMESTAMP:
\t
%lf
\n
"
,
next_file
.
counters
[
DARSHAN_MPIIO_INDEP_OPENS
],
next_file
.
counters
[
DARSHAN_MPIIO_COLL_OPENS
],
next_file
.
counters
[
DARSHAN_MPIIO_HINTS
],
next_file
.
fcounters
[
DARSHAN_MPIIO_F_META_TIME
],
next_file
.
fcounters
[
DARSHAN_MPIIO_F_OPEN_TIMESTAMP
]);
i
++
;
}
while
((
ret
=
darshan_log_get_mpiio_file
(
fd
,
&
next_file
))
==
1
);
/* free mount info */
for
(
i
=
0
;
i
<
mount_count
;
i
++
)
{
free
(
mnt_pts
[
i
]);
free
(
fs_types
[
i
]);
}
if
(
mount_count
>
0
)
{
free
(
mnt_pts
);
free
(
fs_types
);
}
darshan_log_close
(
fd
);
return
(
0
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment