[Darshan-commits] [Git][darshan/darshan][dev-stdio-utils] filter out unused stdio records

Philip Carns xgitlab at cels.anl.gov
Sun Sep 18 09:15:16 CDT 2016


Philip Carns pushed to branch dev-stdio-utils at darshan / darshan


Commits:
384e9b5c by Phil Carns at 2016-09-18T10:15:02-04:00
filter out unused stdio records

- - - - -


1 changed file:

- darshan-runtime/lib/darshan-stdio.c


Changes:

=====================================
darshan-runtime/lib/darshan-stdio.c
=====================================
--- a/darshan-runtime/lib/darshan-stdio.c
+++ b/darshan-runtime/lib/darshan-stdio.c
@@ -78,6 +78,8 @@
 #include <assert.h>
 #include <libgen.h>
 #include <pthread.h>
+#include <stdint.h>
+#include <limits.h>
 
 #include "darshan.h"
 #include "darshan-dynamic.h"
@@ -488,7 +490,6 @@ int DARSHAN_DECL(vfprintf)(FILE *stream, const char *format, va_list ap)
 {
     int ret;
     double tm1, tm2;
-    long start_off, end_off;
 
     MAP_OR_FAIL(vfprintf);
 
@@ -1115,6 +1116,8 @@ static void stdio_shutdown(
     MPI_Op red_op;
     int stdio_rec_count;
     double stdio_time;
+    FILE * fp[3];
+    int trim_records = 0;
 
     STDIO_LOCK();
     assert(stdio_runtime);
@@ -1219,6 +1222,30 @@ static void stdio_shutdown(
         DARSHAN_MPI_CALL(PMPI_Op_free)(&red_op);
     }
 
+    /* filter out any records that have no activity on them; this is
+     * specifically meant to filter out unused stdin, stdout, or stderr
+     * entries
+     *
+     * NOTE: we can no longer use the darshan_lookup_record_ref()
+     * function at this point to find specific records, because the
+     * logic above has likely broken the mapping to the static array.
+     * We walk it manually here instead.
+     */
+    for(i=0; i<stdio_rec_count; i++)
+    {
+        if(stdio_rec_buf[i].counters[STDIO_WRITES] == 0 &&
+            stdio_rec_buf[i].counters[STDIO_READS] == 0)
+        {
+            if(i != (stdio_rec_count-1))
+            {
+                memmove(&stdio_rec_buf[i], &stdio_rec_buf[i+1],
+                    (stdio_rec_count-i-1)*sizeof(stdio_rec_buf[i]));
+                stdio_rec_count--;
+                i--;
+            }
+        }
+    }
+
     /* update output buffer size to account for shared file reduction */
     *stdio_buf_sz = stdio_rec_count * sizeof(struct darshan_stdio_file);
 



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/384e9b5cf77c0df8529875838b60ea2c2053ab04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160918/0758e939/attachment-0001.html>


More information about the Darshan-commits mailing list