<!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/29b23f7e94967b0638a1ac399a433ce3d46d9690">29b23f7e</a></strong>
<div>
<span>by Phil Carns</span>
<i>at 2016-05-01T09:00:35-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">move fclose wrapper to stdio module</pre>
</li>
</ul>
<h4>7 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/stdio-test.sh
</a>
</li>
<li class="file-stats">
<a href="#a453f91a0a4af7575917fad54f4ac1d0" 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/29b23f7e94967b0638a1ac399a433ce3d46d9690#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">@@ -71,7 +71,6 @@ DARSHAN_FORWARD_DECL(mmap64, void*, (void *addr, size_t length, int prot, int fl
</span> DARSHAN_FORWARD_DECL(fsync, int, (int fd));
 DARSHAN_FORWARD_DECL(fdatasync, int, (int fd));
 DARSHAN_FORWARD_DECL(close, int, (int fd));
<span style="background: #ffdddd; color: #000000">-DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
</span> 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));
<span style="color: #aaaaaa">@@ -1162,38 +1161,6 @@ int DARSHAN_DECL(close)(int fd)
</span>     return(ret);
 }
 
<span style="background: #ffdddd; color: #000000">-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);
-}
-
</span> int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp)
 {
     int ret;
</code></pre>

<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/29b23f7e94967b0638a1ac399a433ce3d46d9690#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">@@ -33,6 +33,7 @@
</span> 
 DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
 DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
<span style="background: #ddffdd; color: #000000">+DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
</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">@@ -201,6 +202,39 @@ FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode)
</span>     return(ret);
 }
 
<span style="background: #ddffdd; color: #000000">+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);
+}
+
</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/29b23f7e94967b0638a1ac399a433ce3d46d9690#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">@@ -30,7 +30,6 @@
</span> --wrap=fsync
 --wrap=fdatasync
 --wrap=close
<span style="background: #ffdddd; color: #000000">---wrap=fclose
</span> --wrap=aio_read
 --wrap=aio_write
 --wrap=aio_read64
</code></pre>

<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/29b23f7e94967b0638a1ac399a433ce3d46d9690#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">@@ -1,3 +1,4 @@
</span> --undefined=__wrap_fopen
 --wrap=fopen
 --wrap=fopen64
<span style="background: #ddffdd; color: #000000">+--wrap=fclose
</span></code></pre>

<br>
</li>
<li id="4dfe7e78b540daa005ea4b5f0458c90d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/29b23f7e94967b0638a1ac399a433ce3d46d9690#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">@@ -66,6 +66,10 @@
</span>     X(STDIO_F_OPEN_START_TIMESTAMP) \
     /* timestamp of last open completion */\
     X(STDIO_F_OPEN_END_TIMESTAMP) \
<span style="background: #ddffdd; color: #000000">+    /* timestamp of first close */\
+    X(STDIO_F_CLOSE_START_TIMESTAMP) \
+    /* timestamp of last close completion */\
+    X(STDIO_F_CLOSE_END_TIMESTAMP) \
</span>     /* cumulative meta time */\
     X(STDIO_F_META_TIME) \
     /* end of counters */\
</code></pre>

<br>
</li>
<li id="172f4bf093caeeba24730a1adff8f15a">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/29b23f7e94967b0638a1ac399a433ce3d46d9690#diff-5">
<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">@@ -57,6 +57,16 @@ if [ ! $(echo "$STDIO_F_META_TIME > 0" | bc -l) ]; then
</span>     echo "Error: counter is incorrect" 1>&2
     exit 1
 fi
<span style="background: #ddffdd; color: #000000">+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
</span> 
 
 exit 0
</code></pre>

<br>
</li>
<li id="a453f91a0a4af7575917fad54f4ac1d0">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/29b23f7e94967b0638a1ac399a433ce3d46d9690#diff-6">
<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">@@ -146,6 +146,8 @@ static void darshan_log_print_stdio_description()
</span>     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");
<span style="background: #ddffdd; color: #000000">+    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");
</span>     printf("#   STDIO_F_META_TIME: cumulative time spent in metadata operations.\n");
 
     return;
</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/29b23f7e94967b0638a1ac399a433ce3d46d9690">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>