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  * 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.0/sys/sys/lockstat.h 285709 2015-07-20 04:41:25Z markj $
   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 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 struct lock_object;
  111 uint64_t lockstat_nsecs(struct lock_object *);
  112 
  113 #else /* !KDTRACE_HOOKS */
  114 
  115 #define LOCKSTAT_RECORD0(probe, lp)
  116 #define LOCKSTAT_RECORD1(probe, lp, arg1)
  117 #define LOCKSTAT_RECORD2(probe, lp, arg1, arg2)
  118 #define LOCKSTAT_RECORD3(probe, lp, arg1, arg2, arg3)
  119 #define LOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4)
  120 
  121 #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)    \
  122         lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l)
  123 
  124 #define LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(probe, lp, c, wt, f, l, a) \
  125         LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)
  126 
  127 #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)                        \
  128         lock_profile_release_lock(&(lp)->lock_object)
  129 
  130 #define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a)                   \
  131         LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)
  132 
  133 #endif /* !KDTRACE_HOOKS */
  134 #endif /* _KERNEL */
  135 #endif /* _SYS_LOCKSTAT_H */

Cache object: 1284967c62a961df8ec932ab7bd34e11


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