summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2012-10-31 19:17:55 +0000
committergrehan <grehan@FreeBSD.org>2012-10-31 19:17:55 +0000
commitf31f52c1871f8a0551f877e5645b20d2629f84cd (patch)
tree696897cbf83728449b88c9a6d99ec2bc9d168304
parent36e2485283941cef37e24de91d997041ad325573 (diff)
downloadFreeBSD-src-f31f52c1871f8a0551f877e5645b20d2629f84cd.zip
FreeBSD-src-f31f52c1871f8a0551f877e5645b20d2629f84cd.tar.gz
Change the thread name of the vCPU threads to contain the
name of the VM and the vCPU number. This helps hugely when using top -H to identify what a VM is doing. Reviewed by: neel Obtained from: NetApp
-rw-r--r--usr.sbin/bhyve/fbsdrun.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/fbsdrun.c b/usr.sbin/bhyve/fbsdrun.c
index 418faa7..d8e4a4e 100644
--- a/usr.sbin/bhyve/fbsdrun.c
+++ b/usr.sbin/bhyve/fbsdrun.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <signal.h>
#include <pthread.h>
+#include <pthread_np.h>
#include <machine/vmm.h>
#include <vmmapi.h>
@@ -196,10 +197,16 @@ fbsdrun_muxed(void)
static void *
fbsdrun_start_thread(void *param)
{
+ char tname[MAXCOMLEN + 1];
+ struct mt_vmm_info *mtp;
int vcpu;
- struct mt_vmm_info *mtp = param;
+ mtp = param;
vcpu = mtp->mt_vcpu;
+
+ snprintf(tname, sizeof(tname), "%s vcpu %d", vmname, vcpu);
+ pthread_set_name_np(mtp->mt_thr, tname);
+
vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
/* not reached */
OpenPOWER on IntegriCloud