<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>
</head>
<body>
<style type="text/css">
img {
max-width: 100%; height: auto;
}
</style>
<div class="content">
<h3>
Philip Carns pushed to branch dev-stdio
at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c">da685755</a></strong>
<div>
<span>by Phil Carns</span>
<i>at 2016-05-01T10:21:19-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">move fread wrapper to stdio module</pre>
</li>
</ul>
<h4>8 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-runtime/lib/darshan-posix.c
</a>
</li>
<li class="file-stats">
<a href="#ad29afc395839758d41094872298bd0d" style="text-decoration: none">
darshan-runtime/lib/darshan-stdio.c
</a>
</li>
<li class="file-stats">
<a href="#c0b0bf6d71bc5fc7e6d50d69c8aa2413" style="text-decoration: none">
darshan-runtime/share/ld-opts/darshan-posix-ld-opts
</a>
</li>
<li class="file-stats">
<a href="#2ace16276b68c7d5aef163bb260bd9f7" style="text-decoration: none">
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
</a>
</li>
<li class="file-stats">
<a href="#4dfe7e78b540daa005ea4b5f0458c90d" style="text-decoration: none">
darshan-stdio-log-format.h
</a>
</li>
<li class="file-stats">
<a href="#172f4bf093caeeba24730a1adff8f15a" style="text-decoration: none">
darshan-test/regression/test-cases/src/stdio-test.c
</a>
</li>
<li class="file-stats">
<a href="#a453f91a0a4af7575917fad54f4ac1d0" style="text-decoration: none">
darshan-test/regression/test-cases/stdio-test.sh
</a>
</li>
<li class="file-stats">
<a href="#dffc348e63ffc0037c23afd36439222f" style="text-decoration: none">
darshan-util/darshan-stdio-logutils.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id="620f2ecad2bb6f74b2fcd0134963a841">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-0">
<strong>
darshan-runtime/lib/darshan-posix.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-posix.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-posix.c
</span><span style="color: #aaaaaa">@@ -55,7 +55,6 @@ DARSHAN_FORWARD_DECL(pread64, ssize_t, (int fd, void *buf, size_t count, off64_t
</span> DARSHAN_FORWARD_DECL(pwrite64, ssize_t, (int fd, const void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
<span style="background: #ffdddd; color: #000000">-DARSHAN_FORWARD_DECL(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
</span> DARSHAN_FORWARD_DECL(lseek, off_t, (int fd, off_t offset, int whence));
DARSHAN_FORWARD_DECL(lseek64, off64_t, (int fd, off64_t offset, int whence));
DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
<span style="color: #aaaaaa">@@ -726,37 +725,6 @@ ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
</span> return(ret);
}
<span style="background: #ffdddd; color: #000000">-size_t DARSHAN_DECL(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
-{
- size_t ret;
- int aligned_flag = 0;
- double tm1, tm2;
-
- MAP_OR_FAIL(fread);
-
- if((unsigned long)ptr % darshan_mem_alignment == 0) aligned_flag = 1;
-
- tm1 = darshan_core_wtime();
- ret = __real_fread(ptr, size, nmemb, stream);
- tm2 = darshan_core_wtime();
-
- POSIX_LOCK();
- posix_runtime_initialize();
- if(ret > 0)
- {
- POSIX_RECORD_READ(size*ret, fileno(stream), 0, 0,
- aligned_flag, 1, tm1, tm2);
- }
- else
- {
- POSIX_RECORD_READ(ret, fileno(stream), 0, 0,
- aligned_flag, 1, tm1, tm2);
- }
- POSIX_UNLOCK();
-
- return(ret);
-}
-
</span> off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)
{
off_t ret;
</code></pre>
<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-1">
<strong>
darshan-runtime/lib/darshan-stdio.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-stdio.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-stdio.c
</span><span style="color: #aaaaaa">@@ -35,6 +35,7 @@ DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
</span> DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
DARSHAN_FORWARD_DECL(fwrite, size_t, (const void *ptr, size_t size, size_t nmemb, FILE *stream));
<span style="background: #ddffdd; color: #000000">+DARSHAN_FORWARD_DECL(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
</span>
/* The stdio_file_runtime structure maintains necessary runtime metadata
* for the STDIO file record (darshan_stdio_record structure, defined in
<span style="color: #aaaaaa">@@ -64,8 +65,6 @@ struct stdio_file_runtime
</span> /* TODO: make sure we need/want all of these fields */
struct darshan_stdio_record* file_record;
int64_t offset;
<span style="background: #ffdddd; color: #000000">- int64_t last_byte_read;
- int64_t last_byte_written;
</span> enum darshan_io_type last_io_type;
double last_meta_end;
double last_read_end;
<span style="color: #aaaaaa">@@ -153,8 +152,6 @@ static void stdio_shutdown(void);
</span> file = stdio_file_by_name_setstream(__path, __ret); \
if(!file) break; \
file->offset = 0; \
<span style="background: #ffdddd; color: #000000">- file->last_byte_written = 0; \
- file->last_byte_read = 0; \
</span> file->file_record->counters[STDIO_OPENS] += 1; \
if(file->file_record->fcounters[STDIO_F_OPEN_START_TIMESTAMP] == 0 || \
file->file_record->fcounters[STDIO_F_OPEN_START_TIMESTAMP] > __tm1) \
<span style="color: #aaaaaa">@@ -164,13 +161,30 @@ static void stdio_shutdown(void);
</span> } while(0)
<span style="background: #ddffdd; color: #000000">+#define STDIO_RECORD_READ(__fp, __bytes, __tm1, __tm2) do{ \
+ int64_t this_offset; \
+ struct stdio_file_runtime* file; \
+ file = stdio_file_by_stream(__fp); \
+ if(!file) break; \
+ this_offset = file->offset; \
+ file->offset = this_offset + __bytes; \
+ if(file->file_record->counters[STDIO_MAX_BYTE_READ] < (this_offset + __bytes - 1)) \
+ file->file_record->counters[STDIO_MAX_BYTE_READ] = (this_offset + __bytes - 1); \
+ file->file_record->counters[STDIO_BYTES_READ] += __bytes; \
+ file->file_record->counters[STDIO_READS] += 1; \
+ if(file->file_record->fcounters[STDIO_F_READ_START_TIMESTAMP] == 0 || \
+ file->file_record->fcounters[STDIO_F_READ_START_TIMESTAMP] > __tm1) \
+ file->file_record->fcounters[STDIO_F_READ_START_TIMESTAMP] = __tm1; \
+ file->file_record->fcounters[STDIO_F_READ_END_TIMESTAMP] = __tm2; \
+ DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[STDIO_F_READ_TIME], __tm1, __tm2, file->last_write_end); \
+} while(0)
+
</span> #define STDIO_RECORD_WRITE(__fp, __bytes, __tm1, __tm2) do{ \
int64_t this_offset; \
struct stdio_file_runtime* file; \
file = stdio_file_by_stream(__fp); \
if(!file) break; \
this_offset = file->offset; \
<span style="background: #ffdddd; color: #000000">- file->last_byte_written = this_offset + __bytes - 1; \
</span> file->offset = this_offset + __bytes; \
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); \
<span style="color: #aaaaaa">@@ -238,8 +252,6 @@ int DARSHAN_DECL(fclose)(FILE *fp)
</span> file = stdio_file_by_stream(fp);
if(file)
{
<span style="background: #ffdddd; color: #000000">- file->last_byte_written = 0;
- file->last_byte_read = 0;
</span> 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;
<span style="color: #aaaaaa">@@ -274,6 +286,26 @@ size_t DARSHAN_DECL(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *st
</span> return(ret);
}
<span style="background: #ddffdd; color: #000000">+size_t DARSHAN_DECL(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
+{
+ size_t ret;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(fread);
+
+ tm1 = darshan_core_wtime();
+ ret = __real_fread(ptr, size, nmemb, stream);
+ tm2 = darshan_core_wtime();
+
+ STDIO_LOCK();
+ stdio_runtime_initialize();
+ if(ret > 0)
+ STDIO_RECORD_READ(stream, size*ret, tm1, tm2);
+ STDIO_UNLOCK();
+
+ return(ret);
+}
+
</span> /**********************************************************
* Internal functions for manipulating STDIO module state *
**********************************************************/
</code></pre>
<br>
</li>
<li id="c0b0bf6d71bc5fc7e6d50d69c8aa2413">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-2">
<strong>
darshan-runtime/share/ld-opts/darshan-posix-ld-opts
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/share/ld-opts/darshan-posix-ld-opts
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/share/ld-opts/darshan-posix-ld-opts
</span><span style="color: #aaaaaa">@@ -14,7 +14,6 @@
</span> --wrap=pwrite64
--wrap=readv
--wrap=writev
<span style="background: #ffdddd; color: #000000">---wrap=fread
</span> --wrap=lseek
--wrap=lseek64
--wrap=fseek
</code></pre>
<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-3">
<strong>
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
</span><span style="color: #aaaaaa">@@ -3,3 +3,4 @@
</span> --wrap=fopen64
--wrap=fclose
--wrap=fwrite
<span style="background: #ddffdd; color: #000000">+--wrap=fread
</span></code></pre>
<br>
</li>
<li id="4dfe7e78b540daa005ea4b5f0458c90d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-4">
<strong>
darshan-stdio-log-format.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-stdio-log-format.h
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-stdio-log-format.h
</span><span style="color: #aaaaaa">@@ -13,13 +13,13 @@
</span> /*
* functions for opening streams
* --------------
<span style="background: #ffdddd; color: #000000">- * FILE *fdopen(int, const char *); DONE
</span><span style="background: #ddffdd; color: #000000">+ * FILE *fdopen(int, const char *); DONE
</span> * FILE *fopen(const char *, const char *);
* FILE *freopen(const char *, const char *, FILE *);
*
* functions for closing streams
* --------------
<span style="background: #ffdddd; color: #000000">- * int fclose(FILE *); DONE
</span><span style="background: #ddffdd; color: #000000">+ * int fclose(FILE *); DONE
</span> *
* functions for flushing streams
* --------------
<span style="color: #aaaaaa">@@ -29,7 +29,7 @@
</span> * --------------
* int fgetc(FILE *);
* char *fgets(char *, int, FILE *);
<span style="background: #ffdddd; color: #000000">- * size_t fread(void *, size_t, size_t, FILE *);
</span><span style="background: #ddffdd; color: #000000">+ * size_t fread(void *, size_t, size_t, FILE *); DONE
</span> * int fscanf(FILE *, const char *, ...);
* int getc(FILE *);
* int getc_unlocked(FILE *);
<span style="color: #aaaaaa">@@ -64,6 +64,12 @@
</span> X(STDIO_BYTES_WRITTEN) \
/* number of writes */ \
X(STDIO_WRITES) \
<span style="background: #ddffdd; color: #000000">+ /* maximum byte (offset) written */\
+ X(STDIO_MAX_BYTE_READ) \
+ /* total bytes written */ \
+ X(STDIO_BYTES_READ) \
+ /* number of writes */ \
+ X(STDIO_READS) \
</span> /* end of counters */\
X(STDIO_NUM_INDICES)
<span style="color: #aaaaaa">@@ -80,10 +86,16 @@
</span> X(STDIO_F_WRITE_START_TIMESTAMP) \
/* timestamp of last write completion */\
X(STDIO_F_WRITE_END_TIMESTAMP) \
<span style="background: #ddffdd; color: #000000">+ /* timestamp of first read */\
+ X(STDIO_F_READ_START_TIMESTAMP) \
+ /* timestamp of last read completion */\
+ X(STDIO_F_READ_END_TIMESTAMP) \
</span> /* cumulative meta time */\
X(STDIO_F_META_TIME) \
/* cumulative write time */\
X(STDIO_F_WRITE_TIME) \
<span style="background: #ddffdd; color: #000000">+ /* cumulative read time */\
+ X(STDIO_F_READ_TIME) \
</span> /* end of counters */\
X(STDIO_F_NUM_INDICES)
</code></pre>
<br>
</li>
<li id="172f4bf093caeeba24730a1adff8f15a">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-5">
<strong>
darshan-test/regression/test-cases/src/stdio-test.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-test/regression/test-cases/src/stdio-test.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-test/regression/test-cases/src/stdio-test.c
</span><span style="color: #aaaaaa">@@ -31,6 +31,7 @@ int main(int argc, char **argv)
</span> int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
FILE *file;
<span style="background: #ddffdd; color: #000000">+ char buffer[128] = {0};
</span>
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
<span style="color: #aaaaaa">@@ -43,7 +44,7 @@ int main(int argc, char **argv)
</span>
if (mynod == 0) printf("# Using stdio calls.\n");
<span style="background: #ffdddd; color: #000000">- file = fopen(opt_file, "w");
</span><span style="background: #ddffdd; color: #000000">+ file = fopen(opt_file, "w+");
</span> if(!file)
{
perror("fopen");
<span style="color: #aaaaaa">@@ -51,7 +52,11 @@ int main(int argc, char **argv)
</span> }
if(mynod == 0)
<span style="background: #ddffdd; color: #000000">+ {
</span> fwrite("hello", 1, 6, file);
<span style="background: #ddffdd; color: #000000">+ fseek(file, 0, SEEK_SET);
+ fread(buffer, 1, 1024, file);
+ }
</span>
fclose(file);
</code></pre>
<br>
</li>
<li id="a453f91a0a4af7575917fad54f4ac1d0">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-6">
<strong>
darshan-test/regression/test-cases/stdio-test.sh
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-test/regression/test-cases/stdio-test.sh
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-test/regression/test-cases/stdio-test.sh
</span><span style="color: #aaaaaa">@@ -44,6 +44,11 @@ if [ ! "$STDIO_BYTES_WRITTEN" -eq 6 ]; then
</span> echo "Error: STDIO open count of $STDIO_BYTES_WRITTEN is incorrect" 1>&2
exit 1
fi
<span style="background: #ddffdd; color: #000000">+STDIO_BYTES_READ=`grep STDIO_BYTES_READ $DARSHAN_TMP/${PROG}.darshan.txt |head -n 1 |cut -f 5`
+if [ ! "$STDIO_BYTES_READ" -eq 6 ]; then
+ echo "Error: STDIO open count of $STDIO_BYTES_READ is incorrect" 1>&2
+ exit 1
+fi
</span>
# make sure that some of the floating point counters are valid
</code></pre>
<br>
</li>
<li id="dffc348e63ffc0037c23afd36439222f">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c#diff-7">
<strong>
darshan-util/darshan-stdio-logutils.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-util/darshan-stdio-logutils.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-util/darshan-stdio-logutils.c
</span><span style="color: #aaaaaa">@@ -143,7 +143,7 @@ static void darshan_log_print_stdio_record(void *file_rec, char *file_name,
</span> static void darshan_log_print_stdio_description()
{
printf("\n# description of STDIO counters:\n");
<span style="background: #ffdddd; color: #000000">- printf("# STDIO_{OPENS|WRITES} are types of operations.\n");
</span><span style="background: #ddffdd; color: #000000">+ printf("# STDIO_{OPENS|WRITES|READS} are types of operations.\n");
</span> 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");
</code></pre>
<br>
</li>
</div>
<div class="footer" style="margin-top: 10px">
<p style="color: #777; font-size: small">
—
<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/da6857556a3047178d7cf964f34a088bb0d7e67c">View it on GitLab</a>.
<br>
You're receiving this email because of your account on xgitlab.cels.anl.gov.
If you'd like to receive fewer emails, you can
adjust your notification settings.
</p>
</div>
</body>
</html>