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

Cache object: 98543c8f935e4e3b0293c45a430306fd


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