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/lockstat.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org> 
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  *
   25  * $FreeBSD: releng/11.1/sys/sys/lockstat.h 315394 2017-03-16 08:29:09Z mjg $
   26  */
   27  
   28 /*
   29  * DTrace lockstat provider definitions
   30  */
   31 
   32 #ifndef _SYS_LOCKSTAT_H
   33 #define _SYS_LOCKSTAT_H
   34 
   35 #ifdef _KERNEL
   36 
   37 #include <sys/param.h>
   38 #include <sys/queue.h>
   39 #include <sys/sdt.h>
   40 
   41 SDT_PROVIDER_DECLARE(lockstat);
   42 
   43 SDT_PROBE_DECLARE(lockstat, , , adaptive__acquire);
   44 SDT_PROBE_DECLARE(lockstat, , , adaptive__release);
   45 SDT_PROBE_DECLARE(lockstat, , , adaptive__spin);
   46 SDT_PROBE_DECLARE(lockstat, , , adaptive__block);
   47 
   48 SDT_PROBE_DECLARE(lockstat, , , spin__acquire);
   49 SDT_PROBE_DECLARE(lockstat, , , spin__release);
   50 SDT_PROBE_DECLARE(lockstat, , , spin__spin);
   51 
   52 SDT_PROBE_DECLARE(lockstat, , , rw__acquire);
   53 SDT_PROBE_DECLARE(lockstat, , , rw__release);
   54 SDT_PROBE_DECLARE(lockstat, , , rw__block);
   55 SDT_PROBE_DECLARE(lockstat, , , rw__spin);
   56 SDT_PROBE_DECLARE(lockstat, , , rw__upgrade);
   57 SDT_PROBE_DECLARE(lockstat, , , rw__downgrade);
   58 
   59 SDT_PROBE_DECLARE(lockstat, , , sx__acquire);
   60 SDT_PROBE_DECLARE(lockstat, , , sx__release);
   61 SDT_PROBE_DECLARE(lockstat, , , sx__block);
   62 SDT_PROBE_DECLARE(lockstat, , , sx__spin);
   63 SDT_PROBE_DECLARE(lockstat, , , sx__upgrade);
   64 SDT_PROBE_DECLARE(lockstat, , , sx__downgrade);
   65 
   66 SDT_PROBE_DECLARE(lockstat, , , thread__spin);
   67 
   68 #define LOCKSTAT_WRITER         0
   69 #define LOCKSTAT_READER         1
   70 
   71 extern volatile int lockstat_enabled;
   72 
   73 #ifdef KDTRACE_HOOKS
   74 
   75 #define LOCKSTAT_RECORD0(probe, lp)                                     \
   76         SDT_PROBE1(lockstat, , , probe, lp)
   77 
   78 #define LOCKSTAT_RECORD1(probe, lp, arg1)                               \
   79         SDT_PROBE2(lockstat, , , probe, lp, arg1)
   80 
   81 #define LOCKSTAT_RECORD2(probe, lp, arg1, arg2)                         \
   82         SDT_PROBE3(lockstat, , , probe, lp, arg1, arg2)
   83 
   84 #define LOCKSTAT_RECORD3(probe, lp, arg1, arg2, arg3)                   \
   85         SDT_PROBE4(lockstat, , , probe, lp, arg1, arg2, arg3)
   86 
   87 #define LOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4)             \
   88         SDT_PROBE5(lockstat, , , probe, lp, arg1, arg2, arg3, arg4)
   89 
   90 #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \
   91         lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \
   92         LOCKSTAT_RECORD0(probe, lp);                                    \
   93 } while (0)
   94 
   95 #define LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(probe, lp, c, wt, f, l, a) do { \
   96         lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \
   97         LOCKSTAT_RECORD1(probe, lp, a);                                 \
   98 } while (0)
   99 
  100 #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do {                   \
  101         lock_profile_release_lock(&(lp)->lock_object);                  \
  102         LOCKSTAT_RECORD0(probe, lp);                                    \
  103 } while (0)
  104 
  105 #define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) do {              \
  106         lock_profile_release_lock(&(lp)->lock_object);                  \
  107         LOCKSTAT_RECORD1(probe, lp, a);                                 \
  108 } while (0)
  109 
  110 #ifndef LOCK_PROFILING
  111 #define LOCKSTAT_PROFILE_ENABLED(probe)         __predict_false(lockstat_enabled)
  112 #define LOCKSTAT_OOL_PROFILE_ENABLED(probe)     LOCKSTAT_PROFILE_ENABLED(probe)
  113 #else
  114 #define LOCKSTAT_OOL_PROFILE_ENABLED(probe)     1
  115 #endif
  116 
  117 struct lock_object;
  118 uint64_t lockstat_nsecs(struct lock_object *);
  119 
  120 #else /* !KDTRACE_HOOKS */
  121 
  122 #define LOCKSTAT_RECORD0(probe, lp)
  123 #define LOCKSTAT_RECORD1(probe, lp, arg1)
  124 #define LOCKSTAT_RECORD2(probe, lp, arg1, arg2)
  125 #define LOCKSTAT_RECORD3(probe, lp, arg1, arg2, arg3)
  126 #define LOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4)
  127 
  128 #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)    \
  129         lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l)
  130 
  131 #define LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(probe, lp, c, wt, f, l, a) \
  132         LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)
  133 
  134 #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)                        \
  135         lock_profile_release_lock(&(lp)->lock_object)
  136 
  137 #define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a)                   \
  138         LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)
  139 
  140 #ifndef LOCK_PROFILING
  141 #define LOCKSTAT_PROFILE_ENABLED(probe)         0
  142 #endif
  143 #define LOCKSTAT_OOL_PROFILE_ENABLED(probe)     1
  144 
  145 #endif /* !KDTRACE_HOOKS */
  146 
  147 #endif /* _KERNEL */
  148 #endif /* _SYS_LOCKSTAT_H */

Cache object: 24f5b0dbb973c394623c4b5b55bcbb85


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