dt_aggregate.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
#include <unistd.h>
#include <dt_impl.h>
#include <assert.h>
static void
{
int i;
}
static int
{
return (1);
return (-1);
return (0);
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
static int
{
return (1);
return (-1);
return (0);
}
/*ARGSUSED*/
static void
{
int i;
for (i = 0; i <= levels + 1; i++)
}
static int64_t
{
}
static int
{
return (1);
return (-1);
return (0);
}
static int
{
int nbuckets = DTRACE_QUANTIZE_NBUCKETS, i;
for (i = 0; i < nbuckets; i++) {
}
return (1);
return (-1);
return (0);
}
static int
{
int i, j, rval;
dt_ahashent_t *h;
/*
* If that failed with ENOENT, it may be because the
* CPU was unconfigured. This is okay; we'll just
* do nothing but return success.
*/
return (0);
}
}
if (buf->dtbd_drops != 0) {
return (-1);
}
return (0);
}
/*
* We're guaranteed to have an ID.
*/
if (id == DTRACE_AGGIDNONE) {
/*
* This is filler to assure proper alignment of the
* next record; we simply ignore it.
*/
continue;
}
return (rval);
hashval = 0;
}
if (h->dtahe_hashval != hashval)
continue;
if (h->dtahe_size != size)
continue;
aggdata = &h->dtahe_data;
goto hashnext;
}
/*
* We found it. Now we need to apply the aggregating
* action on the data here.
*/
/* LINTED - alignment */
/* LINTED - alignment */
/*
* If we're keeping per CPU data, apply the aggregating
* action there as well.
*/
/* LINTED - alignment */
/* LINTED - alignment */
}
goto bufnext;
continue;
}
/*
* If we're here, we couldn't find an entry for this record.
*/
bzero(h, sizeof (dt_ahashent_t));
aggdata = &h->dtahe_data;
free(h);
}
h->dtahe_hashval = hashval;
h->dtahe_size = size;
if (flags & DTRACE_A_PERCPU) {
free(h);
}
for (j = 0; j < max_cpus; j++) {
while (--j >= 0)
free(h);
}
if (j == cpu) {
} else {
}
}
}
switch (rec->dtrd_action) {
case DTRACEAGG_MIN:
break;
case DTRACEAGG_MAX:
break;
case DTRACEAGG_LQUANTIZE:
break;
case DTRACEAGG_COUNT:
case DTRACEAGG_SUM:
case DTRACEAGG_AVG:
case DTRACEAGG_QUANTIZE:
break;
default:
}
}
return (0);
}
int
{
int i, rval;
if (dtp->dt_lastagg != 0) {
return (0);
} else {
}
return (0);
for (i = 0; i < agp->dtat_ncpus; i++) {
return (rval);
}
return (0);
}
static int
{
return (-1);
return (1);
return (0);
}
static int
{
/*
* We know that we have a compiler-generated ID as the first record.
*/
return (-1);
return (1);
return (0);
}
static int
{
int rval, i;
return (rval);
return (-1);
return (1);
case sizeof (uint64_t):
/* LINTED - alignment */
/* LINTED - alignment */
break;
case sizeof (uint32_t):
/* LINTED - alignment */
/* LINTED - alignment */
break;
case sizeof (uint16_t):
/* LINTED - alignment */
/* LINTED - alignment */
break;
case sizeof (uint8_t):
break;
default:
return (-1);
return (1);
}
continue;
}
return (-1);
return (1);
}
return (0);
}
static int
{
int rval, i;
return (rval);
return (-1);
return (1);
for (i = 0; i < lagg->dtagd_nrecs; i++) {
return (-1);
return (1);
return (-1);
return (1);
}
switch (lrec->dtrd_action) {
case DTRACEAGG_AVG:
break;
case DTRACEAGG_QUANTIZE:
break;
case DTRACEAGG_LQUANTIZE:
break;
case DTRACEAGG_COUNT:
case DTRACEAGG_SUM:
case DTRACEAGG_MIN:
case DTRACEAGG_MAX:
break;
default:
assert(0);
}
if (rval != 0)
return (rval);
/*
* If we're here, the values for the two aggregation elements are
* equal. We already know that the key layout is the same for the two
* elements; we must now compare the keys themselves as a tie-breaker.
*/
}
static int
{
int rval;
return (rval);
}
static int
{
int rval;
return (rval);
}
static int
{
int rval;
return (rval);
}
static int
{
int rval;
return (rval);
}
static int
{
}
static int
{
}
static int
{
}
static int
{
}
int
{
int rval, i;
/*
* Use the aggregation buffer size as reloaded from the kernel.
*/
return (0);
/*
* Now query for the CPUs enabled.
*/
if (cpu != DTRACE_CPUALL) {
return (0);
}
agp->dtat_ncpus = 0;
for (i = 0; i < agp->dtat_maxcpu; i++) {
continue;
}
return (0);
}
static int
{
int i;
switch (rval) {
case DTRACE_AGGWALK_NEXT:
break;
case DTRACE_AGGWALK_CLEAR: {
data = &h->dtahe_data;
}
break;
break;
}
case DTRACE_AGGWALK_ERROR:
/*
* We assume that errno is already set in this case.
*/
case DTRACE_AGGWALK_ABORT:
return (0);
case DTRACE_AGGWALK_NORMALIZE:
if (h->dtahe_data.dtada_normal == 0) {
}
return (0);
case DTRACE_AGGWALK_REMOVE: {
/*
* First, remove this hash entry from its hash chain.
*/
if (h->dtahe_prev != NULL) {
} else {
}
if (h->dtahe_next != NULL)
/*
* Now remove it from the list of all hash entries.
*/
if (h->dtahe_prevall != NULL) {
} else {
}
if (h->dtahe_nextall != NULL)
/*
* We're unlinked. We can safely destroy the data.
*/
for (i = 0; i < max_cpus; i++)
}
free(h);
return (0);
}
default:
}
return (0);
}
int
{
dt_ahashent_t *h, *next;
/*
* dt_aggwalk_rval() can potentially remove the current hash
* entry; we need to load the next hash entry before calling
* into it.
*/
next = h->dtahe_nextall;
return (-1);
}
return (0);
}
static int
int (*sfunc)(const void *, const void *))
{
dt_ahashent_t *h, **sorted;
nentries++;
sorted[i++] = h;
for (i = 0; i < nentries; i++) {
h = sorted[i];
return (-1);
}
return (0);
}
int
{
}
int
{
}
int
{
}
int
{
}
int
{
}
int
{
}
int
{
}
int
{
}
int
{
return (0);
}
void
{
dt_ahashent_t *h;
data = &h->dtahe_data;
continue;
for (i = 0; i < max_cpus; i++)
}
}
void
{
dt_ahashent_t *h, *next;
} else {
next = h->dtahe_nextall;
aggdata = &h->dtahe_data;
for (i = 0; i < max_cpus; i++)
}
free(h);
}
}
}