YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/gutil/synchronization_profiling.h
Line
Count
Source
1
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
2
/* Copyright (c) 2010, Google Inc.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are
7
 * met:
8
 *
9
 *     * Redistributions of source code must retain the above copyright
10
 * notice, this list of conditions and the following disclaimer.
11
 *     * Redistributions in binary form must reproduce the above
12
 * copyright notice, this list of conditions and the following disclaimer
13
 * in the documentation and/or other materials provided with the
14
 * distribution.
15
 *     * Neither the name of Google Inc. nor the names of its
16
 * contributors may be used to endorse or promote products derived from
17
 * this software without specific prior written permission.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 *
31
 * The following only applies to changes made to this file as part of YugaByte development.
32
 *
33
 * Portions Copyright (c) YugaByte, Inc.
34
 *
35
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
36
 * in compliance with the License.  You may obtain a copy of the License at
37
 *
38
 * http://www.apache.org/licenses/LICENSE-2.0
39
 *
40
 * Unless required by applicable law or agreed to in writing, software distributed under the License
41
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
42
 * or implied.  See the License for the specific language governing permissions and limitations
43
 * under the License.
44
 *
45
 *
46
 * ---
47
 * Author: Chris Ruemmler
48
 */
49
50
#ifndef YB_GUTIL_SYNCHRONIZATION_PROFILING_H
51
#define YB_GUTIL_SYNCHRONIZATION_PROFILING_H
52
53
#include "yb/gutil/integral_types.h"
54
55
namespace gutil {
56
57
// We can do contention-profiling of SpinLocks, but the code is in
58
// mutex.cc, which is not always linked in with spinlock.  Hence we
59
// provide a weak definition, which are used if mutex.cc isn't linked in.
60
61
// Submit the number of cycles the spinlock spent contending.
62
ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64);
63
extern void SubmitSpinLockProfileData(const void *contendedlock,
64
11.6M
                                      int64 wait_cycles) {}
65
} // namespace gutil
66
67
#endif  // YB_GUTIL_SYNCHRONIZATION_PROFILING_H