diff options
author | grehan <grehan@FreeBSD.org> | 2012-10-31 19:17:55 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2012-10-31 19:17:55 +0000 |
commit | f31f52c1871f8a0551f877e5645b20d2629f84cd (patch) | |
tree | 696897cbf83728449b88c9a6d99ec2bc9d168304 | |
parent | 36e2485283941cef37e24de91d997041ad325573 (diff) | |
download | FreeBSD-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.c | 9 |
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 */ |