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
darshan
darshan
Commits
76d33b22
Commit
76d33b22
authored
Aug 20, 2016
by
Philip Carns
Browse files
Merge branch 'master' into dev-stdio-utils
parents
4ba7a24d
173d3d49
Changes
20
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/darshan.h
View file @
76d33b22
...
...
@@ -144,6 +144,12 @@ void *darshan_core_register_record(
int
rec_len
,
struct
darshan_fs_info
*
fs_info
);
/* TODO */
void
darshan_instrument_fs_data
(
int
fs_type
,
const
char
*
path
,
int
fd
);
/* darshan_core_wtime()
*
* Returns the elapsed time relative to (roughly) the start of
...
...
darshan-runtime/lib/darshan-common.c
View file @
76d33b22
...
...
@@ -126,7 +126,11 @@ char* darshan_clean_file_path(const char* path)
char
*
cwd
=
NULL
;
char
*
filter
=
NULL
;
if
(
!
path
||
strlen
(
path
)
<
1
)
/* NOTE: the last check in this if statement is for path strings that
* begin with the '<' character. We assume that these are special
* reserved paths used by Darshan, like <STDIN>.
*/
if
(
!
path
||
strlen
(
path
)
<
1
||
path
[
0
]
==
'<'
)
return
(
NULL
);
if
(
path
[
0
]
==
'/'
)
...
...
darshan-runtime/lib/darshan-core.c
View file @
76d33b22
...
...
@@ -80,6 +80,13 @@ void (*mod_static_init_fns[])(void) =
NULL
};
#ifdef DARSHAN_LUSTRE
/* XXX need to use extern to get Lustre module's instrumentation function
* since modules have no way of providing this to darshan-core
*/
extern
void
darshan_instrument_lustre_file
(
const
char
*
filepath
,
int
fd
);
#endif
#define DARSHAN_CORE_LOCK() pthread_mutex_lock(&darshan_core_mutex)
#define DARSHAN_CORE_UNLOCK() pthread_mutex_unlock(&darshan_core_mutex)
...
...
@@ -1764,7 +1771,7 @@ void darshan_shutdown_bench(int argc, char **argv)
darshan_mpiio_shutdown_bench_setup
(
1
);
if
(
my_rank
==
0
)
printf
(
"# 1 unique file per proc
\n
"
);
f
printf
(
stderr
,
"# 1 unique file per proc
\n
"
);
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
darshan_core_shutdown
();
darshan_core
=
NULL
;
...
...
@@ -1779,7 +1786,7 @@ void darshan_shutdown_bench(int argc, char **argv)
darshan_mpiio_shutdown_bench_setup
(
2
);
if
(
my_rank
==
0
)
printf
(
"# 1 shared file per proc
\n
"
);
f
printf
(
stderr
,
"# 1 shared file per proc
\n
"
);
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
darshan_core_shutdown
();
darshan_core
=
NULL
;
...
...
@@ -1794,7 +1801,7 @@ void darshan_shutdown_bench(int argc, char **argv)
darshan_mpiio_shutdown_bench_setup
(
3
);
if
(
my_rank
==
0
)
printf
(
"# 1024 unique files per proc
\n
"
);
f
printf
(
stderr
,
"# 1024 unique files per proc
\n
"
);
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
darshan_core_shutdown
();
darshan_core
=
NULL
;
...
...
@@ -1809,7 +1816,7 @@ void darshan_shutdown_bench(int argc, char **argv)
darshan_mpiio_shutdown_bench_setup
(
4
);
if
(
my_rank
==
0
)
printf
(
"# 1024 shared files per proc
\n
"
);
f
printf
(
stderr
,
"# 1024 shared files per proc
\n
"
);
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
darshan_core_shutdown
();
darshan_core
=
NULL
;
...
...
@@ -1986,6 +1993,19 @@ void *darshan_core_register_record(
return
(
rec_buf
);;
}
void
darshan_instrument_fs_data
(
int
fs_type
,
const
char
*
path
,
int
fd
)
{
#ifdef DARSHAN_LUSTRE
/* allow lustre to generate a record if we configured with lustre support */
if
(
fs_type
==
LL_SUPER_MAGIC
)
{
darshan_instrument_lustre_file
(
path
,
fd
);
return
;
}
#endif
return
;
}
double
darshan_core_wtime
()
{
DARSHAN_CORE_LOCK
();
...
...
darshan-runtime/lib/darshan-hdf5.c
View file @
76d33b22
...
...
@@ -69,11 +69,12 @@ static int my_rank = -1;
#define HDF5_PRE_RECORD() do { \
HDF5_LOCK(); \
if(!hdf5_runtime && !instrumentation_disabled) hdf5_runtime_initialize(); \
if(!hdf5_runtime) { \
HDF5_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!hdf5_runtime) hdf5_runtime_initialize(); \
if(hdf5_runtime) break; \
} \
HDF5_UNLOCK(); \
return(ret); \
} while(0)
#define HDF5_POST_RECORD() do { \
...
...
@@ -339,6 +340,7 @@ static void hdf5_cleanup_runtime()
free
(
hdf5_runtime
);
hdf5_runtime
=
NULL
;
instrumentation_disabled
=
0
;
return
;
}
...
...
@@ -365,6 +367,10 @@ static void hdf5_shutdown(
HDF5_LOCK
();
assert
(
hdf5_runtime
);
/* disable further instrumentation */
instrumentation_disabled
=
1
;
hdf5_rec_count
=
hdf5_runtime
->
file_rec_count
;
/* if there are globally shared files, do a shared file reduction */
...
...
@@ -440,9 +446,6 @@ static void hdf5_shutdown(
/* shutdown internal structures used for instrumenting */
hdf5_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
HDF5_UNLOCK
();
return
;
}
...
...
darshan-runtime/lib/darshan-lustre.c
View file @
76d33b22
...
...
@@ -61,10 +61,14 @@ void darshan_instrument_lustre_file(const char* filepath, int fd)
int
ret
;
LUSTRE_LOCK
();
if
(
instrumentation_disabled
)
{
LUSTRE_UNLOCK
();
return
;
}
/* try to init module if not already and if instrumentation isn't disabled */
if
(
!
lustre_runtime
&&
!
instrumentation_disabled
)
lustre_runtime_initialize
();
/* try to init module if not already */
if
(
!
lustre_runtime
)
lustre_runtime_initialize
();
/* if we aren't initialized, just back out */
if
(
!
lustre_runtime
)
...
...
@@ -226,6 +230,10 @@ static void lustre_shutdown(
LUSTRE_LOCK
();
assert
(
lustre_runtime
);
/* disable further instrumentation while we shutdown */
instrumentation_disabled
=
1
;
lustre_runtime
->
record_buffer
=
*
lustre_buf
;
lustre_runtime
->
record_buffer_size
=
*
lustre_buf_sz
;
...
...
@@ -268,9 +276,7 @@ static void lustre_shutdown(
darshan_clear_record_refs
(
&
(
lustre_runtime
->
record_id_hash
),
1
);
free
(
lustre_runtime
);
lustre_runtime
=
NULL
;
/* disable further instrumentation */
instrumentation_disabled
=
1
;
instrumentation_disabled
=
0
;
LUSTRE_UNLOCK
();
return
;
...
...
darshan-runtime/lib/darshan-mpiio.c
View file @
76d33b22
...
...
@@ -97,11 +97,12 @@ static int my_rank = -1;
#define MPIIO_PRE_RECORD() do { \
MPIIO_LOCK(); \
if(!mpiio_runtime && !instrumentation_disabled) mpiio_runtime_initialize(); \
if(!mpiio_runtime) { \
MPIIO_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!mpiio_runtime) mpiio_runtime_initialize(); \
if(mpiio_runtime) break; \
} \
MPIIO_UNLOCK(); \
return(ret); \
} while(0)
#define MPIIO_POST_RECORD() do { \
...
...
@@ -1169,6 +1170,7 @@ static void mpiio_cleanup_runtime()
free
(
mpiio_runtime
);
mpiio_runtime
=
NULL
;
instrumentation_disabled
=
0
;
return
;
}
...
...
@@ -1247,6 +1249,9 @@ void darshan_mpiio_shutdown_bench_setup(int test_case)
return
;
}
free
(
fh_array
);
free
(
size_array
);
return
;
}
...
...
@@ -1273,6 +1278,10 @@ static void mpiio_shutdown(
MPIIO_LOCK
();
assert
(
mpiio_runtime
);
/* disable further instrumentation while we shutdown */
instrumentation_disabled
=
1
;
mpiio_rec_count
=
mpiio_runtime
->
file_rec_count
;
/* perform any final transformations on MPIIO file records before
...
...
@@ -1381,9 +1390,6 @@ static void mpiio_shutdown(
/* shutdown internal structures used for instrumenting */
mpiio_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
MPIIO_UNLOCK
();
return
;
}
...
...
darshan-runtime/lib/darshan-null.c
View file @
76d33b22
...
...
@@ -116,11 +116,12 @@ static int my_rank = -1;
*/
#define NULL_PRE_RECORD() do { \
NULL_LOCK(); \
if(!null_runtime && !instrumentation_disabled) null_runtime_initialize(); \
if(!null_runtime) { \
NULL_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!null_runtime) null_runtime_initialize(); \
if(null_runtime) break; \
} \
NULL_UNLOCK(); \
return(ret); \
} while(0)
/* the NULL_POST_RECORD macro is executed after performing NULL
...
...
@@ -294,6 +295,7 @@ static void null_cleanup_runtime()
free
(
null_runtime
);
null_runtime
=
NULL
;
instrumentation_disabled
=
0
;
return
;
}
...
...
@@ -315,6 +317,9 @@ static void null_shutdown(
NULL_LOCK
();
assert
(
null_runtime
);
/* disable further instrumentation while we shutdown */
instrumentation_disabled
=
1
;
/* NOTE: this function can be used to run collective operations prior to
* shutting down the module, as implied by the MPI communicator passed in
* as the first agrument. Typically, module developers will want to run a
...
...
@@ -336,9 +341,6 @@ static void null_shutdown(
/* shutdown internal structures used for instrumenting */
null_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
NULL_UNLOCK
();
return
;
}
...
...
darshan-runtime/lib/darshan-pnetcdf.c
View file @
76d33b22
...
...
@@ -65,11 +65,12 @@ static int my_rank = -1;
#define PNETCDF_PRE_RECORD() do { \
PNETCDF_LOCK(); \
if(!pnetcdf_runtime && !instrumentation_disabled) pnetcdf_runtime_initialize(); \
if(!pnetcdf_runtime) { \
PNETCDF_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!pnetcdf_runtime) pnetcdf_runtime_initialize(); \
if(pnetcdf_runtime) break; \
} \
PNETCDF_UNLOCK(); \
return(ret); \
} while(0)
#define PNETCDF_POST_RECORD() do { \
...
...
@@ -336,6 +337,7 @@ static void pnetcdf_cleanup_runtime()
free
(
pnetcdf_runtime
);
pnetcdf_runtime
=
NULL
;
instrumentation_disabled
=
0
;
return
;
}
...
...
@@ -363,6 +365,10 @@ static void pnetcdf_shutdown(
PNETCDF_LOCK
();
assert
(
pnetcdf_runtime
);
/* disable further instrumentation while we shutdown */
instrumentation_disabled
=
1
;
pnetcdf_rec_count
=
pnetcdf_runtime
->
file_rec_count
;
/* if there are globally shared files, do a shared file reduction */
...
...
@@ -439,9 +445,6 @@ static void pnetcdf_shutdown(
/* shutdown internal structures used for instrumenting */
pnetcdf_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
PNETCDF_UNLOCK
();
return
;
}
...
...
darshan-runtime/lib/darshan-posix.c
View file @
76d33b22
...
...
@@ -37,9 +37,6 @@ typedef int64_t off64_t;
#define aiocb64 aiocb
#endif
#ifdef DARSHAN_LUSTRE
#include
<lustre/lustre_user.h>
#endif
DARSHAN_FORWARD_DECL
(
open
,
int
,
(
const
char
*
path
,
int
flags
,
...));
DARSHAN_FORWARD_DECL
(
open64
,
int
,
(
const
char
*
path
,
int
flags
,
...));
...
...
@@ -142,8 +139,6 @@ static void posix_runtime_initialize(
void
);
static
struct
posix_file_record_ref
*
posix_track_new_file_record
(
darshan_record_id
rec_id
,
const
char
*
path
);
static
void
posix_instrument_fs_data
(
int
fs_type
,
const
char
*
path
,
int
fd
);
static
void
posix_aio_tracker_add
(
int
fd
,
void
*
aiocbp
);
static
struct
posix_aio_tracker
*
posix_aio_tracker_del
(
...
...
@@ -162,13 +157,6 @@ static void posix_shutdown(
MPI_Comm
mod_comm
,
darshan_record_id
*
shared_recs
,
int
shared_rec_count
,
void
**
posix_buf
,
int
*
posix_buf_sz
);
#ifdef DARSHAN_LUSTRE
/* XXX modules don't expose an API for other modules, so use extern to get
* Lustre instrumentation function
*/
extern
void
darshan_instrument_lustre_file
(
const
char
*
filepath
,
int
fd
);
#endif
static
struct
posix_runtime
*
posix_runtime
=
NULL
;
static
pthread_mutex_t
posix_runtime_mutex
=
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
;
static
int
instrumentation_disabled
=
0
;
...
...
@@ -180,11 +168,12 @@ static int darshan_mem_alignment = 1;
#define POSIX_PRE_RECORD() do { \
POSIX_LOCK(); \
if(!posix_runtime && !instrumentation_disabled) posix_runtime_initialize(); \
if(!posix_runtime) { \
POSIX_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!posix_runtime) posix_runtime_initialize(); \
if(posix_runtime) break; \
} \
POSIX_UNLOCK(); \
return(ret); \
} while(0)
#define POSIX_POST_RECORD() do { \
...
...
@@ -221,7 +210,7 @@ static int darshan_mem_alignment = 1;
DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[POSIX_F_META_TIME], \
__tm1, __tm2, rec_ref->last_meta_end); \
darshan_add_record_ref(&(posix_runtime->fd_hash), &__ret, sizeof(int), rec_ref); \
posix
_instrument_fs_data(rec_ref->fs_type, newpath, __ret); \
darshan
_instrument_fs_data(rec_ref->fs_type, newpath, __ret); \
if(newpath != __path) free(newpath); \
} while(0)
...
...
@@ -1313,26 +1302,13 @@ static struct posix_file_record_ref *posix_track_new_file_record(
file_rec
->
base_rec
.
rank
=
my_rank
;
file_rec
->
counters
[
POSIX_MEM_ALIGNMENT
]
=
darshan_mem_alignment
;
file_rec
->
counters
[
POSIX_FILE_ALIGNMENT
]
=
fs_info
.
block_size
;
rec_ref
->
file_rec
=
file_rec
;
rec_ref
->
fs_type
=
fs_info
.
fs_type
;
rec_ref
->
file_rec
=
file_rec
;
posix_runtime
->
file_rec_count
++
;
return
(
rec_ref
);
}
static
void
posix_instrument_fs_data
(
int
fs_type
,
const
char
*
path
,
int
fd
)
{
#ifdef DARSHAN_LUSTRE
/* allow lustre to generate a record if we configured with lustre support */
if
(
fs_type
==
LL_SUPER_MAGIC
)
{
darshan_instrument_lustre_file
(
path
,
fd
);
return
;
}
#endif
return
;
}
/* finds the tracker structure for a given aio operation, removes it from
* the associated linked list for this file record, and returns a pointer.
*
...
...
@@ -1709,6 +1685,7 @@ static void posix_cleanup_runtime()
free
(
posix_runtime
);
posix_runtime
=
NULL
;
instrumentation_disabled
=
0
;
return
;
}
...
...
@@ -1808,6 +1785,10 @@ static void posix_shutdown(
POSIX_LOCK
();
assert
(
posix_runtime
);
/* disable instrumentation while we shutdown */
instrumentation_disabled
=
1
;
posix_rec_count
=
posix_runtime
->
file_rec_count
;
/* perform any final transformations on POSIX file records before
...
...
@@ -1917,9 +1898,6 @@ static void posix_shutdown(
/* shutdown internal structures used for instrumenting */
posix_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
POSIX_UNLOCK
();
return
;
}
...
...
darshan-runtime/lib/darshan-stdio.c
View file @
76d33b22
...
...
@@ -94,7 +94,9 @@ DARSHAN_FORWARD_DECL(fputc, int, (int c, FILE *stream));
DARSHAN_FORWARD_DECL
(
putw
,
int
,
(
int
w
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fputs
,
int
,
(
const
char
*
s
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fprintf
,
int
,
(
FILE
*
stream
,
const
char
*
format
,
...));
DARSHAN_FORWARD_DECL
(
printf
,
int
,
(
const
char
*
format
,
...));
DARSHAN_FORWARD_DECL
(
vfprintf
,
int
,
(
FILE
*
stream
,
const
char
*
format
,
va_list
));
DARSHAN_FORWARD_DECL
(
vprintf
,
int
,
(
const
char
*
format
,
va_list
));
DARSHAN_FORWARD_DECL
(
fread
,
size_t
,
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fgetc
,
int
,
(
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
getw
,
int
,
(
FILE
*
stream
));
...
...
@@ -119,6 +121,7 @@ struct stdio_file_record_ref
double
last_meta_end
;
double
last_read_end
;
double
last_write_end
;
int
fs_type
;
};
/* The stdio_runtime structure maintains necessary state for storing
...
...
@@ -159,11 +162,12 @@ static void stdio_cleanup_runtime();
#define STDIO_PRE_RECORD() do { \
STDIO_LOCK(); \
if(!stdio_runtime && !instrumentation_disabled) stdio_runtime_initialize(); \
if(!stdio_runtime) { \
STDIO_UNLOCK(); \
return(ret); \
if(!instrumentation_disabled) { \
if(!stdio_runtime) stdio_runtime_initialize(); \
if(stdio_runtime) break; \
} \
STDIO_UNLOCK(); \
return(ret); \
} while(0)
#define STDIO_POST_RECORD() do { \
...
...
@@ -174,6 +178,7 @@ static void stdio_cleanup_runtime();
darshan_record_id rec_id; \
struct stdio_file_record_ref* rec_ref; \
char *newpath; \
int __fd; \
if(__ret == NULL) break; \
newpath = darshan_clean_file_path(__path); \
if(!newpath) newpath = (char*)__path; \
...
...
@@ -196,6 +201,8 @@ static void stdio_cleanup_runtime();
rec_ref->file_rec->fcounters[STDIO_F_OPEN_END_TIMESTAMP] = __tm2; \
DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[STDIO_F_META_TIME], __tm1, __tm2, rec_ref->last_meta_end); \
darshan_add_record_ref(&(stdio_runtime->stream_hash), &(__ret), sizeof(__ret), rec_ref); \
__fd = fileno(__ret); \
darshan_instrument_fs_data(rec_ref->fs_type, newpath, __fd); \
if(newpath != (char*)__path) free(newpath); \
} while(0)
...
...
@@ -458,6 +465,25 @@ int DARSHAN_DECL(fputs)(const char *s, FILE *stream)
return
(
ret
);
}
int
DARSHAN_DECL
(
vprintf
)(
const
char
*
format
,
va_list
ap
)
{
int
ret
;
double
tm1
,
tm2
;
MAP_OR_FAIL
(
vprintf
);
tm1
=
darshan_core_wtime
();
ret
=
__real_vprintf
(
format
,
ap
);
tm2
=
darshan_core_wtime
();
STDIO_PRE_RECORD
();
if
(
ret
>
0
)
STDIO_RECORD_WRITE
(
stdout
,
ret
,
tm1
,
tm2
,
0
);
STDIO_POST_RECORD
();
return
(
ret
);
}
int
DARSHAN_DECL
(
vfprintf
)(
FILE
*
stream
,
const
char
*
format
,
va_list
ap
)
{
int
ret
;
...
...
@@ -467,14 +493,38 @@ int DARSHAN_DECL(vfprintf)(FILE *stream, const char *format, va_list ap)
MAP_OR_FAIL
(
vfprintf
);
tm1
=
darshan_core_wtime
();
start_off
=
ftell
(
stream
);
ret
=
__real_vfprintf
(
stream
,
format
,
ap
);
end_off
=
ftell
(
stream
);
tm2
=
darshan_core_wtime
();
STDIO_PRE_RECORD
();
if
(
ret
>
0
)
STDIO_RECORD_WRITE
(
stream
,
(
end_off
-
start_off
),
tm1
,
tm2
,
0
);
STDIO_RECORD_WRITE
(
stream
,
ret
,
tm1
,
tm2
,
0
);
STDIO_POST_RECORD
();
return
(
ret
);
}
int
DARSHAN_DECL
(
printf
)(
const
char
*
format
,
...)
{
int
ret
;
double
tm1
,
tm2
;
va_list
ap
;
MAP_OR_FAIL
(
vprintf
);
tm1
=
darshan_core_wtime
();
/* NOTE: we intentionally switch to vprintf here to handle the variable
* length arguments.
*/
va_start
(
ap
,
format
);
ret
=
__real_vprintf
(
format
,
ap
);
va_end
(
ap
);
tm2
=
darshan_core_wtime
();
STDIO_PRE_RECORD
();
if
(
ret
>
0
)
STDIO_RECORD_WRITE
(
stdout
,
ret
,
tm1
,
tm2
,
0
);
STDIO_POST_RECORD
();
return
(
ret
);
...
...
@@ -486,7 +536,6 @@ int DARSHAN_DECL(fprintf)(FILE *stream, const char *format, ...)
int
ret
;
double
tm1
,
tm2
;
va_list
ap
;
long
start_off
,
end_off
;
MAP_OR_FAIL
(
vfprintf
);
...
...
@@ -494,16 +543,14 @@ int DARSHAN_DECL(fprintf)(FILE *stream, const char *format, ...)
/* NOTE: we intentionally switch to vfprintf here to handle the variable
* length arguments.
*/
start_off
=
ftell
(
stream
);
va_start
(
ap
,
format
);
ret
=
__real_vfprintf
(
stream
,
format
,
ap
);
va_end
(
ap
);
end_off
=
ftell
(
stream
);
tm2
=
darshan_core_wtime
();
STDIO_PRE_RECORD
();
if
(
ret
>
0
)
STDIO_RECORD_WRITE
(
stream
,
(
end_off
-
start_off
)
,
tm1
,
tm2
,
0
);
STDIO_RECORD_WRITE
(
stream
,
ret
,
tm1
,
tm2
,
0
);
STDIO_POST_RECORD
();
return
(
ret
);
...
...
@@ -724,7 +771,11 @@ void DARSHAN_DECL(rewind)(FILE *stream)
* value in this wrapper.
*/
STDIO_LOCK
();
if
(
!
stdio_runtime
&&
!
instrumentation_disabled
)
stdio_runtime_initialize
();
if
(
instrumentation_disabled
)
{
STDIO_UNLOCK
();
return
;
}
if
(
!
stdio_runtime
)
stdio_runtime_initialize
();
if
(
!
stdio_runtime
)
{
STDIO_UNLOCK
();
return
;
...
...
@@ -908,10 +959,6 @@ static void stdio_runtime_initialize()
/* try to store default number of records for this module */
stdio_buf_size
=
DARSHAN_DEF_MOD_REC_COUNT
*
sizeof
(
struct
darshan_stdio_file
);
/* don't do anything if already initialized or instrumenation is disabled */
if
(
stdio_runtime
||
instrumentation_disabled
)
return
;
/* register the stdio module with darshan core */
darshan_core_register_module
(
DARSHAN_STDIO_MOD
,
...
...
@@ -934,6 +981,11 @@ static void stdio_runtime_initialize()
return
;
}
memset
(
stdio_runtime
,
0
,
sizeof
(
*
stdio_runtime
));
/* instantiate records for stdin, stdout, and stderr */
STDIO_RECORD_OPEN
(
stdin
,
"<STDIN>"
,
0
,
0
);
STDIO_RECORD_OPEN
(
stdout
,
"<STDOUT>"
,
0
,
0
);
STDIO_RECORD_OPEN
(
stderr
,
"<STDERR>"
,
0
,
0
);
}
/************************************************************************
...
...
@@ -1066,6 +1118,10 @@ static void stdio_shutdown(
STDIO_LOCK
();
assert
(
stdio_runtime
);
/* disable further instrumentation */
instrumentation_disabled
=
1
;
stdio_rec_count
=
stdio_runtime
->
file_rec_count
;
/* if there are globally shared files, do a shared file reduction */
...
...
@@ -1169,9 +1225,6 @@ static void stdio_shutdown(
/* shutdown internal structures used for instrumenting */
stdio_cleanup_runtime
();
/* disable further instrumentation */
instrumentation_disabled
=
1
;
STDIO_UNLOCK
();