/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* sa_kstat - kstat statistic adapter, collects statistic data provided
* by kstat.
*/
#include <locale.h>
#include <string.h>
#include <assert.h>
#include <kstat.h>
#include <pool.h>
#include "utils.h"
#include "poolstat.h"
#include "poolstat_utils.h"
/* marks 'sdata_t' element as updated */
/* Specified value for an invalid set. */
/* statistic data */
typedef struct sdata {
} sdata_t;
/* pset user data */
typedef struct {
} pset_ud_t;
/* shortcuts to access set's id in 'pset_ud_t' */
char *, int *);
/*ARGSUSED*/
void
{
}
void
{
/* The SA_REFRESH flag forces the update of local data structures. */
if (flags & SA_REFRESH) {
int ks_error = 0;
if (ks_error)
/* update info about cpu binding to processor sets */
}
return;
} else {
}
}
static void *
{
void *dp;
return (dp);
}
/*
* Find the delta over the interval between new_ksp and old_ksp.
* If old_ksp->ks_data is NULL and 'oz' is set then pretend
* that old_ksp is zero otherwise return 0.
*/
static uint64_t
{
}
/*
* Create a clone of the passed kstat_t structure 'kstat_t'. If
* 'fr' flag is set free the old ks_data structure in 'dst'.
*/
static void
{
if (fr)
} else {
dst->ks_data_size = 0;
}
}
/*
* Erase the data from 'src'.
*/
static void
{
}
/*
* Create a new statistic data object with its own copy of the passed
* kstat.
*/
static sdata_t *
{
return (sdp);
}
static void
{
}
/*
* Create new or update an existing list of cpu statistics. For each
* cpu two kstats are kept. One old kstat which contains the data from
* the previous scan, and new with the current data. The old and the new
* kstats *must* be for the same instance and have the same kid.
* If 'instance' argument is set to -1 don't use it as a filter.
*/
static sdata_t *
{
*errp = -1;
return (list);
}
/*
* Find the kstat in the existing list:
* If we find one for the same instance and with the
* same ks_kid we'll save it as old_kstat.
* If we find one for the same instance but with a
* different ks_kid we'll removed it.
*/
if (ksp->ks_instance ==
} else {
}
break;
}
}
/* add a new kstat instance */
if (!sdp) {
/* first instance */
if (!list) {
} else {
}
}
}
}
/* remove untouched statistics */
} else {
else
}
}
*errp = 0;
return (list);
}
/*
* Update the pset assignment information for each cpu in the statistic
* data list.
*/
static void
{
/* for new CPU create a new user data object */
/*
* set its pset to invalid, so it will not be
* used in statistics calculation.
*/
}
/* copy the pset assignment information to the previous stat */
/* set the current assignment */
}
}
/*
* Update statistic data for pset. Calculate the CPU usage in a pset.
*/
static void
{
/*
* only calculate for the asked pset id and if the cpu belongs
* to the same set in the previous and in the current snapshot.
* It means that the usage for CPUs that were rebound during
* the sampling interval are not charged to any set.
*/
"cpu_ticks_user", 0);
"cpu_ticks_kernel", 0);
"cpu_ticks_idle", 0);
"cpu_ticks_wait", 0);
}
}
bag->pset_sb_used =
} else {
}
}