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

Issue 6070009: Added labelled thread names to help with some debugging activity. Right now,... (Closed)

Created:
10 years ago by marklam
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Added labelled thread names to help with some debugging activity. Right now, the only platform that it works on is linux (using the prctl API to set the names of the threads). Other platforms are setup to build properly if the flag is set, but their thread names are not currently set. Committed: http://code.google.com/p/v8/source/detail?r=6141

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 12

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -10 lines) Patch
M src/cpu-profiler.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M src/d8.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M src/d8-debug.h View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
M src/debug.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M src/debug-agent.h View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
M src/log.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M src/platform.h View 1 2 3 3 chunks +13 lines, -0 lines 0 comments Download
M src/platform-freebsd.cc View 1 2 3 2 chunks +12 lines, -0 lines 0 comments Download
M src/platform-linux.cc View 1 2 3 3 chunks +13 lines, -0 lines 0 comments Download
M src/platform-macos.cc View 1 2 3 2 chunks +32 lines, -0 lines 0 comments Download
M src/platform-nullos.cc View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M src/platform-openbsd.cc View 1 2 3 2 chunks +12 lines, -0 lines 0 comments Download
M src/platform-solaris.cc View 1 2 3 2 chunks +12 lines, -0 lines 0 comments Download
M src/platform-win32.cc View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M src/top.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M src/v8threads.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
marklam
Søren, I'm not sure you're the right person for this review. If not, can you ...
10 years ago (2010-12-22 20:06:19 UTC) #1
Søren Thygesen Gjesse
http://codereview.chromium.org/6070009/diff/33001/SConstruct File SConstruct (right): http://codereview.chromium.org/6070009/diff/33001/SConstruct#newcode129 SConstruct:129: 'CPPDEFINES': ['DEBUG_THREAD_NAMES'], Why do you want to enable/disable this ...
9 years, 11 months ago (2011-01-03 07:48:34 UTC) #2
marklam
FYI, the changes for SConstruct is now removed because we're no longer doing a conditional ...
9 years, 11 months ago (2011-01-04 01:47:09 UTC) #3
Søren Thygesen Gjesse
On 2011/01/04 01:47:09, marklam wrote: > FYI, the changes for SConstruct is now removed because ...
9 years, 11 months ago (2011-01-04 08:43:49 UTC) #4
Søren Thygesen Gjesse
9 years, 11 months ago (2011-01-04 09:15:10 UTC) #5
On 2011/01/04 08:43:49, Søren Gjesse wrote:
> On 2011/01/04 01:47:09, marklam wrote:
> > FYI, the changes for SConstruct is now removed because we're no longer doing
a
> > conditional flag to set DEBUG_THREAD_NAME.
> > 
> > http://codereview.chromium.org/6070009/diff/33001/SConstruct
> > File SConstruct (right):
> > 
> > http://codereview.chromium.org/6070009/diff/33001/SConstruct#newcode129
> > SConstruct:129: 'CPPDEFINES':   ['DEBUG_THREAD_NAMES'],
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > Why do you want to enable/disable this using conditional compilation? It
> does
> > > not seem to add any overhead except for the 16 char name for each thread.
If
> > > there are other penalties then I suggest that a flag --threadnames is
added
> to
> > > skip the OS call to actually set the name for the thread.
> > 
> > I didn't know how strict we want to be about not incurring any cost that may
> not
> > yield any benefits for the various platforms.  I agree that the cost here is
> > minimal, and I'm fine with removing the conditional nature of it.  I'll make
> the
> > appropriate change for making this unconditional.  Thanks.
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform-freebsd.cc
> > File src/platform-freebsd.cc (right):
> > 
> >
>
http://codereview.chromium.org/6070009/diff/33001/src/platform-freebsd.cc#new...
> > src/platform-freebsd.cc:446: name_[sizeof(name_)-1] = '\0';
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > Please add spaces on both sides of '-'. In all the other platform files as
> > well.
> > 
> > Done.
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform-macos.cc
> > File src/platform-macos.cc (right):
> > 
> >
>
http://codereview.chromium.org/6070009/diff/33001/src/platform-macos.cc#newco...
> > src/platform-macos.cc:435: // one) so we initialize it here too.
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > Is this not supported on MacOS somehow?
> > 
> > There is a pthread_setname_np() but it is not supported before macos 10.6. 
> I've
> > adapted an implementation from the chromium sources here:
> >
>
http://src.chromium.org/viewvc/chrome/trunk/src/base/platform_thread_mac.mm?r...
> > 
> > Is this acceptable?
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform.h
> > File src/platform.h (right):
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform.h#newcode402
> > src/platform.h:402: inline const char* Name() const {
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > Please use all lower-case for this type of accessor, see
> > >
> >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Functi...
> > 
> > Done.
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform.h#newcode430
> > src/platform.h:430: void SetName(const char *name);
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > This setter should be called set_name, see
> > >
> >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Functi...
> > 
> > Done.
> > 
> > http://codereview.chromium.org/6070009/diff/33001/src/platform.h#newcode436
> > src/platform.h:436: char name_[16];
> > On 2011/01/03 07:48:34, Søren Gjesse wrote:
> > > I think that this constant deserves a comment. E.g. "The thread name
length
> > > limit on Linux is 16.". Actually you should also make a constant for it
> > > 
> > > static const int kMaxThreadNamelength = 16;
> > 
> > Done.
> 
> LGTM, however I had to add
> 
>   #include <sys/prctl.h>
> 
> to make it compile on Ubuntu. I also removed the :: in front of prctl.

Committed: http://code.google.com/p/v8/source/detail?r=6141

Thank you for the patch.

Powered by Google App Engine
This is Rietveld 408576698