Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / deps / grpc / third_party / abseil-cpp / absl / base / internal / sysinfo.h
1 // Copyright 2017 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // This file includes routines to find out characteristics
16 // of the machine a program is running on.  It is undoubtedly
17 // system-dependent.
18
19 // Functions listed here that accept a pid_t as an argument act on the
20 // current process if the pid_t argument is 0
21 // All functions here are thread-hostile due to file caching unless
22 // commented otherwise.
23
24 #ifndef ABSL_BASE_INTERNAL_SYSINFO_H_
25 #define ABSL_BASE_INTERNAL_SYSINFO_H_
26
27 #ifndef _WIN32
28 #include <sys/types.h>
29 #else
30 #include <intsafe.h>
31 #endif
32
33 #include "absl/base/port.h"
34
35 namespace absl {
36 namespace base_internal {
37
38 // Nominal core processor cycles per second of each processor.   This is _not_
39 // necessarily the frequency of the CycleClock counter (see cycleclock.h)
40 // Thread-safe.
41 double NominalCPUFrequency();
42
43 // Number of logical processors (hyperthreads) in system. Thread-safe.
44 int NumCPUs();
45
46 // Return the thread id of the current thread, as told by the system.
47 // No two currently-live threads implemented by the OS shall have the same ID.
48 // Thread ids of exited threads may be reused.   Multiple user-level threads
49 // may have the same thread ID if multiplexed on the same OS thread.
50 //
51 // On Linux, you may send a signal to the resulting ID with kill().  However,
52 // it is recommended for portability that you use pthread_kill() instead.
53 #ifdef _WIN32
54 // On Windows, process id and thread id are of the same type according to
55 // the return types of GetProcessId() and GetThreadId() are both DWORD.
56 using pid_t = DWORD;
57 #endif
58 pid_t GetTID();
59
60 }  // namespace base_internal
61 }  // namespace absl
62
63 #endif  // ABSL_BASE_INTERNAL_SYSINFO_H_