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

Issue 11438022: Add ability to retrieve a thread_name given a thread_id. (Closed)

Created:
8 years ago by dsinclair
Modified:
7 years, 11 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Add ability to retrieve a thread_name given a thread_id. The work to add GPU tracing needs the ability to map from a thread_id back to a thread_name in order to allow us to have the correct display on the chrome://tracing page. We want to be able to output our traces without having to post to a thread to handle the output, and to have the GPU traces differentiated from the GPU-process which will be doing the tracing calls. BUG=111509 TEST=Added tests in base_unittests Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=178886

Patch Set 1 #

Patch Set 2 : Move the set to PlatformThread::SetName so we catch any name changes. #

Total comments: 4

Patch Set 3 : Switch to LeakySingletonTraits; drop bad test #

Patch Set 4 : Change to const char* from std::string #

Total comments: 12

Patch Set 5 : Remove thread locals in favour of using ThreadIdNameManager. #

Patch Set 6 : Strdup the thread names #

Patch Set 7 : Store a version number for the current name for fast comparisons. #

Total comments: 10

Patch Set 8 : #

Patch Set 9 : Review cleanups. #

Total comments: 6

Patch Set 10 : Review cleanups. #

Total comments: 1

Patch Set 11 : Use base::strdup; Fixup some initial thread names in tests #

Patch Set 12 : Graceful handling of missing id's. Fixes up issues with tests. #

Patch Set 13 : Use an interned name instead of name version. #

Total comments: 6

Patch Set 14 : ThreadLocal for the current interned string value. #

Total comments: 30

Patch Set 15 : API and various other cleanups based on review feedback. #

Total comments: 12

Patch Set 16 : Fixup to leaky properly. #

Total comments: 6

Patch Set 17 : Review cleanups. #

