blob: 4e9230ce58c1ddc0333079f5397fe1518b0994c7 [file] [log] [blame]
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +00001/*
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 Wasilczykdaf727a2023-11-21 13:50:09 -080020#include <cutils/trace.h>
Tomasz Wasilczyk346f1042023-10-09 17:02:46 +000021#include <utils/misc.h>
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +000022
Tomasz Wasilczyk03dccde2023-12-04 11:04:17 -080023namespace android::binder {
24namespace os {
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +000025
26uint64_t GetThreadId() {
27#ifdef BINDER_RPC_SINGLE_THREADED
28 return 0;
29#else
30 return base::GetThreadId();
31#endif
32}
33
Tomasz Wasilczyk346f1042023-10-09 17:02:46 +000034bool report_sysprop_change() {
35 android::report_sysprop_change();
36 return true;
37}
38
Tomasz Wasilczykdaf727a2023-11-21 13:50:09 -080039void trace_begin(uint64_t tag, const char* name) {
40 atrace_begin(tag, name);
41}
42
43void trace_end(uint64_t tag) {
44 atrace_end(tag);
45}
46
Tomasz Wasilczyka9e451a2024-05-22 12:18:42 -070047void trace_int(uint64_t tag, const char* name, int32_t value) {
48 atrace_int(tag, name, value);
49}
50
Pawan Wagh0d6e60f2024-09-26 00:08:10 +000051uint64_t get_trace_enabled_tags() {
52 return atrace_enabled_tags;
53}
54
Tomasz Wasilczyk03dccde2023-12-04 11:04:17 -080055} // namespace os
56
57// Legacy trace symbol. To be removed once all of downstream rebuilds.
58void 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.
63void atrace_end(uint64_t tag) {
64 os::trace_end(tag);
65}
66
67} // namespace android::binder