aboutsummaryrefslogtreecommitdiff
path: root/contrib/plugins/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/plugins/cache.c')
-rw-r--r--contrib/plugins/cache.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index bf0d2f6..066ea6d 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -200,7 +200,7 @@ static void fifo_destroy(Cache *cache)
{
int i;
- for (i = 0; i < cache->assoc; i++) {
+ for (i = 0; i < cache->num_sets; i++) {
g_queue_free(cache->sets[i].fifo_queue);
}
}
@@ -355,15 +355,14 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
struct qemu_plugin_hwaddr *hwaddr;
InsnData *insn;
- g_mutex_lock(&mtx);
hwaddr = qemu_plugin_get_hwaddr(info, vaddr);
if (hwaddr && qemu_plugin_hwaddr_is_io(hwaddr)) {
- g_mutex_unlock(&mtx);
return;
}
effective_addr = hwaddr ? qemu_plugin_hwaddr_phys_addr(hwaddr) : vaddr;
+ g_mutex_lock(&mtx);
if (!access_cache(dcache, effective_addr)) {
insn = (InsnData *) userdata;
insn->dmisses++;
@@ -470,7 +469,7 @@ static int icmp(gconstpointer a, gconstpointer b)
return insn_a->imisses < insn_b->imisses ? 1 : -1;
}
-static void log_stats()
+static void log_stats(void)
{
g_autoptr(GString) rep = g_string_new("");
g_string_append_printf(rep,
@@ -488,7 +487,7 @@ static void log_stats()
qemu_plugin_outs(rep->str);
}
-static void log_top_insns()
+static void log_top_insns(void)
{
int i;
GList *curr, *miss_insns;
@@ -537,7 +536,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
g_hash_table_destroy(miss_ht);
}
-static void policy_init()
+static void policy_init(void)
{
switch (policy) {
case LRU: