[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/14] qemu: Convert conditional compilation of debu
From: |
Marc Marí |
Subject: |
[Qemu-devel] [PATCH 14/14] qemu: Convert conditional compilation of debug printfs to regular ifs |
Date: |
Mon, 28 Apr 2014 10:26:15 +0200 |
From: Marc Marí <address@hidden>
Modify debug macros as explained in
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg03642.html
Signed-off-by: Marc Marí <address@hidden>
---
migration-rdma.c | 47 ++++++++++++++++++++++++++++-------------------
page_cache.c | 17 +++++++++++------
xen-all.c | 17 ++++++++++-------
xen-mapcache.c | 19 +++++++++++--------
4 files changed, 60 insertions(+), 40 deletions(-)
diff --git a/migration-rdma.c b/migration-rdma.c
index eeb4302..0e2f21c 100644
--- a/migration-rdma.c
+++ b/migration-rdma.c
@@ -27,33 +27,42 @@
#include <string.h>
#include <rdma/rdma_cma.h>
-//#define DEBUG_RDMA
-//#define DEBUG_RDMA_VERBOSE
-//#define DEBUG_RDMA_REALLY_VERBOSE
+//#define DEBUG_RDMA 1
+//#define DEBUG_RDMA_VERBOSE 1
+//#define DEBUG_RDMA_REALLY_VERBOSE 1
+
+#ifndef DEBUG_RDMA
+#define DEBUG_RDMA 0
+#endif
-#ifdef DEBUG_RDMA
-#define DPRINTF(fmt, ...) \
- do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0)
-#else
#define DPRINTF(fmt, ...) \
- do { } while (0)
+ do { \
+ if(DEBUG_RDMA) { \
+ printf("rdma: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
+#ifndef DEBUG_RDMA_VERBOSE
+#define DEBUG_RDMA_VERBOSE 0
#endif
-#ifdef DEBUG_RDMA_VERBOSE
#define DDPRINTF(fmt, ...) \
- do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DDPRINTF(fmt, ...) \
- do { } while (0)
+ do { \
+ if(DEBUG_RDMA_VERBOSE) { \
+ printf("rdma: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
+#ifndef DEBUG_RDMA_REALLY_VERBOSE
+#define DEBUG_RDMA_REALLY_VERBOSE 0
#endif
-#ifdef DEBUG_RDMA_REALLY_VERBOSE
-#define DDDPRINTF(fmt, ...) \
- do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0)
-#else
#define DDDPRINTF(fmt, ...) \
- do { } while (0)
-#endif
+ do { \
+ if(DEBUG_RDMA_REALLY_VERBOSE) { \
+ printf("rdma: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
/*
* Print and error on both the Monitor and the Log file.
diff --git a/page_cache.c b/page_cache.c
index b033681..d1b8c4f 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -25,14 +25,19 @@
#include "qemu-common.h"
#include "migration/page_cache.h"
-#ifdef DEBUG_CACHE
-#define DPRINTF(fmt, ...) \
- do { fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
+//#define DEBUG_CACHE 1
+
+#ifndef DEBUG_CACHE
+#define DEBUG_CACHE 0
#endif
+#define DPRINTF(fmt, ...) \
+ do { \
+ if(DEBUG_CACHE) { \
+ fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
typedef struct CacheItem CacheItem;
struct CacheItem {
diff --git a/xen-all.c b/xen-all.c
index ba34739..34ffd3f 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -26,16 +26,19 @@
#include <xen/hvm/params.h>
#include <xen/hvm/e820.h>
-//#define DEBUG_XEN
+//#define DEBUG_XEN 1
-#ifdef DEBUG_XEN
-#define DPRINTF(fmt, ...) \
- do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
- do { } while (0)
+#ifndef DEBUG_XEN
+#define DEBUG_XEN 0
#endif
+#define DPRINTF(fmt, ...) \
+ do { \
+ if(DEBUG_XEN) { \
+ fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi;
static MemoryRegion *framebuffer;
static bool xen_in_migration;
diff --git a/xen-mapcache.c b/xen-mapcache.c
index eda914a..b1a68f1 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -23,16 +23,19 @@
#include "trace.h"
-//#define MAPCACHE_DEBUG
-
-#ifdef MAPCACHE_DEBUG
-# define DPRINTF(fmt, ...) do { \
- fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
-} while (0)
-#else
-# define DPRINTF(fmt, ...) do { } while (0)
+//#define MAPCACHE_DEBUG 1
+
+#ifndef MAPCACHE_DEBUG
+#define MAPCACHE_DEBUG 0
#endif
+# define DPRINTF(fmt, ...) \
+ do { \
+ if(MAPCACHE_DEBUG) { \
+ fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
#if defined(__i386__)
# define MCACHE_BUCKET_SHIFT 16
# define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */
--
1.7.10.4
- [Qemu-devel] [PATCH 04/14] isa: Convert conditional compilation of debug printfs to regular ifs, (continued)
- [Qemu-devel] [PATCH 04/14] isa: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 05/14] pci-host: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 06/14] s390x: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 09/14] tpm: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 07/14] scsi: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 08/14] sd: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 10/14] target-alpha: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 11/14] slirp: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 13/14] target-s390: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 14/14] qemu: Convert conditional compilation of debug printfs to regular ifs,
Marc Marí <=
- [Qemu-devel] [PATCH 12/14] target-i386: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- Re: [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs, Michael Tokarev, 2014/04/28
- Re: [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs, Kevin Wolf, 2014/04/28
- Re: [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs, Michael Tokarev, 2014/04/28
- Re: [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs, Peter Crosthwaite, 2014/04/28
- Re: [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs, Andreas Färber, 2014/04/28