Igor Opaniuk | f1f3fd0 | 2017-09-14 15:34:56 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, Linaro Limited |
Etienne Carriere | dfad7d2 | 2019-03-05 08:45:21 +0100 | [diff] [blame] | 3 | * SPDX-License-Identifier: BSD-2-Clause |
Igor Opaniuk | f1f3fd0 | 2017-09-14 15:34:56 +0300 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef COMMON_H |
| 7 | #define COMMON_H |
| 8 | |
| 9 | /* |
| 10 | * Misc. output defines |
| 11 | */ |
| 12 | |
| 13 | #define OUTPUT_APP_PREFIX "Benchmark" |
| 14 | |
| 15 | #ifdef DEBUG |
| 16 | #define DBG(fmt, args...) printf("[" OUTPUT_APP_PREFIX \ |
Igor Opaniuk | 55fcc4a | 2018-02-06 19:20:22 +0200 | [diff] [blame] | 17 | "] DEBUG: %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##args) |
Igor Opaniuk | f1f3fd0 | 2017-09-14 15:34:56 +0300 | [diff] [blame] | 18 | #else |
| 19 | #define DBG(fmt, args...) |
| 20 | #endif |
| 21 | |
| 22 | #define INFO(fmt, args...) printf("[" OUTPUT_APP_PREFIX \ |
| 23 | "] INFO: " fmt "\n", ##args) |
| 24 | #define ERROR(fmt, args...) fprintf(stderr, "[" OUTPUT_APP_PREFIX \ |
| 25 | "] ERROR: " fmt "\n", ##args) |
| 26 | |
| 27 | #define ERROR_EXIT(fmt, args...) do { \ |
| 28 | ERROR(fmt, ##args); \ |
| 29 | exit(EXIT_FAILURE); \ |
| 30 | } while(0) |
| 31 | |
| 32 | #define ERROR_RETURN_FALSE(fmt, args...) do { \ |
| 33 | ERROR(fmt, ##args); \ |
| 34 | return false; \ |
| 35 | } while(0) |
| 36 | |
| 37 | #define ERROR_GOTO(label, fmt, args...) do { \ |
| 38 | ERROR(fmt, ##args); \ |
| 39 | goto label; \ |
| 40 | } while(0) |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | #define STAT_AMOUNT 5 |
| 46 | #define TSFILE_NAME_SUFFIX ".ts" |
| 47 | #define YAML_IMPLICIT 1 |
| 48 | /* |
| 49 | * Ringbuffer return codes |
| 50 | */ |
| 51 | #define RING_SUCCESS 0 |
| 52 | #define RING_BADPARM -1 |
| 53 | #define RING_NODATA -2 |
| 54 | |
Igor Opaniuk | 3d566ae | 2018-01-29 02:41:33 +0200 | [diff] [blame] | 55 | #define LIBTEEC_NAME "libteec.so" |
Igor Opaniuk | f1f3fd0 | 2017-09-14 15:34:56 +0300 | [diff] [blame] | 56 | #endif /* COMMON.H */ |
| 57 | |