/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <kstat.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <alloca.h>
#include <signal.h>
#include <sys/int_limits.h>
typedef struct kstat_field {
typedef struct kstat_instance {
static void
{
/*LINTED*/
}
int
{
int i;
}
fatal("could not find field '%s' in %s:%d\n",
return (0);
}
int
{
int rval;
return (rval);
if (l->ksi_instance < r->ksi_instance)
return (-1);
if (l->ksi_instance > r->ksi_instance)
return (1);
return (0);
}
void
{
int ninstances = 0, i;
return;
if (kid == -1)
fatal("failed to update kstat chain");
if (!interested(ksp))
continue;
/*
* Now look to see if we have this instance and name. (Yes,
* this is a linear search; we're assuming that this list is
* modest in size.)
*/
continue;
continue;
ninstances++;
break;
}
continue;
fatal("could not allocate memory for stat instance");
} else {
}
ninstances++;
}
/*
* Now we know how many instances we have; iterate back over them,
* pruning the stale ones and adding the active ones to a holding
* array in which to sort them.
*/
ninstances = 0;
} else {
}
}
if (ninstances == 0) {
return;
}
for (i = 0; i < ninstances; i++) {
}
}
void
{
int i, nfields;
continue;
continue;
/*
* Our kstat has been removed since the update;
* NULL it out to prevent us from trying to read
* it again (and to indicate that it should not
* be displayed) and drive on.
*/
continue;
}
fatal("failed to read kstat %s:%d",
}
ksi->ksi_instance);
}
fatal("could not allocate memory");
}
for (i = 0; i < nfields; i++) {
continue;
}
}
}
}
{
}
void
{
int i, nfields;
continue;
if (header) {
for (i = 0; i < nfields; i++) {
}
}
continue;
for (i = 0; i < nfields; i++) {
continue;
}
ksi->ksi_instance :
}
}
}
{
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_TRUE);
}
/* BEGIN CSTYLED */
"\n"
" Displays statistics for running kernel virtual machines, with one line\n"
" per virtual CPU. All statistics are reported as per-second rates.\n"
"\n"
" The columns are as follows:\n"
"\n"
" pid => identifier of process controlling the virtual CPU\n"
" vcpu => virtual CPU identifier relative to its virtual machine\n"
" exits => virtual machine exits for the virtual CPU\n"
" haltx => virtual machine exits due to the HLT instruction\n"
" irqx => virtual machine exits due to a pending external interrupt\n"
" irqwx => virtual machine exits due to an open interrupt window\n"
" iox => virtual machine exits due to an I/O instruction\n"
" mmiox => virtual machine exits due to memory mapped I/O \n"
" irqs => interrupts injected into the virtual CPU\n"
" emul => instructions emulated in the kernel\n"
" eptv => extended page table violations\n"
"\n";
/* END CSTYLED */
void
usage()
{
}
/*ARGSUSED*/
void
{}
/*ARGSUSED*/
int
{
int i = 0;
char *endp;
{ "exits", "exits", 6 },
{ "haltx", "halt-exits", 6 },
{ "irqx", "irq-exits", 6 },
{ "irqwx", "irq-window-exits", 6 },
{ "iox", "io-exits", 6 },
{ "mmiox", "mmio-exits", 6 },
{ "irqs", "irq-injections", 6 },
{ "emul", "insn-emulation", 6 },
{ "eptv", "pf-fixed", 6 },
{ NULL }
};
if (argc > 1) {
usage();
}
if (argc > 2) {
usage();
}
(void) sigemptyset(&set);
}
(void) sigemptyset(&set);
for (;;) {
if (i++ > 0) {
}
if (i > count)
break;
(void) sigsuspend(&set);
}
/*NOTREACHED*/
return (0);
}