[Darshan-commits] [Git][darshan/darshan][carns/dev-289-pwritev] add support for 64 bit variants of preadv/pwritev

Philip Carns xgitlab at cels.anl.gov
Tue Dec 1 12:47:03 CST 2020



Philip Carns pushed to branch carns/dev-289-pwritev at darshan / darshan


Commits:
4374b2e7 by Phil Carns at 2020-12-01T13:46:43-05:00
add support for 64 bit variants of preadv/pwritev

- - - - -


2 changed files:

- darshan-runtime/lib/darshan-posix.c
- darshan-runtime/share/ld-opts/darshan-posix-ld-opts


Changes:

=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
@@ -64,16 +64,21 @@ DARSHAN_FORWARD_DECL(pwrite64, ssize_t, (int fd, const void *buf, size_t count,
 DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
 #ifdef HAVE_PREADV
     DARSHAN_FORWARD_DECL(preadv, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
+    DARSHAN_FORWARD_DECL(preadv64, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset));
 #endif
 #ifdef HAVE_PREADV2
     DARSHAN_FORWARD_DECL(preadv2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
+    DARSHAN_FORWARD_DECL(preadv64v2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags));
 #endif
 DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
+DARSHAN_FORWARD_DECL(writev64, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
 #ifdef HAVE_PWRITEV
     DARSHAN_FORWARD_DECL(pwritev, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
+    DARSHAN_FORWARD_DECL(pwritev64, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset));
 #endif
 #ifdef HAVE_PWRITEV2
     DARSHAN_FORWARD_DECL(pwritev2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
+    DARSHAN_FORWARD_DECL(pwritev64v2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags));
 #endif
 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));
@@ -1029,6 +1034,33 @@ ssize_t DARSHAN_DECL(preadv)(int fd, const struct iovec *iov, int iovcnt, off_t
 
     return(ret);
 }
+
+ssize_t DARSHAN_DECL(preadv64)(int fd, const struct iovec *iov, int iovcnt, off64_t offset)
+{
+    ssize_t ret;
+    int aligned_flag = 1;
+    int i;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(preadv64);
+
+    for(i=0; i<iovcnt; i++)
+    {
+        if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
+            aligned_flag = 0;
+    }
+
+    tm1 = darshan_core_wtime();
+    ret = __real_preadv64(fd, iov, iovcnt, offset);
+    tm2 = darshan_core_wtime();
+
+    POSIX_PRE_RECORD();
+    POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
+    POSIX_POST_RECORD();
+
+    return(ret);
+}
+
 #endif /* HAVE_PREADV */
 
 #ifdef HAVE_PREADV2
@@ -1057,6 +1089,32 @@ ssize_t DARSHAN_DECL(preadv2)(int fd, const struct iovec *iov, int iovcnt, off_t
 
     return(ret);
 }
+
+ssize_t DARSHAN_DECL(preadv64v2)(int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags)
+{
+    ssize_t ret;
+    int aligned_flag = 1;
+    int i;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(preadv64v2);
+
+    for(i=0; i<iovcnt; i++)
+    {
+        if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
+            aligned_flag = 0;
+    }
+
+    tm1 = darshan_core_wtime();
+    ret = __real_preadv64v2(fd, iov, iovcnt, offset, flags);
+    tm2 = darshan_core_wtime();
+
+    POSIX_PRE_RECORD();
+    POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
+    POSIX_POST_RECORD();
+
+    return(ret);
+}
 #endif /* HAVE_PREADV2 */
 
 ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
@@ -1111,6 +1169,32 @@ ssize_t DARSHAN_DECL(pwritev)(int fd, const struct iovec *iov, int iovcnt, off_t
 
     return(ret);
 }
+
+ssize_t DARSHAN_DECL(pwritev64)(int fd, const struct iovec *iov, int iovcnt, off64_t offset)
+{
+    ssize_t ret;
+    int aligned_flag = 1;
+    int i;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(pwritev64);
+
+    for(i=0; i<iovcnt; i++)
+    {
+        if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
+            aligned_flag = 0;
+    }
+
+    tm1 = darshan_core_wtime();
+    ret = __real_pwritev64(fd, iov, iovcnt, offset);
+    tm2 = darshan_core_wtime();
+
+    POSIX_PRE_RECORD();
+    POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
+    POSIX_POST_RECORD();
+
+    return(ret);
+}
 #endif /* HAVE_PWRITEV */
 
 #ifdef HAVE_PWRITEV2
@@ -1139,6 +1223,33 @@ ssize_t DARSHAN_DECL(pwritev2)(int fd, const struct iovec *iov, int iovcnt, off_
 
     return(ret);
 }
+
+ssize_t DARSHAN_DECL(pwritev64v2)(int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags)
+{
+    ssize_t ret;
+    int aligned_flag = 1;
+    int i;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(pwritev64v2);
+
+    for(i=0; i<iovcnt; i++)
+    {
+        if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
+            aligned_flag = 0;
+    }
+
+    tm1 = darshan_core_wtime();
+    ret = __real_pwritev64v2(fd, iov, iovcnt, offset, flags);
+    tm2 = darshan_core_wtime();
+
+    POSIX_PRE_RECORD();
+    POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
+    POSIX_POST_RECORD();
+
+    return(ret);
+}
+
 #endif
 
 off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)


=====================================
darshan-runtime/share/ld-opts/darshan-posix-ld-opts
=====================================
@@ -21,9 +21,13 @@
 --wrap=readv
 --wrap=preadv
 --wrap=preadv2
+--wrap=preadv64
+--wrap=preadv64v2
 --wrap=writev
 --wrap=pwritev
 --wrap=pwritev2
+--wrap=pwritev64
+--wrap=pwritev64v2
 --wrap=lseek
 --wrap=lseek64
 --wrap=__xstat



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/4374b2e762dd27aa55e957e0449989ba40e0223a

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/4374b2e762dd27aa55e957e0449989ba40e0223a
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20201201/009a1662/attachment-0001.html>


More information about the Darshan-commits mailing list