<!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/91092ee14a7a54a97b6622602893ea05170a58c3">91092ee1</a></strong>
<div>
<span>by Phil Carns</span>
<i>at 2016-05-01T10:32:14-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">move fseek 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/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -57,7 +57,6 @@ DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcn
</span> DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
 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));
<span style="background: #ffdddd; color: #000000">-DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
</span> DARSHAN_FORWARD_DECL(__xstat, int, (int vers, const char* path, struct stat *buf));
 DARSHAN_FORWARD_DECL(__xstat64, int, (int vers, const char* path, struct stat64 *buf));
 DARSHAN_FORWARD_DECL(__lxstat, int, (int vers, const char* path, struct stat *buf));
<span style="color: #aaaaaa">@@ -787,37 +786,6 @@ off_t DARSHAN_DECL(lseek64)(int fd, off_t offset, int whence)
</span>     return(ret);
 }
 
<span style="background: #ffdddd; color: #000000">-int DARSHAN_DECL(fseek)(FILE *stream, long offset, int whence)
-{
-    int ret;
-    struct posix_file_runtime* file;
-    double tm1, tm2;
-
-    MAP_OR_FAIL(fseek);
-
-    tm1 = darshan_core_wtime();
-    ret = __real_fseek(stream, offset, whence);
-    tm2 = darshan_core_wtime();
-
-    if(ret >= 0)
-    {
-        POSIX_LOCK();
-        posix_runtime_initialize();
-        file = posix_file_by_fd(fileno(stream));
-        if(file)
-        {
-            file->offset = ftell(stream);
-            DARSHAN_TIMER_INC_NO_OVERLAP(
-                file->file_record->fcounters[POSIX_F_META_TIME],
-                tm1, tm2, file->last_meta_end);
-            file->file_record->counters[POSIX_FSEEKS] += 1;
-        }
-        POSIX_UNLOCK();
-    }
-
-    return(ret);
-}
-
</span> int DARSHAN_DECL(__xstat)(int vers, const char *path, struct stat *buf)
 {
     int ret;
</code></pre>

<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -36,6 +36,7 @@ DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
</span> DARSHAN_FORWARD_DECL(fclose, 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));
<span style="background: #ddffdd; color: #000000">+DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
</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">@@ -306,6 +307,37 @@ size_t DARSHAN_DECL(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
</span>     return(ret);
 }
 
<span style="background: #ddffdd; color: #000000">+int DARSHAN_DECL(fseek)(FILE *stream, long offset, int whence)
+{
+    int ret;
+    struct stdio_file_runtime* file;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(fseek);
+
+    tm1 = darshan_core_wtime();
+    ret = __real_fseek(stream, offset, whence);
+    tm2 = darshan_core_wtime();
+
+    if(ret >= 0)
+    {
+        STDIO_LOCK();
+        stdio_runtime_initialize();
+        file = stdio_file_by_stream(stream);
+        if(file)
+        {
+            file->offset = ftell(stream);
+            DARSHAN_TIMER_INC_NO_OVERLAP(
+                file->file_record->fcounters[STDIO_F_META_TIME],
+                tm1, tm2, file->last_meta_end);
+            file->file_record->counters[STDIO_SEEKS] += 1;
+        }
+        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/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -16,7 +16,6 @@
</span> --wrap=writev
 --wrap=lseek
 --wrap=lseek64
<span style="background: #ffdddd; color: #000000">---wrap=fseek
</span> --wrap=__xstat
 --wrap=__xstat64
 --wrap=__lxstat
</code></pre>

<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -4,3 +4,4 @@
</span> --wrap=fclose
 --wrap=fwrite
 --wrap=fread
<span style="background: #ddffdd; color: #000000">+--wrap=fseek
</span></code></pre>

<br>
</li>
<li id="4dfe7e78b540daa005ea4b5f0458c90d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -48,7 +48,7 @@
</span>  *
  * functions for changing file position
  * --------------
<span style="background: #ffdddd; color: #000000">- * int      fseek(FILE *, long int, int);
</span><span style="background: #ddffdd; color: #000000">+ * int      fseek(FILE *, long int, int);                   DONE
</span>  * int      fseeko(FILE *, off_t, int);
  * int      fsetpos(FILE *, const fpos_t *);
  * void     rewind(FILE *);
<span style="color: #aaaaaa">@@ -64,12 +64,14 @@
</span>     X(STDIO_BYTES_WRITTEN) \
     /* number of writes */ \
     X(STDIO_WRITES) \
<span style="background: #ffdddd; color: #000000">-    /* maximum byte (offset) written */\
</span><span style="background: #ddffdd; color: #000000">+    /* maximum byte (offset) read */\
</span>     X(STDIO_MAX_BYTE_READ) \
<span style="background: #ffdddd; color: #000000">-    /* total bytes written */ \
</span><span style="background: #ddffdd; color: #000000">+    /* total bytes read */ \
</span>     X(STDIO_BYTES_READ) \
<span style="background: #ffdddd; color: #000000">-    /* number of writes */ \
</span><span style="background: #ddffdd; color: #000000">+    /* number of reads */ \
</span>     X(STDIO_READS) \
<span style="background: #ddffdd; color: #000000">+    /* count of seeks */\
+    X(STDIO_SEEKS) \
</span>     /* end of counters */\
     X(STDIO_NUM_INDICES)
 
</code></pre>

<br>
</li>
<li id="172f4bf093caeeba24730a1adff8f15a">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/91092ee14a7a54a97b6622602893ea05170a58c3#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">@@ -33,12 +33,18 @@ fi
</span> 
 # check results
 
<span style="background: #ffdddd; color: #000000">-# in this case we want to confirm that the STDIO counters were triggered
</span><span style="background: #ddffdd; color: #000000">+# check at least one counter from each general open/read/write/seek category
+
</span> STDIO_OPENS=`grep STDIO_OPENS $DARSHAN_TMP/${PROG}.darshan.txt |head -n 1 |cut -f 5`
 if [ ! "$STDIO_OPENS" -gt 0 ]; then
     echo "Error: STDIO open count of $STDIO_OPENS is incorrect" 1>&2
     exit 1
 fi
<span style="background: #ddffdd; color: #000000">+STDIO_SEEKS=`grep STDIO_SEEKS $DARSHAN_TMP/${PROG}.darshan.txt |head -n 1 |cut -f 5`
+if [ ! "$STDIO_SEEKS" -gt 0 ]; then
+    echo "Error: STDIO open count of $STDIO_SEEKS is incorrect" 1>&2
+    exit 1
+fi
</span> STDIO_BYTES_WRITTEN=`grep STDIO_BYTES_WRITTEN $DARSHAN_TMP/${PROG}.darshan.txt |head -n 1 |cut -f 5`
 if [ ! "$STDIO_BYTES_WRITTEN" -eq 6 ]; then
     echo "Error: STDIO open count of $STDIO_BYTES_WRITTEN is incorrect" 1>&2
</code></pre>

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