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

Unified Diff: build/common.gypi

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflected comments #21,22 Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 3f64fa96e10e8cb83e6fac866efed49dcd81935c..5a427a090a0d820264784c3ca0311c7cf051bded 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -253,6 +253,13 @@
# See http://clang.llvm.org/docs/ThreadSanitizer.html
'tsan%': 0,
+ # Use a modified version of Clang to intercept allocated types and sizes
+ # for allocated objects. -fintercept-allocated-type only works with the
+ # modified clang, but clang_profiling_allocated_type=1 implies clang=1.
Ryan Sleevi 2012/08/10 04:16:09 I'd remove the entire second sentence - it does no
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Removed "-fintercept-allocated-type only works wit
+ # TODO(dmikurube): Add a link to a description page.
+ # TODO(dmikurube): Support mac with another AllocatedTypeMap store.
Ryan Sleevi 2012/08/10 04:16:09 TODOs like this without an http://crbug.com/ link
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Added a link to description page, and crbug.com.
+ 'clang_profiling_allocated_type%': 0,
+
# Set to true to instrument the code with function call logger.
# See src/third_party/cygprofile/cyg-profile.cc for details.
'order_profiling%': 0,
@@ -588,6 +595,7 @@
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
'asan%': '<(asan)',
'tsan%': '<(tsan)',
+ 'clang_profiling_allocated_type%': '<(clang_profiling_allocated_type)',
'order_profiling%': '<(order_profiling)',
'order_text_section%': '<(order_text_section)',
'enable_extensions%': '<(enable_extensions)',
@@ -1188,6 +1196,12 @@
'clang%': 1,
}],
+ ['clang_profiling_allocated_type==1', {
Ryan Sleevi 2012/08/10 04:16:09 nit: Since you don't support all Clang-supporting
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Done.
+ 'clang%': 1,
+ 'clang_use_chrome_plugins%': 0,
+ 'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
+ }],
+
# On valgrind bots, override the optimizer settings so we don't inline too
# much and make the stacks harder to figure out.
#
@@ -1593,6 +1607,31 @@
}],
], # conditions for 'target_defaults'
'target_conditions': [
+ ['_type=="executable" or _type=="loadable_module"', {
+ 'target_conditions': [
+ # Some binaries doesn't use tcmalloc. We use empty interceptors
+ # for these binaries since the allocated type mapping is recorded
+ # in a tcmalloc-dependent data structure.
+ ['_target_name=="mksnapshot" or _target_name=="protoc" or _target_name=="ppGoogleNaClPluginChrome"', {
Ryan Sleevi 2012/08/10 04:16:09 This is a nasty layering violation that we try ver
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Thank you for the information. Yes, I knew it is
Ryan Sleevi 2012/08/10 09:38:50 I'm sorry, I'm having trouble understanding your r
Dai Mikurube (NOT FULLTIME) 2012/08/13 08:32:14 I looks requiring all things done in compiling-pha
+ # Ignore allocated types.
+ 'conditions': [
+ ['clang_profiling_allocated_type==1', {
+ 'dependencies': [
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_profiler_ignore#target',
Ryan Sleevi 2012/08/10 04:16:09 1) The use of realpath here is troubling. It defin
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 realpath got required from http://crrev.com/146172
Ryan Sleevi 2012/08/10 09:38:50 Oh, right, that's because GYP dependency resolutio
Dai Mikurube (NOT FULLTIME) 2012/08/13 08:32:14 For the reason written in the "top" summary, I hav
+ ]},
+ ],
+ ]}, {
+ # Store allocated types in TCMalloc's allocated_type_map (extended).
+ 'conditions': [
+ ['clang_profiling_allocated_type==1', {
Ryan Sleevi 2012/08/10 09:38:50 BUG? This double nested condition seems wrong. Sho
Dai Mikurube (NOT FULLTIME) 2012/08/10 15:51:43 That's the point I wanted to discuss. tcmalloc is
+ 'dependencies': [
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_profiler_tcmalloc#target',
+ ]},
+ ],
+ ]},
+ ]
+ ]},
+ ],
['enable_wexit_time_destructors==1', {
'conditions': [
[ 'clang==1', {
@@ -2339,6 +2378,22 @@
'-fcolor-diagnostics',
],
}],
+ ['clang_profiling_allocated_type==1', {
+ 'cflags_cc!': ['-fno-rtti'],
+ 'cflags_cc+': ['-gline-tables-only'],
+ 'target_conditions': [
+ ['_target_name!="allocator" and _target_name!="allocator_extension_thunks" and _target_name!="libcmt" and _target_name!="allocator_extension_thunks_win64" and _target_name!="allocated_type_profiler_log" and _target_name!="allocated_type_profiler_ignore" and _target_name!="allocated_type_profiler_tcmalloc"', {
Ryan Sleevi 2012/08/10 04:16:09 See comments above about layering violation. These
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 I agree with that, but I have no idea to refactor
Ryan Sleevi 2012/08/10 09:38:50 In those specific targets that you wish to exclude
Dai Mikurube (NOT FULLTIME) 2012/08/13 08:32:14 I tried it for the compiler flags, and it looks wo
+ 'cflags_cc+': [
Ryan Sleevi 2012/08/10 04:16:09 style nit: The indents here should all be GYP inde
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Done.
+ '-frtti',
+ '-fintercept-allocation-functions',
+ '-I../../base/allocator',
Ryan Sleevi 2012/08/10 04:16:09 BUG: You should not be specifying relative paths v
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Trying below.
+ '-include',
+ 'allocated_type_profiler.h',
Ryan Sleevi 2012/08/10 04:16:09 However, more generally, ISTM that instead of forc
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 It was impossible maybe because it is lazily evalu
Ryan Sleevi 2012/08/10 09:38:50 Oh, that's probably just due to GYP order-of-evalu
Dai Mikurube (NOT FULLTIME) 2012/08/13 08:32:14 It doesn't work, too. KeyError: 'Undefined variabl
+ ],
+ }],
+ ],
+ 'defines': ['PROFILING_ALLOCATED_TYPE'],
+ }],
['asan==1', {
'target_conditions': [
['_toolset=="target"', {
Ryan Sleevi 2012/08/10 04:16:09 note: Like ASAN, ISTM like you may need to gate on
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Ah... sorry, I have no idea about "_toolset". Do

Powered by Google App Engine
This is Rietveld 408576698