summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authortoyoshim <toyoshim@chromium.org>2015-07-24 12:04:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-24 19:05:18 +0000
commitc3609d0d3167350796ba2685c6444cacd18065a2 (patch)
tree904b4f915716842a326fd7701d7d2738e8c91917 /base
parent188c2601a42eac8d08b607b3e0ee8ea3f7e66cfe (diff)
downloadchromium_src-c3609d0d3167350796ba2685c6444cacd18065a2.zip
chromium_src-c3609d0d3167350796ba2685c6444cacd18065a2.tar.gz
chromium_src-c3609d0d3167350796ba2685c6444cacd18065a2.tar.bz2
base/threading: measure event wait times
Before submitting a patch to make thread creations not to wait until the newly created thread has started, measure event wait times on the thread startup durations. BUG=495097 Review URL: https://codereview.chromium.org/1259603002 Cr-Commit-Position: refs/heads/master@{#340303}
Diffstat (limited to 'base')
-rw-r--r--base/threading/platform_thread_posix.cc8
-rw-r--r--base/threading/thread.cc5
2 files changed, 12 insertions, 1 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 44b691c..8e3f365 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -13,6 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/profiler/scoped_tracker.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread_internal_posix.h"
#include "base/threading/thread_id_name_manager.h"
@@ -126,8 +127,13 @@ bool CreateThread(size_t stack_size, bool joinable,
// Don't let this call complete until the thread id
// is set in the handle.
- if (success)
+ if (success) {
+ // TODO(toyoshim): Remove this after a few days (crbug.com/495097)
+ tracked_objects::ScopedTracker tracking_profile(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "495097 pthread_create and handle_set.Wait"));
params.handle_set.Wait();
+ }
CHECK_EQ(handle, thread_handle->platform_handle());
return success;
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 900b1a5..f7d938c 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/location.h"
+#include "base/profiler/scoped_tracker.h"
#include "base/synchronization/waitable_event.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_id_name_manager.h"
@@ -179,6 +180,10 @@ void Thread::StopSoon() {
PlatformThreadId Thread::GetThreadId() const {
// If the thread is created but not started yet, wait for |id_| being ready.
base::ThreadRestrictions::ScopedAllowWait allow_wait;
+ // TODO(toyoshim): Remove this after a few days (crbug.com/495097)
+ tracked_objects::ScopedTracker tracking_profile(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "495097 base::Thread::GetThreadId"));
id_event_.Wait();
return id_;
}