• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef INCLUDE_PERFETTO_PUBLIC_ABI_THREAD_UTILS_ABI_H_
18 #define INCLUDE_PERFETTO_PUBLIC_ABI_THREAD_UTILS_ABI_H_
19 
20 #include <stdint.h>
21 
22 #include "perfetto/public/abi/export.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #if defined(__Fuchsia__)
29 #include <zircon/types.h>
30 #elif defined(__linux__)
31 #include <sys/types.h>
32 #include <unistd.h>
33 #elif defined(__APPLE__) || defined(_WIN32)
34 #include <stdint.h>
35 #else
36 #include <pthread.h>
37 #endif
38 
39 #if defined(__linux__) || defined(__native_client__)
40 typedef pid_t PerfettoThreadId;
41 #elif defined(__Fuchsia__)
42 typedef zx_koid_t PerfettoThreadId;
43 #elif defined(__APPLE__) || defined(_WIN32)
44 typedef uint64_t PerfettoThreadId;
45 #else
46 typedef pthread_t PerfettoThreadId;
47 #endif
48 
49 PERFETTO_SDK_EXPORT PerfettoThreadId PerfettoGetThreadIdImpl(void);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif  // INCLUDE_PERFETTO_PUBLIC_ABI_THREAD_UTILS_ABI_H_
56