Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shane Snyder
darshan
Commits
ca202304
Commit
ca202304
authored
Sep 29, 2015
by
Shane Snyder
Browse files
code cleanup + finalized dev-modular docs
parent
0459f8ff
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
darshan-null-log-format.h
View file @
ca202304
...
...
@@ -9,23 +9,35 @@
#include
"darshan-log-format.h"
#define NULL_COUNTERS \
/* count of number of 'bar' function calls */
\
X(NULL_BARS) \
/* arbitrary data value set by last call to 'bar' */
\
X(NULL_BAR_DAT) \
/* end of counters */
\
X(NULL_NUM_INDICES)
#define NULL_F_COUNTERS \
/* timestamp of the first call to function 'bar' */
\
X(NULL_F_BAR_TIMESTAMP) \
/* timer indicating duration of last call to 'bar' */
\
X(NULL_F_BAR_DURATION) \
/* end of counters */
\
X(NULL_F_NUM_INDICES)
#define X(a) a,
/* integer counters for the "NULL" example module */
enum
darshan_null_indices
{
NULL_BARS
,
/* count of number of 'bar' function calls */
NULL_BAR_DAT
,
/* arbitrary data value set by last call to 'bar' */
NULL_NUM_INDICES
,
NULL_COUNTERS
};
/* floating point counters for the "NULL" example module */
enum
darshan_null_f_indices
{
NULL_F_BAR_TIMESTAMP
,
/* timestamp of the first call to function 'bar' */
NULL_F_BAR_DURATION
,
/* timer indicating duration of last call to 'bar' */
NULL_F_NUM_INDICES
,
NULL_F_COUNTERS
};
#undef X
/* the darshan_null_record structure encompasses the high-level data/counters
* which would actually be logged to file by Darshan for the "NULL" example
...
...
darshan-runtime/Makefile.in
View file @
ca202304
all
:
lib/libdarshan.a lib/libdarshan-stubs.a lib/darshan-null.o
#TODO: each module provides own makefile with module-specific objects, build options, etc.
DESTDIR
=
srcdir
=
@srcdir@
prefix
=
@prefix@
...
...
darshan-util/Makefile.in
View file @
ca202304
all
:
libdarshan-util.a darshan-analyzer darshan-convert darshan-parser jenkins-hash-gen
all
:
libdarshan-util.a
darshan-null-logutils.o
darshan-analyzer darshan-convert darshan-parser jenkins-hash-gen
DESTDIR
=
srcdir
=
@srcdir@
...
...
@@ -21,7 +21,7 @@ DARSHAN_ENABLE_SHARED=@DARSHAN_ENABLE_SHARED@
VPATH
=
$(srcdir)
ifeq
($(DARSHAN_ENABLE_SHARED),1)
all
:
libdarshan-util.so
all
:
libdarshan-util.so
darshan-null-logutils.po
endif
cp_zlib_link_flags
=
@__DARSHAN_ZLIB_LINK_FLAGS@
cp_zlib_include_flags
=
@__DARSHAN_ZLIB_INCLUDE_FLAGS@
...
...
@@ -49,6 +49,11 @@ darshan-logutils.o: darshan-logutils.c darshan-logutils.h $(DARSHAN_LOG_FORMAT)
darshan-logutils.po
:
darshan-logutils.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) | uthash-1.9.2
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
darshan-null-logutils.o
:
darshan-null-logutils.c darshan-logutils.h darshan-null-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | uthash-1.9.2
$(CC)
$(CFLAGS)
-c
$<
-o
$@
darshan-null-logutils.po
:
darshan-null-logutils.c darshan-logutils.h darshan-null-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-null-log-format.h | uthash-1.9.2
$(CC)
$(CFLAGS_SHARED)
-c
$<
-o
$@
darshan-posix-logutils.o
:
darshan-posix-logutils.c darshan-logutils.h darshan-posix-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | uthash-1.9.2
$(CC)
$(CFLAGS)
-c
$<
-o
$@
darshan-posix-logutils.po
:
darshan-posix-logutils.c darshan-logutils.h darshan-posix-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | uthash-1.9.2
...
...
@@ -135,7 +140,7 @@ endif
clean
::
rm
-f
*
.o
*
.a darshan-analyzer darshan-convert darshan-parser jenkins-hash-gen
rm
-f
*
.o
*
.po
*
.a darshan-analyzer darshan-convert darshan-parser jenkins-hash-gen
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-logutils.c
View file @
ca202304
...
...
@@ -86,8 +86,6 @@ static int darshan_log_bzip2_flush(darshan_fd fd, int region_id);
static
int
darshan_log_dzload
(
darshan_fd
fd
,
struct
darshan_log_map
map
);
static
int
darshan_log_dzunload
(
darshan_fd
fd
,
struct
darshan_log_map
*
map_p
);
/* TODO: check comments on functions to make sure they are right /cleanup */
/* each module's implementation of the darshan logutil functions */
#define X(a, b, c) c,
struct
darshan_mod_logutil_funcs
*
mod_logutils
[
DARSHAN_MAX_MODS
]
=
...
...
@@ -685,10 +683,10 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
*
* get a chunk of module data from the darshan log file
*
* returns
0
on success, -1 on failure
* returns
number of bytes read
on success, -1 on failure
*/
int
darshan_log_getmod
(
darshan_fd
fd
,
darshan_module_id
mod_id
,
void
*
buf
,
int
len
)
void
*
mod_
buf
,
int
mod_buf_sz
)
{
struct
darshan_fd_int_state
*
state
=
fd
->
state
;
int
ret
;
...
...
@@ -705,7 +703,7 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
return
(
0
);
/* no data corresponding to this mod_id */
/* read this module's data from the log file */
ret
=
darshan_log_dzread
(
fd
,
mod_id
,
buf
,
len
);
ret
=
darshan_log_dzread
(
fd
,
mod_id
,
mod_
buf
,
mod_buf_sz
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
...
...
@@ -727,7 +725,7 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
* should be called in order of increasing module identifiers,
* as the darshan log file format expects this ordering.
*
* returns
0
on success, -1 on failure
* returns
number of bytes written
on success, -1 on failure
*/
int
darshan_log_putmod
(
darshan_fd
fd
,
darshan_module_id
mod_id
,
void
*
mod_buf
,
int
mod_buf_sz
)
...
...
@@ -762,7 +760,6 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
*
* close an open darshan file descriptor, freeing any resources
*
* returns 0 on success, -1 on failure
*/
void
darshan_log_close
(
darshan_fd
fd
)
{
...
...
darshan-util/darshan-logutils.h
View file @
ca202304
...
...
@@ -48,13 +48,18 @@ struct darshan_record_ref
*/
struct
darshan_mod_logutil_funcs
{
/* retrieve a single module record from the log file */
/* retrieve a single module record from the log file.
* return 1 on successful read of record, 0 on no more
* module data, -1 on error
*/
int
(
*
log_get_record
)(
darshan_fd
fd
,
void
*
buf
,
darshan_record_id
*
rec_id
);
/* put a single module record into the log file */
/* put a single module record into the log file.
* return 0 on success, -1 on error
*/
int
(
*
log_put_record
)(
darshan_fd
fd
,
void
*
buf
...
...
@@ -89,7 +94,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts,
int
darshan_log_gethash
(
darshan_fd
fd
,
struct
darshan_record_ref
**
hash
);
int
darshan_log_puthash
(
darshan_fd
fd
,
struct
darshan_record_ref
*
hash
);
int
darshan_log_getmod
(
darshan_fd
fd
,
darshan_module_id
mod_id
,
void
*
buf
,
int
len
);
void
*
mod_
buf
,
int
mod_buf_sz
);
int
darshan_log_putmod
(
darshan_fd
fd
,
darshan_module_id
mod_id
,
void
*
mod_buf
,
int
mod_buf_sz
);
void
darshan_log_close
(
darshan_fd
file
);
...
...
darshan-util/darshan-null-logutils.c
0 → 100644
View file @
ca202304
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#define _GNU_SOURCE
#include
"darshan-util-config.h"
#include
<stdio.h>
#include
<string.h>
#include
<assert.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<inttypes.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<fcntl.h>
#include
<errno.h>
#include
"darshan-null-logutils.h"
/* integer counter name strings for the NULL module */
#define X(a) #a,
char
*
null_counter_names
[]
=
{
NULL_COUNTERS
};
/* floating point counter name strings for the NULL module */
char
*
null_f_counter_names
[]
=
{
NULL_F_COUNTERS
};
#undef X
/* prototypes for each of the NULL module's logutil functions */
static
int
darshan_log_get_null_record
(
darshan_fd
fd
,
void
*
null_buf
,
darshan_record_id
*
rec_id
);
static
int
darshan_log_put_null_record
(
darshan_fd
fd
,
void
*
null_buf
);
static
void
darshan_log_print_null_record
(
void
*
file_rec
,
char
*
file_name
,
char
*
mnt_pt
,
char
*
fs_type
);
/* structure storing each function needed for implementing the darshan
* logutil interface. these functions are used for reading, writing, and
* printing module data in a consistent manner.
*/
struct
darshan_mod_logutil_funcs
null_logutils
=
{
.
log_get_record
=
&
darshan_log_get_null_record
,
.
log_put_record
=
&
darshan_log_put_null_record
,
.
log_print_record
=
&
darshan_log_print_null_record
,
};
/* retrieve a NULL record from log file descriptor 'fd', storing the
* buffer in 'null_buf' and the corresponding Darshan record id in
* 'rec_id'. Return 1 on successful record read, .
*/
static
int
darshan_log_get_null_record
(
darshan_fd
fd
,
void
*
null_buf
,
darshan_record_id
*
rec_id
)
{
struct
darshan_null_record
*
rec
;
int
i
;
int
ret
;
/* read a NULL module record from the darshan log file */
ret
=
darshan_log_getmod
(
fd
,
DARSHAN_NULL_MOD
,
null_buf
,
sizeof
(
struct
darshan_null_record
));
if
(
ret
<
0
)
return
(
-
1
);
else
if
(
ret
<
sizeof
(
struct
darshan_null_record
))
return
(
0
);
else
{
/* if the read was successful, do any necessary byte-swapping */
rec
=
(
struct
darshan_null_record
*
)
null_buf
;
if
(
fd
->
swap_flag
)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64
(
&
rec
->
f_id
);
DARSHAN_BSWAP64
(
&
rec
->
rank
);
for
(
i
=
0
;
i
<
NULL_NUM_INDICES
;
i
++
)
DARSHAN_BSWAP64
(
&
rec
->
counters
[
i
]);
for
(
i
=
0
;
i
<
NULL_F_NUM_INDICES
;
i
++
)
DARSHAN_BSWAP64
(
&
rec
->
fcounters
[
i
]);
}
/* set the output record id */
*
rec_id
=
rec
->
f_id
;
return
(
1
);
}
}
/* write the NULL record stored in 'null_buf' to log file descriptor 'fd'.
* Return 0 on success, -1 on failure
*/
static
int
darshan_log_put_null_record
(
darshan_fd
fd
,
void
*
null_buf
)
{
struct
darshan_null_record
*
rec
=
(
struct
darshan_null_record
*
)
null_buf
;
int
ret
;
/* append NULL record to darshan log file */
ret
=
darshan_log_putmod
(
fd
,
DARSHAN_NULL_MOD
,
rec
,
sizeof
(
struct
darshan_null_record
));
if
(
ret
<
0
)
return
(
-
1
);
return
(
0
);
}
/* print all I/O data record statistics for the given NULL record */
static
void
darshan_log_print_null_record
(
void
*
file_rec
,
char
*
file_name
,
char
*
mnt_pt
,
char
*
fs_type
)
{
int
i
;
struct
darshan_null_record
*
null_rec
=
(
struct
darshan_null_record
*
)
file_rec
;
/* print each of the integer and floating point counters for the NULL module */
for
(
i
=
0
;
i
<
NULL_NUM_INDICES
;
i
++
)
{
/* macro defined in darshan-logutils.h */
DARSHAN_COUNTER_PRINT
(
darshan_module_names
[
DARSHAN_NULL_MOD
],
null_rec
->
rank
,
null_rec
->
f_id
,
null_counter_names
[
i
],
null_rec
->
counters
[
i
],
file_name
,
mnt_pt
,
fs_type
);
}
for
(
i
=
0
;
i
<
NULL_F_NUM_INDICES
;
i
++
)
{
/* macro defined in darshan-logutils.h */
DARSHAN_F_COUNTER_PRINT
(
darshan_module_names
[
DARSHAN_NULL_MOD
],
null_rec
->
rank
,
null_rec
->
f_id
,
null_f_counter_names
[
i
],
null_rec
->
fcounters
[
i
],
file_name
,
mnt_pt
,
fs_type
);
}
return
;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
darshan-util/darshan-null-logutils.h
0 → 100644
View file @
ca202304
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __DARSHAN_NULL_LOG_UTILS_H
#define __DARSHAN_NULL_LOG_UTILS_H
#include
"darshan-logutils.h"
#include
"darshan-null-log-format.h"
/* declare NULL module counter name strings and logutil definition as
* extern variables so they can be used in other utilities
*/
extern
char
*
null_counter_names
[];
extern
char
*
null_f_counter_names
[];
extern
struct
darshan_mod_logutil_funcs
null_logutils
;
#endif
doc/darshan-modularization.txt
View file @
ca202304
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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