/src/qemu/accel/accel-qmp.c
Line | Count | Source |
1 | | /* |
2 | | * QMP commands related to accelerators |
3 | | * |
4 | | * Copyright (c) Linaro |
5 | | * |
6 | | * SPDX-License-Identifier: GPL-2.0-or-later |
7 | | */ |
8 | | |
9 | | #include "qemu/osdep.h" |
10 | | #include "qemu/accel.h" |
11 | | #include "qapi/type-helpers.h" |
12 | | #include "qapi/qapi-commands-accelerator.h" |
13 | | #include "accel/accel-ops.h" |
14 | | #include "accel/accel-cpu-ops.h" |
15 | | #include "hw/core/cpu.h" |
16 | | |
17 | | HumanReadableText *qmp_x_accel_stats(Error **errp) |
18 | 0 | { |
19 | 0 | AccelState *accel = current_accel(); |
20 | 0 | AccelClass *acc = ACCEL_GET_CLASS(accel); |
21 | 0 | g_autoptr(GString) buf = g_string_new(""); |
22 | |
|
23 | 0 | if (acc->get_stats) { |
24 | 0 | acc->get_stats(accel, buf); |
25 | 0 | } |
26 | 0 | if (acc->ops->get_vcpu_stats) { |
27 | 0 | CPUState *cpu; |
28 | |
|
29 | 0 | CPU_FOREACH(cpu) { |
30 | 0 | acc->ops->get_vcpu_stats(cpu, buf); |
31 | 0 | } |
32 | 0 | } |
33 | |
|
34 | 0 | return human_readable_text_from_str(buf); |
35 | 0 | } |