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
29b23f7e
Commit
29b23f7e
authored
May 01, 2016
by
Philip Carns
Browse files
move fclose wrapper to stdio module
parent
7e58577d
Changes
7
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/lib/darshan-posix.c
View file @
29b23f7e
...
...
@@ -71,7 +71,6 @@ DARSHAN_FORWARD_DECL(mmap64, void*, (void *addr, size_t length, int prot, int fl
DARSHAN_FORWARD_DECL
(
fsync
,
int
,
(
int
fd
));
DARSHAN_FORWARD_DECL
(
fdatasync
,
int
,
(
int
fd
));
DARSHAN_FORWARD_DECL
(
close
,
int
,
(
int
fd
));
DARSHAN_FORWARD_DECL
(
fclose
,
int
,
(
FILE
*
fp
));
DARSHAN_FORWARD_DECL
(
aio_read
,
int
,
(
struct
aiocb
*
aiocbp
));
DARSHAN_FORWARD_DECL
(
aio_write
,
int
,
(
struct
aiocb
*
aiocbp
));
DARSHAN_FORWARD_DECL
(
aio_read64
,
int
,
(
struct
aiocb64
*
aiocbp
));
...
...
@@ -1162,38 +1161,6 @@ int DARSHAN_DECL(close)(int fd)
return
(
ret
);
}
int
DARSHAN_DECL
(
fclose
)(
FILE
*
fp
)
{
struct
posix_file_runtime
*
file
;
int
fd
=
fileno
(
fp
);
double
tm1
,
tm2
;
int
ret
;
MAP_OR_FAIL
(
fclose
);
tm1
=
darshan_core_wtime
();
ret
=
__real_fclose
(
fp
);
tm2
=
darshan_core_wtime
();
POSIX_LOCK
();
posix_runtime_initialize
();
file
=
posix_file_by_fd
(
fd
);
if
(
file
)
{
file
->
last_byte_written
=
0
;
file
->
last_byte_read
=
0
;
file
->
file_record
->
fcounters
[
POSIX_F_CLOSE_TIMESTAMP
]
=
darshan_core_wtime
();
DARSHAN_TIMER_INC_NO_OVERLAP
(
file
->
file_record
->
fcounters
[
POSIX_F_META_TIME
],
tm1
,
tm2
,
file
->
last_meta_end
);
posix_file_close_fd
(
fd
);
}
POSIX_UNLOCK
();
return
(
ret
);
}
int
DARSHAN_DECL
(
aio_read
)(
struct
aiocb
*
aiocbp
)
{
int
ret
;
...
...
darshan-runtime/lib/darshan-stdio.c
View file @
29b23f7e
...
...
@@ -33,6 +33,7 @@
DARSHAN_FORWARD_DECL
(
fopen
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
fopen64
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
fclose
,
int
,
(
FILE
*
fp
));
/* The stdio_file_runtime structure maintains necessary runtime metadata
* for the STDIO file record (darshan_stdio_record structure, defined in
...
...
@@ -201,6 +202,39 @@ FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode)
return
(
ret
);
}
int
DARSHAN_DECL
(
fclose
)(
FILE
*
fp
)
{
struct
stdio_file_runtime
*
file
;
double
tm1
,
tm2
;
int
ret
;
MAP_OR_FAIL
(
fclose
);
tm1
=
darshan_core_wtime
();
ret
=
__real_fclose
(
fp
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
file
=
stdio_file_by_stream
(
fp
);
if
(
file
)
{
file
->
last_byte_written
=
0
;
file
->
last_byte_read
=
0
;
if
(
file
->
file_record
->
fcounters
[
STDIO_F_CLOSE_START_TIMESTAMP
]
==
0
||
file
->
file_record
->
fcounters
[
STDIO_F_CLOSE_START_TIMESTAMP
]
>
tm1
)
file
->
file_record
->
fcounters
[
STDIO_F_CLOSE_START_TIMESTAMP
]
=
tm1
;
file
->
file_record
->
fcounters
[
STDIO_F_CLOSE_END_TIMESTAMP
]
=
tm2
;
DARSHAN_TIMER_INC_NO_OVERLAP
(
file
->
file_record
->
fcounters
[
STDIO_F_META_TIME
],
tm1
,
tm2
,
file
->
last_meta_end
);
stdio_file_close_stream
(
fp
);
}
STDIO_UNLOCK
();
return
(
ret
);
}
/**********************************************************
* Internal functions for manipulating STDIO module state *
**********************************************************/
...
...
darshan-runtime/share/ld-opts/darshan-posix-ld-opts
View file @
29b23f7e
...
...
@@ -30,7 +30,6 @@
--wrap=fsync
--wrap=fdatasync
--wrap=close
--wrap=fclose
--wrap=aio_read
--wrap=aio_write
--wrap=aio_read64
...
...
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
View file @
29b23f7e
--undefined=__wrap_fopen
--wrap=fopen
--wrap=fopen64
--wrap=fclose
darshan-stdio-log-format.h
View file @
29b23f7e
...
...
@@ -66,6 +66,10 @@
X(STDIO_F_OPEN_START_TIMESTAMP) \
/* timestamp of last open completion */
\
X(STDIO_F_OPEN_END_TIMESTAMP) \
/* timestamp of first close */
\
X(STDIO_F_CLOSE_START_TIMESTAMP) \
/* timestamp of last close completion */
\
X(STDIO_F_CLOSE_END_TIMESTAMP) \
/* cumulative meta time */
\
X(STDIO_F_META_TIME) \
/* end of counters */
\
...
...
darshan-test/regression/test-cases/stdio-test.sh
View file @
29b23f7e
...
...
@@ -57,6 +57,16 @@ if [ ! $(echo "$STDIO_F_META_TIME > 0" | bc -l) ]; then
echo
"Error: counter is incorrect"
1>&2
exit
1
fi
STDIO_F_CLOSE_START_TIMESTAMP
=
`
grep
STDIO_F_CLOSE_START_TIMESTAMP
$DARSHAN_TMP
/
${
PROG
}
.darshan.txt |tail
-n
1 |cut
-f
5
`
if
[
!
$(
echo
"
$STDIO_F_CLOSE_START_TIMESTAMP
> 0"
| bc
-l
)
]
;
then
echo
"Error: counter is incorrect"
1>&2
exit
1
fi
STDIO_F_CLOSE_END_TIMESTAMP
=
`
grep
STDIO_F_CLOSE_END_TIMESTAMP
$DARSHAN_TMP
/
${
PROG
}
.darshan.txt |tail
-n
1 |cut
-f
5
`
if
[
!
$(
echo
"
$STDIO_F_CLOSE_END_TIMESTAMP
> 0"
| bc
-l
)
]
;
then
echo
"Error: counter is incorrect"
1>&2
exit
1
fi
exit
0
darshan-util/darshan-stdio-logutils.c
View file @
29b23f7e
...
...
@@ -146,6 +146,8 @@ static void darshan_log_print_stdio_description()
printf
(
"# STDIO_FOPENS: number of 'fopen' function calls.
\n
"
);
printf
(
"# STDIO_F_OPEN_START_TIMESTAMP: timestamp of the first call to function 'fopen'.
\n
"
);
printf
(
"# STDIO_F_OPEN_END_TIMESTAMP: timestamp of the completion of the last call to 'fopen'.
\n
"
);
printf
(
"# STDIO_F_CLOSE_START_TIMESTAMP: timestamp of the first call to function 'fclose'.
\n
"
);
printf
(
"# STDIO_F_CLOSE_END_TIMESTAMP: timestamp of the completion of the last call to 'fclose'.
\n
"
);
printf
(
"# STDIO_F_META_TIME: cumulative time spent in metadata operations.
\n
"
);
return
;
...
...
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