[arrayfire] 36/84: Added MEMINFO macro to print memory stats

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository arrayfire.

commit 8c945f38832ed3227faaf72d41f215b736c0f824
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Wed Dec 16 15:08:29 2015 -0500

    Added MEMINFO macro to print memory stats
---
 include/af/macros.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/af/macros.h b/include/af/macros.h
index 62ff3e9..65077dc 100644
--- a/include/af/macros.h
+++ b/include/af/macros.h
@@ -21,3 +21,16 @@
                  __FILE__, __LINE__, ##__VA_ARGS__);      \
         } while (0);
 #endif
+
+#define MEMINFO(msg) do {                                                               \
+    size_t abytes = 0, abuffs = 0, lbytes = 0, lbuffs = 0;                              \
+    af_err err = af_device_mem_info(&abytes, &abuffs, &lbytes, &lbuffs);                \
+    if(err == AF_SUCCESS) {                                                             \
+        printf("MemInfo at %s:%d: " msg "\n", __FILE__, __LINE__);                      \
+        printf("Allocated [ Bytes | Buffers ] = [ %ld | %ld ]\n", abytes, abuffs);      \
+        printf("In Use    [ Bytes | Buffers ] = [ %ld | %ld ]\n", lbytes, lbuffs);      \
+    } else {                                                                            \
+        fprintf(stderr, "MemInfo at %s:%d: " msg "\nAF Error %d\n",                     \
+                __FILE__, __LINE__, err);                                               \
+    }                                                                                   \
+} while(0);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list