macros.h Source File

- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

macros.h
Go to the documentation of this file.
1 /*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10 #pragma once
11 #include <stdio.h>
12
18 #ifndef AF_MSG
19 #define AF_MSG(fmt,...) do { \
20 printf("%s:%d: " fmt "\n", \
21 __FILE__, __LINE__, ##__VA_ARGS__); \
22 } while (0);
23 #endif
24
73 #define AF_MEM_INFO(msg) do { \
74 size_t abytes = 0, abuffs = 0, lbytes = 0, lbuffs = 0; \
75 af_err err = af_device_mem_info(&abytes, &abuffs, &lbytes, &lbuffs); \
76 if(err == AF_SUCCESS) { \
77 printf("AF Memory at %s:%d: " msg "\n", __FILE__, __LINE__); \
78 printf("Allocated [ Bytes | Buffers ] = [ %ld | %ld ]\n", abytes, abuffs); \
79 printf("In Use [ Bytes | Buffers ] = [ %ld | %ld ]\n", lbytes, lbuffs); \
80 } else { \
81 fprintf(stderr, "AF Memory at %s:%d: " msg "\nAF Error %d\n", \
82 __FILE__, __LINE__, err); \
83 } \
84 } while(0)