Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
darshan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
61
Issues
61
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
darshan
darshan
Commits
9781671b
Commit
9781671b
authored
May 23, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fflush wrapper
parent
e025a97f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
darshan-stdio.c
darshan-runtime/lib/darshan-stdio.c
+28
-4
darshan-stdio-ld-opts
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
+1
-0
darshan-stdio-log-format.h
darshan-stdio-log-format.h
+2
-0
darshan-stdio-logutils.c
darshan-util/darshan-stdio-logutils.c
+1
-1
No files found.
darshan-runtime/lib/darshan-stdio.c
View file @
9781671b
...
...
@@ -32,7 +32,7 @@
*
* functions for flushing streams
* --------------
* int fflush(FILE *);
* int fflush(FILE *);
DONE
*
* functions for reading data
* --------------
...
...
@@ -96,6 +96,7 @@ DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL
(
fdopen
,
FILE
*
,
(
int
fd
,
const
char
*
mode
));
DARSHAN_FORWARD_DECL
(
freopen
,
FILE
*
,
(
const
char
*
path
,
const
char
*
mode
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fclose
,
int
,
(
FILE
*
fp
));
DARSHAN_FORWARD_DECL
(
fflush
,
int
,
(
FILE
*
fp
));
DARSHAN_FORWARD_DECL
(
fwrite
,
size_t
,
(
const
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fread
,
size_t
,
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
));
DARSHAN_FORWARD_DECL
(
fseek
,
int
,
(
FILE
*
stream
,
long
offset
,
int
whence
));
...
...
@@ -238,7 +239,7 @@ static void stdio_shutdown(void);
DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[STDIO_F_READ_TIME], __tm1, __tm2, file->last_write_end); \
} while(0)
#define STDIO_RECORD_WRITE(__fp, __bytes, __tm1, __tm2) do{ \
#define STDIO_RECORD_WRITE(__fp, __bytes, __tm1, __tm2
, __fflush_flag
) do{ \
int64_t this_offset; \
struct stdio_file_runtime* file; \
file = stdio_file_by_stream(__fp); \
...
...
@@ -248,7 +249,10 @@ static void stdio_shutdown(void);
if(file->file_record->counters[STDIO_MAX_BYTE_WRITTEN] < (this_offset + __bytes - 1)) \
file->file_record->counters[STDIO_MAX_BYTE_WRITTEN] = (this_offset + __bytes - 1); \
file->file_record->counters[STDIO_BYTES_WRITTEN] += __bytes; \
file->file_record->counters[STDIO_WRITES] += 1; \
if(__fflush_flag) \
file->file_record->counters[STDIO_FLUSHES] += 1; \
else \
file->file_record->counters[STDIO_WRITES] += 1; \
if(file->file_record->fcounters[STDIO_F_WRITE_START_TIMESTAMP] == 0 || \
file->file_record->fcounters[STDIO_F_WRITE_START_TIMESTAMP] > __tm1) \
file->file_record->fcounters[STDIO_F_WRITE_START_TIMESTAMP] = __tm1; \
...
...
@@ -332,6 +336,26 @@ FILE* DARSHAN_DECL(freopen)(const char *path, const char *mode, FILE *stream)
return
(
ret
);
}
int
DARSHAN_DECL
(
fflush
)(
FILE
*
fp
)
{
double
tm1
,
tm2
;
int
ret
;
MAP_OR_FAIL
(
fflush
);
tm1
=
darshan_core_wtime
();
ret
=
__real_fflush
(
fp
);
tm2
=
darshan_core_wtime
();
STDIO_LOCK
();
stdio_runtime_initialize
();
if
(
ret
>=
0
)
STDIO_RECORD_WRITE
(
fp
,
0
,
tm1
,
tm2
,
1
);
STDIO_UNLOCK
();
return
(
ret
);
}
int
DARSHAN_DECL
(
fclose
)(
FILE
*
fp
)
{
struct
stdio_file_runtime
*
file
;
...
...
@@ -377,7 +401,7 @@ size_t DARSHAN_DECL(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *st
STDIO_LOCK
();
stdio_runtime_initialize
();
if
(
ret
>
0
)
STDIO_RECORD_WRITE
(
stream
,
size
*
ret
,
tm1
,
tm2
);
STDIO_RECORD_WRITE
(
stream
,
size
*
ret
,
tm1
,
tm2
,
0
);
STDIO_UNLOCK
();
return
(
ret
);
...
...
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
View file @
9781671b
...
...
@@ -3,6 +3,7 @@
--wrap=fopen64
--wrap=fdopen
--wrap=freopen
--wrap=fflush
--wrap=fclose
--wrap=fwrite
--wrap=fread
...
...
darshan-stdio-log-format.h
View file @
9781671b
...
...
@@ -27,6 +27,8 @@
X(STDIO_READS) \
/* count of seeks */
\
X(STDIO_SEEKS) \
/* count of flushes */
\
X(STDIO_FLUSHES) \
/* end of counters */
\
X(STDIO_NUM_INDICES)
...
...
darshan-util/darshan-stdio-logutils.c
View file @
9781671b
...
...
@@ -143,7 +143,7 @@ static void darshan_log_print_stdio_record(void *file_rec, char *file_name,
static
void
darshan_log_print_stdio_description
()
{
printf
(
"
\n
# description of STDIO counters:
\n
"
);
printf
(
"# STDIO_{OPENS|WRITES|READS|SEEKS} are types of operations.
\n
"
);
printf
(
"# STDIO_{OPENS|WRITES|READS|SEEKS
|FLUSHES
} are types of operations.
\n
"
);
printf
(
"# STDIO_BYTES_*: total bytes read and written.
\n
"
);
printf
(
"# STDIO_MAX_BYTE_*: highest offset byte read and written.
\n
"
);
printf
(
"# STDIO_F_*_START_TIMESTAMP: timestamp of the first call to that type of function.
\n
"
);
...
...
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