Patch Set 18 : Make some of the try servers happier. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+246 lines, -42 lines) Patch
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -1 line 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M base/debug/trace_event_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +3 lines, -1 line 0 comments Download
M base/debug/trace_event_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -3 lines 0 comments Download
M base/threading/platform_thread_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +2 lines, -14 lines 0 comments Download
M base/threading/platform_thread_posix.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +4 lines, -18 lines 0 comments Download
M base/threading/platform_thread_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +3 lines, -5 lines 0 comments Download
M base/threading/thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -0 lines 0 comments Download
A base/threading/thread_id_name_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +52 lines, -0 lines 0 comments Download
A base/threading/thread_id_name_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +79 lines, -0 lines 0 comments Download
A base/threading/thread_id_name_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +91 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
dsinclair
8 years ago (2012-12-05 18:15:45 UTC) #1
jonathan.backer
https://codereview.chromium.org/11438022/diff/3001/base/threading/thread_id_name_manager.h File base/threading/thread_id_name_manager.h (right): https://codereview.chromium.org/11438022/diff/3001/base/threading/thread_id_name_manager.h#newcode16 base/threading/thread_id_name_manager.h:16: template <typename T> struct DefaultSingletonTraits; Different traits define kAllowedToAccessOnNonjoinableThread ...
8 years ago (2012-12-05 20:06:12 UTC) #2
dsinclair
https://codereview.chromium.org/11438022/diff/3001/base/threading/thread_id_name_manager.h File base/threading/thread_id_name_manager.h (right): https://codereview.chromium.org/11438022/diff/3001/base/threading/thread_id_name_manager.h#newcode16 base/threading/thread_id_name_manager.h:16: template <typename T> struct DefaultSingletonTraits; On 2012/12/05 20:06:12, jonathan.backer ...
8 years ago (2012-12-05 20:40:09 UTC) #3
dsinclair
jar@ can you please review these changes in base/. They are needed to support https://codereview.chromium.org/11366109/ ...
8 years ago (2012-12-06 16:08:33 UTC) #4
jonathan.backer
https://codereview.chromium.org/11438022/diff/13001/base/base.gyp File base/base.gyp (right): https://codereview.chromium.org/11438022/diff/13001/base/base.gyp#newcode545 base/base.gyp:545: 'threading/thread_id_name_manager_unittest.cc', nit: sorted order? https://codereview.chromium.org/11438022/diff/13001/base/base.gypi File base/base.gypi (right): https://codereview.chromium.org/11438022/diff/13001/base/base.gypi#newcode445 ...
8 years ago (2012-12-06 16:29:08 UTC) #5
dsinclair
https://codereview.chromium.org/11438022/diff/13001/base/base.gyp File base/base.gyp (right): https://codereview.chromium.org/11438022/diff/13001/base/base.gyp#newcode545 base/base.gyp:545: 'threading/thread_id_name_manager_unittest.cc', On 2012/12/06 16:29:08, jonathan.backer wrote: > nit: sorted ...
8 years ago (2012-12-06 17:55:05 UTC) #6
jar (doing other things)
I had a couple of concerns that I'd like to hear comments on: a) Why ...
8 years ago (2012-12-06 20:54:37 UTC) #7
dsinclair
PTAL. I've updated to strdup the names into the manager. I don't see anything that ...
8 years ago (2012-12-10 16:24:36 UTC) #8
dsinclair
I've added increasing version numbers to go along with the thread names. The reason for ...
8 years ago (2012-12-13 17:43:42 UTC) #9
jar (doing other things)
https://codereview.chromium.org/11438022/diff/33001/base/base.gyp File base/base.gyp (right): https://codereview.chromium.org/11438022/diff/33001/base/base.gyp#newcode327 base/base.gyp:327: 'prefs/pref_observer.h', nit: alphabetize https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc#newcode67 base/debug/trace_event_impl.cc:67: ...
8 years ago (2012-12-14 18:23:07 UTC) #10
dsinclair
https://codereview.chromium.org/11438022/diff/33001/base/base.gyp File base/base.gyp (right): https://codereview.chromium.org/11438022/diff/33001/base/base.gyp#newcode327 base/base.gyp:327: 'prefs/pref_observer.h', On 2012/12/14 18:23:07, jar wrote: > nit: alphabetize ...
8 years ago (2012-12-14 19:13:46 UTC) #11
jar (doing other things)
https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc File base/threading/thread_id_name_manager.cc (right): https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc#newcode30 base/threading/thread_id_name_manager.cc:30: return id_to_name_[id]; Sorry for my seemingly confusing mention of ...
8 years ago (2012-12-14 19:58:08 UTC) #12
dsinclair
https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc File base/threading/thread_id_name_manager.cc (right): https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc#newcode30 base/threading/thread_id_name_manager.cc:30: return id_to_name_[id]; On 2012/12/14 19:58:08, jar wrote: > I ...
8 years ago (2012-12-14 20:18:19 UTC) #13
dsinclair
ping. On 2012/12/14 20:18:19, dsinclair wrote: > https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc > File base/threading/thread_id_name_manager.cc (right): > > https://codereview.chromium.org/11438022/diff/33001/base/threading/thread_id_name_manager.cc#newcode30 ...
8 years ago (2012-12-20 20:00:42 UTC) #14
jar (doing other things)
https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc#newcode67 base/debug/trace_event_impl.cc:67: // The most-recently captured name version of the current ...
8 years ago (2012-12-21 00:16:59 UTC) #15
dsinclair
@jar PTAL. https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/33001/base/debug/trace_event_impl.cc#newcode67 base/debug/trace_event_impl.cc:67: // The most-recently captured name version of ...
8 years ago (2012-12-21 16:28:59 UTC) #16
jar (doing other things)
+cc nduca for a clearer use case. https://codereview.chromium.org/11438022/diff/55001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/55001/base/debug/trace_event_impl.cc#newcode71 base/debug/trace_event_impl.cc:71: // as ...
7 years, 12 months ago (2012-12-26 22:41:11 UTC) #17
dsinclair
On 2012/12/26 22:41:11, jar wrote: > +cc nduca for a clearer use case. > > ...
7 years, 11 months ago (2013-01-02 15:45:02 UTC) #18
dsinclair
Nat, any comments that can help clear up the confusion here? Thanks, dan
7 years, 11 months ago (2013-01-03 21:57:06 UTC) #19
nduca
How about making some helper functions in thread.cc inside an anon namespace a la: typedef ...
7 years, 11 months ago (2013-01-04 22:30:38 UTC) #20
dsinclair
On 2013/01/04 22:30:38, nduca wrote: > How about making some helper functions in thread.cc inside ...
7 years, 11 months ago (2013-01-07 16:22:27 UTC) #21
dsinclair
On 2013/01/07 16:22:27, dsinclair wrote: > On 2013/01/04 22:30:38, nduca wrote: > > How about ...
7 years, 11 months ago (2013-01-09 21:08:37 UTC) #22
jar (doing other things)
I just started to look at the CL.... but could need a better understanding before ...
7 years, 11 months ago (2013-01-14 19:27:57 UTC) #23
dsinclair
https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc#newcode71 base/debug/trace_event_impl.cc:71: base::InternedString g_current_thread_interned_name = On 2013/01/14 19:27:57, jar wrote: > ...
7 years, 11 months ago (2013-01-14 22:26:09 UTC) #24
jar (doing other things)
https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc#newcode647 base/debug/trace_event_impl.cc:647: if (interned_name != g_current_thread_interned_name) { Shouldn't there be a ...
7 years, 11 months ago (2013-01-17 23:18:38 UTC) #25
dsinclair
https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/11438022/diff/81001/base/debug/trace_event_impl.cc#newcode647 base/debug/trace_event_impl.cc:647: if (interned_name != g_current_thread_interned_name) { I'm not exactly sure ...
7 years, 11 months ago (2013-01-21 19:14:18 UTC) #26
jar (doing other things)
https://codereview.chromium.org/11438022/diff/101001/base/threading/thread.cc File base/threading/thread.cc (right): https://codereview.chromium.org/11438022/diff/101001/base/threading/thread.cc#newcode69 base/threading/thread.cc:69: ThreadIdNameManager::GetInstance()->RemoveNameForId(thread_id_); I would have expected that you'd leak this. ...
7 years, 11 months ago (2013-01-24 01:05:14 UTC) #27
dsinclair
https://codereview.chromium.org/11438022/diff/101001/base/threading/thread.cc File base/threading/thread.cc (right): https://codereview.chromium.org/11438022/diff/101001/base/threading/thread.cc#newcode69 base/threading/thread.cc:69: ThreadIdNameManager::GetInstance()->RemoveNameForId(thread_id_); The RemoveNameForId will remove the thread_id -> name ...
7 years, 11 months ago (2013-01-24 15:13:05 UTC) #28
jar (doing other things)
Two nits... and one optional nit... and then LGTM. https://codereview.chromium.org/11438022/diff/106002/base/threading/thread_id_name_manager.cc File base/threading/thread_id_name_manager.cc (right): https://codereview.chromium.org/11438022/diff/106002/base/threading/thread_id_name_manager.cc#newcode27 base/threading/thread_id_name_manager.cc:27: ...
7 years, 11 months ago (2013-01-25 03:13:25 UTC) #29
dsinclair
https://codereview.chromium.org/11438022/diff/106002/base/threading/thread_id_name_manager.cc File base/threading/thread_id_name_manager.cc (right): https://codereview.chromium.org/11438022/diff/106002/base/threading/thread_id_name_manager.cc#newcode27 base/threading/thread_id_name_manager.cc:27: g_default_name = new std::string(kDefaultName); On 2013/01/25 03:13:25, jar wrote: ...
7 years, 11 months ago (2013-01-25 14:54:43 UTC) #30
jar (doing other things)
lgtm
7 years, 11 months ago (2013-01-25 17:07:45 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dsinclair@chromium.org/11438022/110006
7 years, 11 months ago (2013-01-25 17:12:39 UTC) #32
commit-bot: I haz the power
7 years, 11 months ago (2013-01-25 20:41:20 UTC) #33
Message was sent while issue was closed.
Change committed as 178886

Powered by Google App Engine
This is Rietveld 408576698