The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/tools/tests/libMicro/libmicro.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License, Version 1.0 only
    6  * (the "License").  You may not use this file except in compliance
    7  * with the License.
    8  *
    9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   10  * or http://www.opensolaris.org/os/licensing.
   11  * See the License for the specific language governing permissions
   12  * and limitations under the License.
   13  *
   14  * When distributing Covered Code, include this CDDL HEADER in each
   15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   16  * If applicable, add the following below this CDDL HEADER, with the
   17  * fields enclosed by brackets "[]" replaced with your own identifying
   18  * information: Portions Copyright [yyyy] [name of copyright owner]
   19  *
   20  * CDDL HEADER END
   21  */
   22 
   23 /*
   24  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
   25  * Use is subject to license terms.
   26  */
   27 
   28 #ifndef LIBMICRO_H
   29 #define LIBMICRO_H
   30 
   31 #include <pthread.h>
   32 
   33 #define LIBMICRO_VERSION        "0.4.0"
   34 
   35 #define STRSIZE                 1024
   36 
   37 #define STREQ(a,b) (strcmp(a,b) == 0)
   38 
   39 typedef struct {
   40         long long               re_count;
   41         long long               re_errors;
   42         long long               re_t0;
   43         long long               re_t1;
   44 } result_t;
   45 
   46 typedef struct {
   47         double                  sum;
   48         long long               count;
   49 } histo_t;
   50 
   51 #define HISTOSIZE               32
   52 #define DATASIZE                100000
   53 
   54 /*
   55  * stats we compute on data sets
   56  */
   57 
   58 typedef struct stats {
   59         double  st_min;
   60         double  st_max;
   61         double  st_mean;
   62         double  st_median;
   63         double  st_stddev;
   64         double  st_stderr;
   65         double  st_99confidence;
   66         double  st_skew;
   67         double  st_kurtosis;
   68         double  st_timecorr;    /* correlation with respect to time */
   69 } stats_t;
   70 
   71 /*
   72  * Barrier stuff
   73  */
   74 
   75 typedef struct {
   76         int                     ba_hwm;         /* barrier setpoint     */
   77         int                     ba_flag;        /* benchmark while true */
   78         long long               ba_deadline;    /* when to stop         */
   79         int                     ba_phase;       /* number of time used  */
   80         int                     ba_waiters;     /* how many are waiting */
   81 
   82 #ifdef USE_SEMOP
   83         int                     ba_semid;
   84 #else
   85         pthread_mutex_t         ba_lock;
   86         pthread_cond_t          ba_cv;
   87 #endif
   88 
   89         long long               ba_count;       /* how many ops          */
   90         long long               ba_errors;      /* how many errors       */
   91 
   92         int                     ba_quant;       /* how many quant errors */
   93         int                     ba_batches;     /* how many samples      */
   94 
   95         double                  ba_starttime;   /* test time start */
   96         double                  ba_endtime;     /* test time end */
   97 
   98 #ifdef NEVER
   99         double                  ba_tmin;        /* min time taken */
  100         double                  ba_tmax;        /* max time taken */
  101         double                  ba_ctmax;       /* max after outliers */
  102         double                  ba_mean;        /* average value */
  103         double                  ba_median;      /* median value */
  104         double                  ba_rawmedian;   /* raw median value */
  105         double                  ba_stddev;      /* standard deviation */
  106         double                  ba_stderr;      /* standard error */
  107         double                  ba_skew;        /* skew */
  108         double                  ba_kurtosis;    /* kurtosis */
  109 #endif
  110         stats_t                 ba_raw;         /* raw stats */
  111         stats_t                 ba_corrected;   /* corrected stats */
  112 
  113         int                     ba_outliers;    /* outlier count */
  114 
  115         long long               ba_t0;          /* first thread/proc */
  116         long long               ba_t1;          /* time of last thread */
  117         long long               ba_count0;
  118         long long               ba_errors0;
  119 
  120         int                     ba_datasize;    /* possible #items data */
  121         double                  ba_data[1];     /* start of data ararry */
  122 } barrier_t;
  123 
  124 
  125 /*
  126  * Barrier interfaces
  127  */
  128 
  129 barrier_t *barrier_create(int hwm, int datasize);
  130 int barrier_destroy(barrier_t *bar);
  131 int barrier_queue(barrier_t *bar, result_t *res);
  132 
  133 
  134 /*
  135  * Functions that can be provided by the user
  136  */
  137 
  138 int     benchmark(void *tsd, result_t *res);
  139 int     benchmark_init();
  140 int     benchmark_fini();
  141 int     benchmark_initrun();
  142 int     benchmark_finirun();
  143 int     benchmark_initworker();
  144 int     benchmark_finiworker();
  145 int     benchmark_initbatch(void *tsd);
  146 int     benchmark_finibatch(void *tsd);
  147 int     benchmark_optswitch(int opt, char *optarg);
  148 char    *benchmark_result();
  149 
  150 
  151 /*
  152  * Globals exported to the user
  153  */
  154 
  155 extern int                      lm_argc;
  156 extern char                     **lm_argv;
  157 
  158 extern int                      lm_optB;
  159 extern int                      lm_optD;
  160 extern int                      lm_optH;
  161 extern char                     *lm_optN;
  162 extern int                      lm_optP;
  163 extern int                      lm_optS;
  164 extern int                      lm_optT;
  165 
  166 extern int                      lm_defB;
  167 extern int                      lm_defD;
  168 extern int                      lm_defH;
  169 extern char                     *lm_defN;
  170 extern int                      lm_defP;
  171 extern int                      lm_defS;
  172 extern int                      lm_defT;
  173 extern int                      lm_nsecs_per_op;
  174 
  175 extern char                     *lm_procpath;
  176 extern char                     lm_procname[STRSIZE];
  177 extern char                     lm_usage[STRSIZE];
  178 extern char                     lm_optstr[STRSIZE];
  179 extern char                     lm_header[STRSIZE];
  180 extern size_t                   lm_tsdsize;
  181 
  182 
  183 /*
  184  * Utility functions
  185  */
  186 
  187 int             getpindex();
  188 int             gettindex();
  189 void            *gettsd(int p, int t);
  190 #if defined(__APPLE__)
  191 int gettsdindex(void *arg);
  192 #endif /* __APPLE__ */
  193 long long       getusecs();
  194 long long       getnsecs();
  195 int             setfdlimit(int limit);
  196 long long       sizetoll();
  197 int             sizetoint();
  198 int             fit_line(double *, double *, int, double *, double *);
  199 long long       get_nsecs_resolution();
  200 
  201 
  202 /* Apple Mods Here */
  203 
  204 
  205 
  206 #ifdef  NO_PORTMAPPER
  207 #define TCP_SELECT      -31233
  208 #define TCP_XACT        -31234
  209 #define TCP_CONTROL     -31235
  210 #define TCP_DATA        -31236
  211 #define TCP_CONNECT     -31237
  212 #define UDP_XACT        -31238
  213 #define UDP_DATA        -31239
  214 #else
  215 #define TCP_SELECT      (u_long)404038  /* XXX - unregistered */
  216 #define TCP_XACT        (u_long)404039  /* XXX - unregistered */
  217 #define TCP_CONTROL     (u_long)404040  /* XXX - unregistered */
  218 #define TCP_DATA        (u_long)404041  /* XXX - unregistered */
  219 #define TCP_CONNECT     (u_long)404042  /* XXX - unregistered */
  220 #define UDP_XACT        (u_long)404032  /* XXX - unregistered */
  221 #define UDP_DATA        (u_long)404033  /* XXX - unregistered */
  222 #define VERS            (u_long)1
  223 #endif
  224  
  225 /*
  226 * socket send/recv buffer optimizations
  227 */
  228 #define SOCKOPT_READ    0x0001
  229 #define SOCKOPT_WRITE   0x0002
  230 #define SOCKOPT_RDWR    0x0003
  231 #define SOCKOPT_PID     0x0004
  232 #define SOCKOPT_REUSE   0x0008
  233 #define SOCKOPT_NONE    0
  234 
  235 #ifndef SOCKBUF
  236 #define SOCKBUF         (1024*1024)
  237 #endif
  238 
  239 #ifndef XFERSIZE
  240 #define XFERSIZE        (64*1024)       /* all bandwidth I/O should use this */
  241 #endif
  242 
  243 typedef unsigned long iter_t;
  244 
  245 int     tcp_server(int prog, int rdwr);
  246 int     tcp_done(int prog);
  247 int     tcp_accept(int sock, int rdwr);
  248 int     tcp_connect(char *host, int prog, int rdwr);
  249 void    sock_optimize(int sock, int rdwr);
  250 int     sockport(int s);
  251 
  252 /* end Apple Mods */
  253         
  254 
  255 #endif /* LIBMICRO_H */

Cache object: 1cbb3ff80278bfbda1acc5c3ff9f3c1b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.