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
1110d3a6
Commit
1110d3a6
authored
Mar 26, 2015
by
Shane Snyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor exclusions list and macros out of modules
parent
1592fd9f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
100 deletions
+75
-100
darshan-runtime/darshan-core.h
darshan-runtime/darshan-core.h
+0
-3
darshan-runtime/darshan.h
darshan-runtime/darshan.h
+44
-0
darshan-runtime/lib/darshan-core.c
darshan-runtime/lib/darshan-core.c
+15
-0
darshan-runtime/lib/darshan-mpiio.c
darshan-runtime/lib/darshan-mpiio.c
+1
-31
darshan-runtime/lib/darshan-posix.c
darshan-runtime/lib/darshan-posix.c
+15
-66
No files found.
darshan-runtime/darshan-core.h
View file @
1110d3a6
...
...
@@ -13,9 +13,6 @@
#include "darshan.h"
/* TODO: this goes where ? -- shared libs */
#define DARSHAN_MPI_CALL(func) func
#define DARSHAN_CORE_MAX_RECORDS 1024
/* TODO: revisit this default size if we change memory per module */
...
...
darshan-runtime/darshan.h
View file @
1110d3a6
...
...
@@ -26,6 +26,47 @@
/* Environment variable to override __CP_MEM_ALIGNMENT */
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
/* macros for declaring wrapper functions and calling MPI routines
* consistently regardless of whether static or dynamic linking is used
*/
#ifdef DARSHAN_PRELOAD
#define __USE_GNU
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL;
#define DARSHAN_DECL(__name) __name
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define MAP_OR_FAIL(func) \
if (!(__real_ ## func)) \
{ \
__real_ ## func = dlsym(RTLD_NEXT, #func); \
if(!(__real_ ## func)) { \
fprintf(stderr, "Darshan failed to map symbol: %s\n", #func); \
exit(1); \
} \
}
#else
#define DARSHAN_FORWARD_DECL(name,ret,args) \
extern ret __real_ ## name args;
#define DARSHAN_DECL(__name) __wrap_ ## __name
#define DARSHAN_MPI_CALL(func) func
#define MAP_OR_FAIL(func)
#endif
/* macros for manipulating module's counter variables */
/* NOTE: */
/* module developers provide the following functions to darshan-core */
struct
darshan_module_funcs
{
...
...
@@ -55,6 +96,9 @@ struct darshan_module_funcs
void
(
*
shutdown
)(
void
);
};
/* paths that darshan will not trace */
extern
char
*
darshan_path_exclusions
[];
/* defined in lib/darshan-core.c */
/*****************************************************
* darshan-core functions exported to darshan modules *
*****************************************************/
...
...
darshan-runtime/lib/darshan-core.c
View file @
1110d3a6
...
...
@@ -37,6 +37,21 @@ static pthread_mutex_t darshan_core_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_
static
int
my_rank
=
-
1
;
static
int
nprocs
=
-
1
;
/* paths prefixed with the following directories are not traced by darshan */
char
*
darshan_path_exclusions
[]
=
{
"/etc/"
,
"/dev/"
,
"/usr/"
,
"/bin/"
,
"/boot/"
,
"/lib/"
,
"/opt/"
,
"/sbin/"
,
"/sys/"
,
"/proc/"
,
NULL
};
#define DARSHAN_CORE_LOCK() pthread_mutex_lock(&darshan_core_mutex)
#define DARSHAN_CORE_UNLOCK() pthread_mutex_unlock(&darshan_core_mutex)
...
...
darshan-runtime/lib/darshan-mpiio.c
View file @
1110d3a6
...
...
@@ -28,20 +28,6 @@
#include "darshan.h"
#include "darshan-mpiio-log-format.h"
/* TODO: move this stuff to a shared header somewhere */
#ifdef DARSHAN_PRELOAD
#define __USE_GNU
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_MPI_CALL(func) __real_ ## func
#else
#define DARSHAN_MPI_CALL(func) func
#endif
struct
mpiio_runtime_file
{
struct
darshan_mpiio_file
*
file_record
;
...
...
@@ -72,22 +58,6 @@ static pthread_mutex_t mpiio_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER
static
int
instrumentation_disabled
=
0
;
static
int
my_rank
=
-
1
;
/* TODO: I'm sure these should be applied on all modules */
/* these are paths that we will not trace */
static
char
*
exclusions
[]
=
{
"/etc/"
,
"/dev/"
,
"/usr/"
,
"/bin/"
,
"/boot/"
,
"/lib/"
,
"/opt/"
,
"/sbin/"
,
"/sys/"
,
"/proc/"
,
NULL
};
#define MPIIO_LOCK() pthread_mutex_lock(&mpiio_runtime_mutex)
#define MPIIO_UNLOCK() pthread_mutex_unlock(&mpiio_runtime_mutex)
...
...
@@ -323,7 +293,7 @@ static void posix_shutdown(void);
char* exclude; \
int tmp_index = 0; \
if(__ret < 0) break; \
while((exclude = exclusions[tmp_index])) { \
while((exclude =
darshan_path_
exclusions[tmp_index])) { \
if(!(strncmp(exclude, __path, strlen(exclude)))) \
break; \
tmp_index++; \
...
...
darshan-runtime/lib/darshan-posix.c
View file @
1110d3a6
...
...
@@ -35,41 +35,6 @@ typedef int64_t off64_t;
#define aiocb64 aiocb
#endif
#ifdef DARSHAN_PRELOAD
#define __USE_GNU
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL;
#define DARSHAN_DECL(__name) __name
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define MAP_OR_FAIL(func) \
if (!(__real_ ## func)) \
{ \
__real_ ## func = dlsym(RTLD_NEXT, #func); \
if(!(__real_ ## func)) { \
fprintf(stderr, "Darshan failed to map symbol: %s\n", #func); \
exit(1); \
} \
}
#else
#define DARSHAN_FORWARD_DECL(name,ret,args) \
extern ret __real_ ## name args;
#define DARSHAN_DECL(__name) __wrap_ ## __name
#define DARSHAN_MPI_CALL(func) func
#define MAP_OR_FAIL(func)
#endif
/* TODO: more libc, fgetc, etc etc etc. */
DARSHAN_FORWARD_DECL
(
open
,
int
,
(
const
char
*
path
,
int
flags
,
...));
...
...
@@ -86,6 +51,20 @@ DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcn
DARSHAN_FORWARD_DECL
(
writev
,
ssize_t
,
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
));
DARSHAN_FORWARD_DECL
(
close
,
int
,
(
int
fd
));
static
void
posix_runtime_initialize
(
void
);
static
struct
posix_file_runtime
*
posix_file_by_name
(
const
char
*
name
);
static
struct
posix_file_runtime
*
posix_file_by_name_setfd
(
const
char
*
name
,
int
fd
);
static
struct
posix_file_runtime
*
posix_file_by_fd
(
int
fd
);
static
void
posix_file_close_fd
(
int
fd
);
static
void
posix_disable_instrumentation
(
void
);
static
void
posix_prepare_for_reduction
(
darshan_record_id
*
shared_recs
,
int
*
shared_rec_count
,
void
**
send_buf
,
void
**
recv_buf
,
int
*
rec_size
);
static
void
posix_record_reduction_op
(
void
*
infile_v
,
void
*
inoutfile_v
,
int
*
len
,
MPI_Datatype
*
datatype
);
static
void
posix_get_output_data
(
void
**
buffer
,
int
*
size
);
static
void
posix_shutdown
(
void
);
struct
posix_file_runtime
{
struct
darshan_posix_file
*
file_record
;
...
...
@@ -119,36 +98,6 @@ static pthread_mutex_t posix_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER
static
int
instrumentation_disabled
=
0
;
static
int
my_rank
=
-
1
;
/* TODO: I'm sure these should be applied on all modules */
/* these are paths that we will not trace */
static
char
*
exclusions
[]
=
{
"/etc/"
,
"/dev/"
,
"/usr/"
,
"/bin/"
,
"/boot/"
,
"/lib/"
,
"/opt/"
,
"/sbin/"
,
"/sys/"
,
"/proc/"
,
NULL
};
static
void
posix_runtime_initialize
(
void
);
static
struct
posix_file_runtime
*
posix_file_by_name
(
const
char
*
name
);
static
struct
posix_file_runtime
*
posix_file_by_name_setfd
(
const
char
*
name
,
int
fd
);
static
struct
posix_file_runtime
*
posix_file_by_fd
(
int
fd
);
static
void
posix_file_close_fd
(
int
fd
);
static
void
posix_disable_instrumentation
(
void
);
static
void
posix_prepare_for_reduction
(
darshan_record_id
*
shared_recs
,
int
*
shared_rec_count
,
void
**
send_buf
,
void
**
recv_buf
,
int
*
rec_size
);
static
void
posix_record_reduction_op
(
void
*
infile_v
,
void
*
inoutfile_v
,
int
*
len
,
MPI_Datatype
*
datatype
);
static
void
posix_get_output_data
(
void
**
buffer
,
int
*
size
);
static
void
posix_shutdown
(
void
);
#define POSIX_LOCK() pthread_mutex_lock(&posix_runtime_mutex)
#define POSIX_UNLOCK() pthread_mutex_unlock(&posix_runtime_mutex)
...
...
@@ -195,7 +144,7 @@ static void posix_shutdown(void);
char* exclude; \
int tmp_index = 0; \
if(__ret < 0) break; \
while((exclude = exclusions[tmp_index])) { \
while((exclude =
darshan_path_
exclusions[tmp_index])) { \
if(!(strncmp(exclude, __path, strlen(exclude)))) \
break; \
tmp_index++; \
...
...
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