/*
* 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) 2014 Gary Mills
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Support routines for CPR statistic collection
*/
extern struct cpr_terminator cpr_term;
/*
* Use ctp to specify another time point instead of the current time;
* Otherwise, ctp is NULL.
*/
void
{
if (ctp)
else {
/* need relative time even when hrestime is stoped */
cpr_tod_get(&tv);
}
return;
}
/*
* disallow entering start twice without calling end first
*/
return;
}
void
{
if (ctp)
else
cpr_tod_get(&tv);
#ifdef CPR_STAT
#endif /* CPR_STAT */
return;
}
/*
* diallow entering end twice without calling end first
*/
return;
/*
* calculate seconds
*/
/*
* calculate 100*milliseconds
*/
}
}
void
{
}
}
}
void
{
STAT->cs_real_statefsz = 0;
STAT->cs_dumped_statefsz = 0;
}
void
{
if (cpr_term.real_statef_size) {
int cur_comprate;
if (STAT->cs_min_comprate == 0 ||
}
}
void
{
int len;
printf("\n");
printf("---------------\t\tCPR PERFORMANCE SUMMARY\t\t-------------\n");
printf("Events\t\t\tRepeat[times]\tMeantime[sec]\tLastEvnt[sec]\n");
if (len < 8)
tabs = "\t\t\t";
else if (len < 16)
tabs = "\t\t";
else
tabs = "\t";
fmt = "%s%s%d\t\t%3d.%1d\t\t%3d.%1d\n";
else
fmt = "%s%s%d\t\t %3d.%1d\t\t %3d.%1d\n";
}
/*
* print the rest of the stat data
*/
printf("\nMISCELLANEOUS STATISTICS INFORMATION (units in KBytes)\n\n");
printf("\tUser Pages w/o Swapspace:\t%8lu (%lu pages)\n",
printf("\tTotal Upages Saved to Statefile:%8d (%d pages)\n",
if (cp->cs_mclustsz)
printf("\tAverage Cluster Size:\t\t%8d (%d.%1d%1d pages)\n\n",
if (cp->cs_real_statefsz) {
printf("\tCompression Ratio:\t\t%5d.%1d%1d (worst %d.%1d%1d)\n",
}
}
struct cpr_event *
{
int i;
return (cep);
}
/* if not begin not end either */
return (NULL);
for (i = 0; i < CPR_E_MAX_EVENTNUM; i++) {
if (&cpr_events_buf[i] == cep)
break;
}
if (!cep) {
new_cep = &cpr_events_buf[i];
if (!cp->cs_event_head) {
/* The 1st one */
} else {
/* insert to tail */
}
return (new_cep);
}
}
return (NULL);
}
void
{
if (min_promtime == 0 ||
if (min_promtime > CPR_DEFAULT_PROMTIME)
}