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
This commit is contained in:
Peter Grehan 2012-10-31 19:17:55 +00:00
parent 00c66a5a85
commit de06f9bdf5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=242404

View File

@ -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 */