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/sys/evcnt.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 /*      $NetBSD: evcnt.h,v 1.5 2007/12/16 20:45:59 dyoung Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1996, 2000 Christopher G. Demetriou
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *          This product includes software developed for the
   18  *          NetBSD Project.  See http://www.NetBSD.org/ for
   19  *          information about NetBSD.
   20  * 4. The name of the author may not be used to endorse or promote products
   21  *    derived from this software without specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   33  *
   34  * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
   35  */
   36 
   37 /*
   38  * Copyright (c) 1992, 1993
   39  *      The Regents of the University of California.  All rights reserved.
   40  *
   41  * This software was developed by the Computer Systems Engineering group
   42  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
   43  * contributed to Berkeley.
   44  *
   45  * All advertising materials mentioning features or use of this software
   46  * must display the following acknowledgement:
   47  *      This product includes software developed by the University of
   48  *      California, Lawrence Berkeley Laboratories.
   49  *
   50  * Redistribution and use in source and binary forms, with or without
   51  * modification, are permitted provided that the following conditions
   52  * are met:
   53  * 1. Redistributions of source code must retain the above copyright
   54  *    notice, this list of conditions and the following disclaimer.
   55  * 2. Redistributions in binary form must reproduce the above copyright
   56  *    notice, this list of conditions and the following disclaimer in the
   57  *    documentation and/or other materials provided with the distribution.
   58  * 3. Neither the name of the University nor the names of its contributors
   59  *    may be used to endorse or promote products derived from this software
   60  *    without specific prior written permission.
   61  *
   62  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   63  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   64  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   65  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   66  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   67  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   68  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   69  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   70  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   71  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   72  * SUCH DAMAGE.
   73  */
   74 
   75 #ifndef _SYS_EVCNT_H_
   76 #define _SYS_EVCNT_H_
   77 
   78 #include <sys/queue.h>
   79 #include <sys/stdint.h>
   80 
   81 /*
   82  * event counters
   83  */
   84 
   85 struct evcnt {
   86         uint64_t        ev_count;       /* how many have occurred */
   87         TAILQ_ENTRY(evcnt) ev_list;     /* entry on list of all counters */
   88         unsigned char   ev_type;        /* counter type; see below */
   89         unsigned char   ev_grouplen;    /* 'group' len, excluding NUL */
   90         unsigned char   ev_namelen;     /* 'name' len, excluding NUL */
   91         char            ev_pad1;        /* reserved (for now); 0 */
   92         const struct evcnt *ev_parent;  /* parent, for hierarchical ctrs */
   93         const char      *ev_group;      /* name of group */
   94         const char      *ev_name;       /* name of specific event */
   95 };
   96 TAILQ_HEAD(evcntlist, evcnt);
   97 
   98 /* maximum group/name lengths, including trailing NUL */
   99 #define EVCNT_STRING_MAX        256
  100 
  101 /* ev_type values */
  102 #define EVCNT_TYPE_MISC         0       /* miscellaneous; catch all */
  103 #define EVCNT_TYPE_INTR         1       /* interrupt; count with vmstat -i */
  104 #define EVCNT_TYPE_TRAP         2       /* processor trap/execption */
  105 
  106 /*
  107  * initializer for an event count structure.  the lengths are initted and
  108  * it is added to the evcnt list at attach time.
  109  */
  110 #define EVCNT_INITIALIZER(type, parent, group, name)    \
  111     {                                                   \
  112         .ev_type = type,                                \
  113         .ev_parent = parent,                            \
  114         .ev_group = group,                              \
  115         .ev_name = name,                                \
  116     }
  117 
  118 /*
  119  * Attach a static event counter.  This uses a link set to do the work.
  120  * NOTE: "ev" should not be a pointer to the object, but rather a direct
  121  * reference to the object itself.
  122  */
  123 #define EVCNT_ATTACH_STATIC(ev)         __link_set_add_data(evcnts, ev)
  124 #define EVCNT_ATTACH_STATIC2(ev, n)     __link_set_add_data2(evcnts, ev, n)
  125 
  126 #ifdef _KERNEL
  127 
  128 extern struct evcntlist allevents;      /* list of all event counters */
  129 
  130 void    evcnt_init(void);
  131 void    evcnt_attach_static(struct evcnt *);
  132 void    evcnt_attach_dynamic(struct evcnt *, int, const struct evcnt *,
  133             const char *, const char *);
  134 void    evcnt_detach(struct evcnt *);
  135 
  136 #ifdef DDB
  137 void    event_print(int, void (*)(const char *, ...));
  138 #endif
  139 #endif /* _KERNEL */
  140 
  141 #endif /* !_SYS_EVCNT_H_ */

Cache object: 777b500140f5eaabae53d3941c24886b


[ 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.