From 1d91718e47095348f62fb615bc2d63fcfd5b6d4d Mon Sep 17 00:00:00 2001 From: Alfredo Mazzinghi Date: Fri, 31 Mar 2023 20:05:31 +0100 Subject: [PATCH] Remove perfetto debug counters. --- accel/tcg/cpu-exec.c | 18 ------------------ accel/tcg/log_instr.c | 8 -------- include/exec/log_instr.h | 6 ------ include/exec/log_instr_perfetto.h | 1 - include/qemu/log_instr.h | 12 ------------ trace_extra/trace_perfetto.cc | 10 ---------- 6 files changed, 55 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d1700f5230..518cc8cedb 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -702,24 +702,6 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, /* Instruction counter expired. */ assert(icount_enabled()); #ifndef CONFIG_USER_ONLY -#if defined(CONFIG_TCG_LOG_INSTR) && defined(CONFIG_TRACE_PERFETTO) - { - int64_t executed = cpu->icount_budget - - (cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra); - /* - * Assume that it is not possible to exit a tb chain with - * where tracing occurred but the first or last tb don't have - * the tracing flag set. - */ - if (tb->cflags & CF_LOG_INSTR) { - qemu_log_instr_counter(cpu, QEMU_LOG_INSTR_DBG_INSN_TRACING_ICOUNT, - executed); - } else { - qemu_log_instr_counter(cpu, QEMU_LOG_INSTR_DBG_INSN_ICOUNT, - executed); - } - } -#endif /* Ensure global icount has gone forward */ icount_update(cpu); diff --git a/accel/tcg/log_instr.c b/accel/tcg/log_instr.c index a459808c11..ea879f401a 100644 --- a/accel/tcg/log_instr.c +++ b/accel/tcg/log_instr.c @@ -112,7 +112,6 @@ static trace_backend_hooks_t trace_backends[] = { #ifdef CONFIG_TRACE_PERFETTO .init = init_perfetto_backend, .sync = sync_perfetto_backend, - .emit_debug = emit_perfetto_debug, .emit_instr = emit_perfetto_entry #endif }, { @@ -1291,13 +1290,6 @@ void qemu_log_instr_flush(CPUArchState *env) cpulog->ring_tail = cpulog->ring_head; } -void qemu_log_instr_counter(CPUState *cpu, QEMUDebugCounter name, long value) -{ - if (trace_backend->emit_debug) { - trace_backend->emit_debug(cpu->env_ptr, name, value); - } -} - /* Instruction logging helpers */ /* Dump out all the accumalated printf's */ diff --git a/include/exec/log_instr.h b/include/exec/log_instr.h index 9e606c8c48..6ccecec5d8 100644 --- a/include/exec/log_instr.h +++ b/include/exec/log_instr.h @@ -350,12 +350,6 @@ void qemu_log_instr_event_dump_cap_int(log_event_t *evt, const char *reg_name, */ void qemu_log_instr_extra(CPUArchState *env, const char *msg, ...); -/* - * Tracepoint for qemu internals. - * This should not be used for guest events. - */ -void qemu_log_instr_counter(CPUState *cpu, QEMUDebugCounter name, long value); - #else /* ! CONFIG_TCG_LOG_INSTR */ #define qemu_log_instr_enabled(cpu) false #define qemu_log_instr_start(env, mode, pc) diff --git a/include/exec/log_instr_perfetto.h b/include/exec/log_instr_perfetto.h index c72dd812b4..c594cdabcb 100644 --- a/include/exec/log_instr_perfetto.h +++ b/include/exec/log_instr_perfetto.h @@ -88,7 +88,6 @@ typedef void *cap_register_handle; void perfetto_init_cpu(int cpu_index, const char *logfile, void **backend_data); void perfetto_sync_cpu(void *backend_data); -void perfetto_emit_debug(void *backend_data, QEMUDebugCounter name, long value); void perfetto_emit_instr(void *backend_data, cpu_log_entry_handle entry_handle); /* diff --git a/include/qemu/log_instr.h b/include/qemu/log_instr.h index 2631be2f0e..8911e94524 100644 --- a/include/qemu/log_instr.h +++ b/include/qemu/log_instr.h @@ -205,18 +205,6 @@ typedef struct { }; } log_event_t; -/* - * Internal QEMU debug counters. - * These are always traced, regardless of whether tracing is enabled or not. - * This enumeration defines the name of the debug counters for the backends - * to use. - */ -typedef enum { - QEMU_LOG_INSTR_DBG_INSN_ICOUNT = 0, - QEMU_LOG_INSTR_DBG_INSN_TRACING_ICOUNT = 1, - /* Must be last */ - QEMU_LOG_INSTR_DBG_MAX -} QEMUDebugCounter; void qemu_log_instr_conf_logfile(const char *name); #ifdef CONFIG_TRACE_PERFETTO diff --git a/trace_extra/trace_perfetto.cc b/trace_extra/trace_perfetto.cc index c677f4cddf..3caf0fcab4 100644 --- a/trace_extra/trace_perfetto.cc +++ b/trace_extra/trace_perfetto.cc @@ -552,16 +552,6 @@ extern "C" void perfetto_sync_cpu(void *backend_data) perfetto::TrackEvent::Flush(); } -extern "C" void perfetto_emit_debug(void *backend_data, QEMUDebugCounter index, - long value) -{ - auto *data = reinterpret_cast(backend_data); - qemu_fallback_state *cpu_state = data->ctx_tracker.get_cpu_state(); - - TRACE_COUNTER("qemu-debug", cpu_state->get_debug_counter_track(index), - value); -} - extern "C" void perfetto_emit_instr(void *backend_data, cpu_log_entry_handle entry) {