Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
| 9 #include "bin/thread_fuchsia.h" | 9 #include "bin/thread_fuchsia.h" |
| 10 | 10 |
| 11 #include <errno.h> // NOLINT | 11 #include <errno.h> // NOLINT |
| 12 #include <sys/resource.h> // NOLINT | 12 #include <magenta/syscalls.h> // NOLINT |
| 13 #include <sys/time.h> // NOLINT | 13 #include <magenta/types.h> // NOLINT |
| 14 #include <sys/resource.h> // NOLINT | |
| 15 #include <sys/time.h> // NOLINT | |
| 14 | 16 |
| 15 #include "platform/assert.h" | 17 #include "platform/assert.h" |
| 16 #include "platform/utils.h" | 18 #include "platform/utils.h" |
| 17 | 19 |
| 18 namespace dart { | 20 namespace dart { |
| 19 namespace bin { | 21 namespace bin { |
| 20 | 22 |
| 21 #define VALIDATE_PTHREAD_RESULT(result) \ | 23 #define VALIDATE_PTHREAD_RESULT(result) \ |
| 22 if (result != 0) { \ | 24 if (result != 0) { \ |
| 23 const int kBufferSize = 1024; \ | 25 const int kBufferSize = 1024; \ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 ASSERT(sizeof(id) == sizeof(intptr_t)); | 160 ASSERT(sizeof(id) == sizeof(intptr_t)); |
| 159 return static_cast<intptr_t>(id); | 161 return static_cast<intptr_t>(id); |
| 160 } | 162 } |
| 161 | 163 |
| 162 | 164 |
| 163 bool Thread::Compare(ThreadId a, ThreadId b) { | 165 bool Thread::Compare(ThreadId a, ThreadId b) { |
| 164 return (pthread_equal(a, b) != 0); | 166 return (pthread_equal(a, b) != 0); |
| 165 } | 167 } |
| 166 | 168 |
| 167 | 169 |
| 168 void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { | 170 void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
|
rmacnak
2017/01/06 18:34:24
bin::Thread::GetThreadCpuUsage is unused. We shoul
zra
2017/01/07 22:45:17
Done.
| |
| 169 UNIMPLEMENTED(); | 171 ASSERT(thread_id == GetCurrentThreadId()); |
| 172 ASSERT(cpu_usage != NULL); | |
| 173 *cpu_usage = mx_time_get(MX_CLOCK_THREAD) / kNanosecondsPerMicrosecond; | |
| 170 } | 174 } |
| 171 | 175 |
| 172 | 176 |
| 173 void Thread::InitOnce() { | 177 void Thread::InitOnce() { |
| 174 // Nothing to be done. | 178 // Nothing to be done. |
| 175 } | 179 } |
| 176 | 180 |
| 177 | 181 |
| 178 Mutex::Mutex() { | 182 Mutex::Mutex() { |
| 179 pthread_mutexattr_t attr; | 183 pthread_mutexattr_t attr; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 void Monitor::NotifyAll() { | 324 void Monitor::NotifyAll() { |
| 321 // TODO(iposva): Do we need to track lock owners? | 325 // TODO(iposva): Do we need to track lock owners? |
| 322 int result = pthread_cond_broadcast(data_.cond()); | 326 int result = pthread_cond_broadcast(data_.cond()); |
| 323 VALIDATE_PTHREAD_RESULT(result); | 327 VALIDATE_PTHREAD_RESULT(result); |
| 324 } | 328 } |
| 325 | 329 |
| 326 } // namespace bin | 330 } // namespace bin |
| 327 } // namespace dart | 331 } // namespace dart |
| 328 | 332 |
| 329 #endif // defined(TARGET_OS_FUCHSIA) | 333 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |