OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OS_H_ | 5 #ifndef VM_OS_H_ |
6 #define VM_OS_H_ | 6 #define VM_OS_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 | 9 |
10 // Forward declarations. | 10 // Forward declarations. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Returns the current time used by the tracing infrastructure. | 50 // Returns the current time used by the tracing infrastructure. |
51 static int64_t GetCurrentMonotonicMicros(); | 51 static int64_t GetCurrentMonotonicMicros(); |
52 | 52 |
53 // Returns the raw clock value from the monotonic clock. | 53 // Returns the raw clock value from the monotonic clock. |
54 static int64_t GetCurrentMonotonicTicks(); | 54 static int64_t GetCurrentMonotonicTicks(); |
55 | 55 |
56 // Returns the frequency of the monotonic clock. | 56 // Returns the frequency of the monotonic clock. |
57 static int64_t GetCurrentMonotonicFrequency(); | 57 static int64_t GetCurrentMonotonicFrequency(); |
58 | 58 |
| 59 // Returns the value of current thread's CPU usage clock in microseconds. |
| 60 // NOTE: This clock will return different values depending on the calling |
| 61 // thread. It is only expected to increase in value as the thread uses |
| 62 // CPU time. |
| 63 // NOTE: This function will return -1 on OSs that are not supported. |
| 64 static int64_t GetCurrentThreadCPUMicros(); |
| 65 |
59 // Returns a cleared aligned array of type T with n entries. | 66 // Returns a cleared aligned array of type T with n entries. |
60 // Alignment must be >= 16 and a power of two. | 67 // Alignment must be >= 16 and a power of two. |
61 template<typename T> | 68 template<typename T> |
62 static T* AllocateAlignedArray(intptr_t n, intptr_t alignment) { | 69 static T* AllocateAlignedArray(intptr_t n, intptr_t alignment) { |
63 T* result = reinterpret_cast<T*>(OS::AlignedAllocate(n * sizeof(*result), | 70 T* result = reinterpret_cast<T*>(OS::AlignedAllocate(n * sizeof(*result), |
64 alignment)); | 71 alignment)); |
65 memset(result, 0, n * sizeof(*result)); | 72 memset(result, 0, n * sizeof(*result)); |
66 return result; | 73 return result; |
67 } | 74 } |
68 | 75 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 static void Shutdown(); | 162 static void Shutdown(); |
156 | 163 |
157 static void Abort(); | 164 static void Abort(); |
158 | 165 |
159 static void Exit(int code); | 166 static void Exit(int code); |
160 }; | 167 }; |
161 | 168 |
162 } // namespace dart | 169 } // namespace dart |
163 | 170 |
164 #endif // VM_OS_H_ | 171 #endif // VM_OS_H_ |
OLD | NEW |