* [Qemu-devel] [PATCH] hmp: add info iothreads command
@ 2015-03-12 7:00 Ting Wang
2015-03-12 7:20 ` Fam Zheng
0 siblings, 1 reply; 3+ messages in thread
From: Ting Wang @ 2015-03-12 7:00 UTC (permalink / raw)
To: stefanha, pbonzini, qemu-devel; +Cc: Ting Wang
Make "info iothreads" available on the HMP monitor.
The results are as follows:
id1: thread_id1
id2: thread_id2
Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
---
hmp-commands.hx | 2 ++
hmp.c | 21 +++++++++++++++++++++
hmp.h | 1 +
monitor.c | 7 +++++++
4 files changed, 31 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index d5022d8..67d76ed 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1746,6 +1746,8 @@ show roms
show the TPM device
@item info memory-devices
show the memory devices
+@item info iothreads
+show iothreads
@end table
ETEXI
diff --git a/hmp.c b/hmp.c
index 71c28bc..01e31a6 100644
--- a/hmp.c
+++ b/hmp.c
@@ -821,6 +821,27 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
qapi_free_TPMInfoList(info_list);
}
+void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
+{
+ IOThreadInfoList *head = NULL, *elem = NULL;
+
+ head = qmp_query_iothreads(NULL);
+ if (!head) {
+ monitor_printf(mon, "No iothread has been added\n");
+ return;
+ }
+
+ elem = head;
+ while (elem) {
+ if (elem->value)
+ monitor_printf(mon, "%s: thread_id=%ld\n", elem->value->id,
+ elem->value->thread_id);
+ elem = elem->next;
+ }
+
+ qapi_free_IOThreadInfoList(head);
+}
+
void hmp_quit(Monitor *mon, const QDict *qdict)
{
monitor_suspend(mon);
diff --git a/hmp.h b/hmp.h
index 81177b2..d99090e 100644
--- a/hmp.h
+++ b/hmp.h
@@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict);
void hmp_info_pci(Monitor *mon, const QDict *qdict);
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
void hmp_info_tpm(Monitor *mon, const QDict *qdict);
+void hmp_info_iothreads(Monitor *mon, const QDict *qdict);
void hmp_quit(Monitor *mon, const QDict *qdict);
void hmp_stop(Monitor *mon, const QDict *qdict);
void hmp_system_reset(Monitor *mon, const QDict *qdict);
diff --git a/monitor.c b/monitor.c
index c86a89e..076a306 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2924,6 +2924,13 @@ static mon_cmd_t info_cmds[] = {
.mhandler.cmd = hmp_info_memory_devices,
},
{
+ .name = "iothreads",
+ .args_type = "",
+ .params = "",
+ .help = "show iothreads",
+ .mhandler.cmd = hmp_info_iothreads,
+ },
+ {
.name = NULL,
},
};
--
1.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: add info iothreads command
2015-03-12 7:00 [Qemu-devel] [PATCH] hmp: add info iothreads command Ting Wang
@ 2015-03-12 7:20 ` Fam Zheng
2015-03-12 8:36 ` Wangting (Kathy)
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2015-03-12 7:20 UTC (permalink / raw)
To: Ting Wang; +Cc: qemu-devel
On Thu, 03/12 15:00, Ting Wang wrote:
> + if (elem->value)
> + monitor_printf(mon, "%s: thread_id=%ld\n", elem->value->id,
> + elem->value->thread_id);
Braces are required for if.
Fam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hmp: add info iothreads command
2015-03-12 7:20 ` Fam Zheng
@ 2015-03-12 8:36 ` Wangting (Kathy)
0 siblings, 0 replies; 3+ messages in thread
From: Wangting (Kathy) @ 2015-03-12 8:36 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel
On 2015-3-12 15:20, Fam Zheng wrote:
> On Thu, 03/12 15:00, Ting Wang wrote:
>> + if (elem->value)
>> + monitor_printf(mon, "%s: thread_id=%ld\n", elem->value->id,
>> + elem->value->thread_id);
>
> Braces are required for if.
>
> Fam
>
>
Okay, will fix in v2, thanks.
Ting
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-12 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 7:00 [Qemu-devel] [PATCH] hmp: add info iothreads command Ting Wang
2015-03-12 7:20 ` Fam Zheng
2015-03-12 8:36 ` Wangting (Kathy)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.