<!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/9781671bd804abde8a89f0d3dbedb8950092b8c1">9781671b</a></strong>
<div>
<span>by Phil Carns</span>
<i>at 2016-05-23T20:50:05-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">fflush wrapper</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-runtime/lib/darshan-stdio.c
</a>
</li>
<li class="file-stats">
<a href="#ad29afc395839758d41094872298bd0d" style="text-decoration: none">
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
</a>
</li>
<li class="file-stats">
<a href="#c0b0bf6d71bc5fc7e6d50d69c8aa2413" style="text-decoration: none">
darshan-stdio-log-format.h
</a>
</li>
<li class="file-stats">
<a href="#2ace16276b68c7d5aef163bb260bd9f7" 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/9781671bd804abde8a89f0d3dbedb8950092b8c1#diff-0">
<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">@@ -32,7 +32,7 @@
</span>  *
  * functions for flushing streams
  * --------------
<span style="background: #ffdddd; color: #000000">- * int      fflush(FILE *);
</span><span style="background: #ddffdd; color: #000000">+ * int      fflush(FILE *);                                 DONE
</span>  *
  * functions for reading data
  * --------------
<span style="color: #aaaaaa">@@ -96,6 +96,7 @@ DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
</span> 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));
<span style="background: #ddffdd; color: #000000">+DARSHAN_FORWARD_DECL(fflush, int, (FILE *fp));
</span> 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));
<span style="color: #aaaaaa">@@ -238,7 +239,7 @@ static void stdio_shutdown(void);
</span>     DARSHAN_TIMER_INC_NO_OVERLAP(file->file_record->fcounters[STDIO_F_READ_TIME], __tm1, __tm2, file->last_write_end); \
 } while(0)
 
<span style="background: #ffdddd; color: #000000">-#define STDIO_RECORD_WRITE(__fp, __bytes,  __tm1, __tm2) do{ \
</span><span style="background: #ddffdd; color: #000000">+#define STDIO_RECORD_WRITE(__fp, __bytes,  __tm1, __tm2, __fflush_flag) do{ \
</span>     int64_t this_offset; \
     struct stdio_file_runtime* file; \
     file = stdio_file_by_stream(__fp); \
<span style="color: #aaaaaa">@@ -248,7 +249,10 @@ static void stdio_shutdown(void);
</span>     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; \
<span style="background: #ffdddd; color: #000000">-    file->file_record->counters[STDIO_WRITES] += 1; \
</span><span style="background: #ddffdd; color: #000000">+    if(__fflush_flag) \
+        file->file_record->counters[STDIO_FLUSHES] += 1; \
+    else \
+        file->file_record->counters[STDIO_WRITES] += 1; \
</span>     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; \
<span style="color: #aaaaaa">@@ -332,6 +336,26 @@ FILE* DARSHAN_DECL(freopen)(const char *path, const char *mode, FILE *stream)
</span>     return(ret);
 }
 
<span style="background: #ddffdd; color: #000000">+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);
+}
+
</span> int DARSHAN_DECL(fclose)(FILE *fp)
 {
     struct stdio_file_runtime* file;
<span style="color: #aaaaaa">@@ -377,7 +401,7 @@ size_t DARSHAN_DECL(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *st
</span>     STDIO_LOCK();
     stdio_runtime_initialize();
     if(ret > 0)
<span style="background: #ffdddd; color: #000000">-        STDIO_RECORD_WRITE(stream, size*ret, tm1, tm2);
</span><span style="background: #ddffdd; color: #000000">+        STDIO_RECORD_WRITE(stream, size*ret, tm1, tm2, 0);
</span>     STDIO_UNLOCK();
 
     return(ret);
</code></pre>

<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/9781671bd804abde8a89f0d3dbedb8950092b8c1#diff-1">
<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,6 +3,7 @@
</span> --wrap=fopen64
 --wrap=fdopen
 --wrap=freopen
<span style="background: #ddffdd; color: #000000">+--wrap=fflush
</span> --wrap=fclose
 --wrap=fwrite
 --wrap=fread
</code></pre>

<br>
</li>
<li id="c0b0bf6d71bc5fc7e6d50d69c8aa2413">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/9781671bd804abde8a89f0d3dbedb8950092b8c1#diff-2">
<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">@@ -27,6 +27,8 @@
</span>     X(STDIO_READS) \
     /* count of seeks */\
     X(STDIO_SEEKS) \
<span style="background: #ddffdd; color: #000000">+    /* count of flushes */\
+    X(STDIO_FLUSHES) \
</span>     /* end of counters */\
     X(STDIO_NUM_INDICES)
 
</code></pre>

<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/9781671bd804abde8a89f0d3dbedb8950092b8c1#diff-3">
<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|READS|SEEKS} are types of operations.\n");
</span><span style="background: #ddffdd; color: #000000">+    printf("#   STDIO_{OPENS|WRITES|READS|SEEKS|FLUSHES} 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/9781671bd804abde8a89f0d3dbedb8950092b8c1">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>