Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: base/threading/platform_thread_posix.cc

Issue 1259603002: base/threading: measure event wait times (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/threading/thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <sched.h> 9 #include <sched.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
11 #include <sys/time.h> 11 #include <sys/time.h>
12 12
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/profiler/scoped_tracker.h"
16 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
17 #include "base/threading/platform_thread_internal_posix.h" 18 #include "base/threading/platform_thread_internal_posix.h"
18 #include "base/threading/thread_id_name_manager.h" 19 #include "base/threading/thread_id_name_manager.h"
19 #include "base/threading/thread_restrictions.h" 20 #include "base/threading/thread_restrictions.h"
20 #include "base/tracked_objects.h" 21 #include "base/tracked_objects.h"
21 22
22 #if defined(OS_LINUX) 23 #if defined(OS_LINUX)
23 #include <sys/syscall.h> 24 #include <sys/syscall.h>
24 #elif defined(OS_ANDROID) 25 #elif defined(OS_ANDROID)
25 #include <sys/types.h> 26 #include <sys/types.h>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Value of |handle| is undefined if pthread_create fails. 120 // Value of |handle| is undefined if pthread_create fails.
120 handle = 0; 121 handle = 0;
121 errno = err; 122 errno = err;
122 PLOG(ERROR) << "pthread_create"; 123 PLOG(ERROR) << "pthread_create";
123 } 124 }
124 125
125 pthread_attr_destroy(&attributes); 126 pthread_attr_destroy(&attributes);
126 127
127 // Don't let this call complete until the thread id 128 // Don't let this call complete until the thread id
128 // is set in the handle. 129 // is set in the handle.
129 if (success) 130 if (success) {
131 // TODO(toyoshim): Remove this after a few days (crbug.com/495097)
132 tracked_objects::ScopedTracker tracking_profile(
133 FROM_HERE_WITH_EXPLICIT_FUNCTION(
134 "495097 pthread_create and handle_set.Wait"));
130 params.handle_set.Wait(); 135 params.handle_set.Wait();
136 }
131 CHECK_EQ(handle, thread_handle->platform_handle()); 137 CHECK_EQ(handle, thread_handle->platform_handle());
132 138
133 return success; 139 return success;
134 } 140 }
135 141
136 } // namespace 142 } // namespace
137 143
138 // static 144 // static
139 PlatformThreadId PlatformThread::CurrentId() { 145 PlatformThreadId PlatformThread::CurrentId() {
140 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 146 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return ThreadPriority::NORMAL; 274 return ThreadPriority::NORMAL;
269 } 275 }
270 276
271 return internal::NiceValueToThreadPriority(nice_value); 277 return internal::NiceValueToThreadPriority(nice_value);
272 #endif // !defined(OS_NACL) 278 #endif // !defined(OS_NACL)
273 } 279 }
274 280
275 #endif // !defined(OS_MACOSX) 281 #endif // !defined(OS_MACOSX)
276 282
277 } // namespace base 283 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/threading/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698