Tomasz Wasilczyk | 0d9dec2 | 2023-10-06 20:28:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2023 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "OS.h" |
| 18 | |
| 19 | #include <android-base/threads.h> |
Tomasz Wasilczyk | daf727a | 2023-11-21 13:50:09 -0800 | [diff] [blame] | 20 | #include <cutils/trace.h> |
Tomasz Wasilczyk | 346f104 | 2023-10-09 17:02:46 +0000 | [diff] [blame] | 21 | #include <utils/misc.h> |
Tomasz Wasilczyk | 0d9dec2 | 2023-10-06 20:28:49 +0000 | [diff] [blame] | 22 | |
Tomasz Wasilczyk | 03dccde | 2023-12-04 11:04:17 -0800 | [diff] [blame] | 23 | namespace android::binder { |
| 24 | namespace os { |
Tomasz Wasilczyk | 0d9dec2 | 2023-10-06 20:28:49 +0000 | [diff] [blame] | 25 | |
| 26 | uint64_t GetThreadId() { |
| 27 | #ifdef BINDER_RPC_SINGLE_THREADED |
| 28 | return 0; |
| 29 | #else |
| 30 | return base::GetThreadId(); |
| 31 | #endif |
| 32 | } |
| 33 | |
Tomasz Wasilczyk | 346f104 | 2023-10-09 17:02:46 +0000 | [diff] [blame] | 34 | bool report_sysprop_change() { |
| 35 | android::report_sysprop_change(); |
| 36 | return true; |
| 37 | } |
| 38 | |
Tomasz Wasilczyk | daf727a | 2023-11-21 13:50:09 -0800 | [diff] [blame] | 39 | void trace_begin(uint64_t tag, const char* name) { |
| 40 | atrace_begin(tag, name); |
| 41 | } |
| 42 | |
| 43 | void trace_end(uint64_t tag) { |
| 44 | atrace_end(tag); |
| 45 | } |
| 46 | |
Tomasz Wasilczyk | a9e451a | 2024-05-22 12:18:42 -0700 | [diff] [blame] | 47 | void trace_int(uint64_t tag, const char* name, int32_t value) { |
| 48 | atrace_int(tag, name, value); |
| 49 | } |
| 50 | |
Pawan Wagh | 0d6e60f | 2024-09-26 00:08:10 +0000 | [diff] [blame] | 51 | uint64_t get_trace_enabled_tags() { |
| 52 | return atrace_enabled_tags; |
| 53 | } |
| 54 | |
Tomasz Wasilczyk | 03dccde | 2023-12-04 11:04:17 -0800 | [diff] [blame] | 55 | } // namespace os |
| 56 | |
| 57 | // Legacy trace symbol. To be removed once all of downstream rebuilds. |
| 58 | void atrace_begin(uint64_t tag, const char* name) { |
| 59 | os::trace_begin(tag, name); |
| 60 | } |
| 61 | |
| 62 | // Legacy trace symbol. To be removed once all of downstream rebuilds. |
| 63 | void atrace_end(uint64_t tag) { |
| 64 | os::trace_end(tag); |
| 65 | } |
| 66 | |
| 67 | } // namespace android::binder |