OLD | NEW |
1 /* Copyright (c) 2010, Google Inc. | 1 /* |
| 2 * Copyright 2015, Google Inc. |
2 * All rights reserved. | 3 * All rights reserved. |
3 * | 4 * |
4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
6 * met: | 7 * met: |
7 * | 8 * |
8 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 11 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 12 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 13 * in the documentation and/or other materials provided with the |
13 * distribution. | 14 * distribution. |
14 * * Neither the name of Google Inc. nor the names of its | 15 * * Neither the name of Google Inc. nor the names of its |
15 * contributors may be used to endorse or promote products derived from | 16 * contributors may be used to endorse or promote products derived from |
16 * this software without specific prior written permission. | 17 * this software without specific prior written permission. |
17 * | 18 * |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 * | 30 * |
30 * --- | |
31 * Author: Chris Ruemmler | |
32 */ | 31 */ |
33 | 32 |
34 #ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ | 33 #include <grpc/census.h> |
35 #define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ | |
36 | 34 |
37 #include "base/basictypes.h" | 35 /* TODO(aveitch): These are all placeholder implementations. */ |
38 | 36 |
39 namespace base { | 37 census_timestamp census_start_rpc_op_timestamp(void) { |
| 38 census_timestamp ct; |
| 39 /* TODO(aveitch): assumes gpr_timespec implementation of census_timestamp. */ |
| 40 ct.ts = gpr_now(GPR_CLOCK_MONOTONIC); |
| 41 return ct; |
| 42 } |
40 | 43 |
41 // We can do contention-profiling of SpinLocks, but the code is in | 44 census_context *census_start_client_rpc_op( |
42 // mutex.cc, which is not always linked in with spinlock. Hence we | 45 const census_context *context, int64_t rpc_name_id, |
43 // provide a weak definition, which are used if mutex.cc isn't linked in. | 46 const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask, |
| 47 const census_timestamp *start_time) { |
| 48 return NULL; |
| 49 } |
44 | 50 |
45 // Submit the number of cycles the spinlock spent contending. | 51 census_context *census_start_server_rpc_op( |
46 ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); | 52 const char *buffer, int64_t rpc_name_id, |
47 extern void SubmitSpinLockProfileData(const void *contendedlock, | 53 const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask, |
48 int64 wait_cycles) {} | 54 census_timestamp *start_time) { |
| 55 return NULL; |
49 } | 56 } |
50 #endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ | 57 |
| 58 census_context *census_start_op(census_context *context, const char *family, |
| 59 const char *name, int trace_mask) { |
| 60 return NULL; |
| 61 } |
| 62 |
| 63 void census_end_op(census_context *context, int status) {} |
OLD | NEW |