/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef LIBMICRO_H
#define LIBMICRO_H
#include <pthread.h>
typedef struct {
long long re_count;
long long re_errors;
long long re_t0;
long long re_t1;
} result_t;
typedef struct {
double sum;
long long count;
} histo_t;
/*
* stats we compute on data sets
*/
typedef struct stats {
double st_min;
double st_max;
double st_mean;
double st_median;
double st_stddev;
double st_stderr;
double st_99confidence;
double st_skew;
double st_kurtosis;
} stats_t;
/*
* Barrier stuff
*/
typedef struct {
#ifdef USE_SEMOP
int ba_semid;
#else
#endif
#ifdef NEVER
#endif
long long ba_count0;
long long ba_errors0;
} barrier_t;
/*
* Barrier interfaces
*/
/*
* Functions that can be provided by the user
*/
int benchmark_init();
int benchmark_fini();
int benchmark_initrun();
int benchmark_finirun();
int benchmark_initworker();
int benchmark_finiworker();
int benchmark_initbatch(void *tsd);
int benchmark_finibatch(void *tsd);
char *benchmark_result();
/*
* Globals exported to the user
*/
extern int lm_argc;
extern char **lm_argv;
extern int lm_optB;
extern int lm_optD;
extern int lm_optH;
extern char *lm_optN;
extern int lm_optP;
extern int lm_optS;
extern int lm_optT;
extern int lm_defB;
extern int lm_defD;
extern int lm_defH;
extern char *lm_defN;
extern int lm_defP;
extern int lm_defS;
extern int lm_defT;
extern int lm_nsecs_per_op;
extern char *lm_procpath;
extern char lm_procname[STRSIZE];
extern size_t lm_tsdsize;
/*
* Utility functions
*/
int getpindex();
int gettindex();
void *gettsd(int p, int t);
long long getusecs();
long long getnsecs();
int setfdlimit(int limit);
long long sizetoll();
int sizetoint();
int fit_line(double *, double *, int, double *, double *);
long long get_nsecs_resolution();
#endif /* LIBMICRO_H */