[Darshan-commits] [Git][darshan/darshan][carns/dev-289-pwritev] add wrappers for preadv, pwritev, preadv2, pwritev2
Philip Carns
xgitlab at cels.anl.gov
Tue Dec 1 12:13:03 CST 2020
Philip Carns pushed to branch carns/dev-289-pwritev at darshan / darshan
Commits:
8b3d0b16 by Phil Carns at 2020-12-01T13:12:40-05:00
add wrappers for preadv,pwritev,preadv2,pwritev2
- - - - -
1 changed file:
- darshan-runtime/lib/darshan-posix.c
Changes:
=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
@@ -62,7 +62,11 @@ DARSHAN_FORWARD_DECL(pwrite, ssize_t, (int fd, const void *buf, size_t count, of
DARSHAN_FORWARD_DECL(pread64, ssize_t, (int fd, void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(pwrite64, ssize_t, (int fd, const void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
+DARSHAN_FORWARD_DECL(preadv, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
+DARSHAN_FORWARD_DECL(preadv2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
+DARSHAN_FORWARD_DECL(pwritev, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
+DARSHAN_FORWARD_DECL(pwritev2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
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));
DARSHAN_FORWARD_DECL(__xstat, int, (int vers, const char* path, struct stat *buf));
@@ -991,6 +995,58 @@ ssize_t DARSHAN_DECL(readv)(int fd, const struct iovec *iov, int iovcnt)
return(ret);
}
+ssize_t DARSHAN_DECL(preadv)(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+{
+ ssize_t ret;
+ int aligned_flag = 1;
+ int i;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(preadv);
+
+ 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_preadv(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);
+}
+
+ssize_t DARSHAN_DECL(preadv2)(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags)
+{
+ ssize_t ret;
+ int aligned_flag = 1;
+ int i;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(preadv2);
+
+ 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_preadv2(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);
+}
+
ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
{
ssize_t ret;
@@ -1017,6 +1073,58 @@ ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
return(ret);
}
+ssize_t DARSHAN_DECL(pwritev)(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+{
+ ssize_t ret;
+ int aligned_flag = 1;
+ int i;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(pwritev);
+
+ 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_pwritev(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);
+}
+
+ssize_t DARSHAN_DECL(pwritev2)(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags)
+{
+ ssize_t ret;
+ int aligned_flag = 1;
+ int i;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(pwritev2);
+
+ 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_pwritev2(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);
+}
+
off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)
{
off_t ret;
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/8b3d0b163452b76b6b24f7f2abe64be386e8fb2a
--
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/8b3d0b163452b76b6b24f7f2abe64be386e8fb2a
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/6fe19e46/attachment-0001.html>
More information about the Darshan-commits
mailing list