mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
migration: using trace_ to replace DPRINTF
Signed-off-by: Bihong Yu <yubihong@huawei.com> Message-Id: <1603179176-5360-1-git-send-email-yubihong@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
committed by
Dr. David Alan Gilbert
parent
0bcae62333
commit
fe80c0241d
@@ -18,14 +18,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "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)
|
||||
#endif
|
||||
#include "trace.h"
|
||||
|
||||
/* the page in cache will not be replaced in two cycles */
|
||||
#define CACHED_PAGE_LIFETIME 2
|
||||
@@ -75,7 +68,7 @@ PageCache *cache_init(int64_t new_size, size_t page_size, Error **errp)
|
||||
cache->num_items = 0;
|
||||
cache->max_num_items = num_pages;
|
||||
|
||||
DPRINTF("Setting cache buckets to %" PRId64 "\n", cache->max_num_items);
|
||||
trace_migration_pagecache_init(cache->max_num_items);
|
||||
|
||||
/* We prefer not to abort if there is no memory */
|
||||
cache->page_cache = g_try_malloc((cache->max_num_items) *
|
||||
@@ -169,7 +162,7 @@ int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata,
|
||||
if (!it->it_data) {
|
||||
it->it_data = g_try_malloc(cache->page_size);
|
||||
if (!it->it_data) {
|
||||
DPRINTF("Error allocating page\n");
|
||||
trace_migration_pagecache_insert();
|
||||
return -1;
|
||||
}
|
||||
cache->num_items++;
|
||||
|
||||
Reference in New Issue
Block a user