Chromium Code Reviews| Index: third_party/tcmalloc/chromium/src/heap-profiler.cc |
| diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc |
| index 9647c9b6a794a9dc83ee4906da4096d21fa4aafc..0c5386903b301867a8d7f9c688b04dc014019232 100644 |
| --- a/third_party/tcmalloc/chromium/src/heap-profiler.cc |
| +++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc |
| @@ -81,6 +81,30 @@ |
| #endif |
| #endif |
| +#if defined(__ANDROID__) || defined(ANDROID) |
|
bulach
2013/05/01 17:55:30
nit: perhaps add a short explanation here?
// On
Dai Mikurube (NOT FULLTIME)
2013/05/02 16:26:40
Done.
|
| +#define HEAPPROFILE "heapprof" |
| +#define HEAP_PROFILE_ALLOCATION_INTERVAL "heapprof.allocation_interval" |
| +#define HEAP_PROFILE_DEALLOCATION_INTERVAL "heapprof.deallocation_interval" |
| +#define HEAP_PROFILE_INUSE_INTERVAL "heapprof.inuse_interval" |
| +#define HEAP_PROFILE_TIME_INTERVAL "heapprof.time_interval" |
| +#define HEAP_PROFILE_MMAP_LOG "heapprof.mmap_log" |
| +#define HEAP_PROFILE_MMAP "heapprof.mmap" |
| +#define HEAP_PROFILE_ONLY_MMAP "heapprof.only_mmap" |
| +#define DEEP_HEAP_PROFILE "heapprof.deep_heap_profile" |
| +#define HEAP_PROFILE_TYPE_STATISTICS "heapprof.type_statistics" |
| +#else // defined(__ANDROID__) || defined(ANDROID) |
| +#define HEAPPROFILE "HEAPPROFILE" |
| +#define HEAP_PROFILE_ALLOCATION_INTERVAL "HEAP_PROFILE_ALLOCATION_INTERVAL" |
| +#define HEAP_PROFILE_DEALLOCATION_INTERVAL "HEAP_PROFILE_DEALLOCATION_INTERVAL" |
| +#define HEAP_PROFILE_INUSE_INTERVAL "HEAP_PROFILE_INUSE_INTERVAL" |
| +#define HEAP_PROFILE_TIME_INTERVAL "HEAP_PROFILE_TIME_INTERVAL" |
| +#define HEAP_PROFILE_MMAP_LOG "HEAP_PROFILE_MMAP_LOG" |
| +#define HEAP_PROFILE_MMAP "HEAP_PROFILE_MMAP" |
| +#define HEAP_PROFILE_ONLY_MMAP "HEAP_PROFILE_ONLY_MMAP" |
| +#define DEEP_HEAP_PROFILE "DEEP_HEAP_PROFILE" |
| +#define HEAP_PROFILE_TYPE_STATISTICS "HEAP_PROFILE_TYPE_STATISTICS" |
| +#endif // defined(__ANDROID__) || defined(ANDROID) |
| + |
| using STL_NAMESPACE::string; |
| using STL_NAMESPACE::sort; |
| @@ -92,42 +116,42 @@ using STL_NAMESPACE::sort; |
| //---------------------------------------------------------------------- |
| DEFINE_int64(heap_profile_allocation_interval, |
| - EnvToInt64("HEAP_PROFILE_ALLOCATION_INTERVAL", 1 << 30 /*1GB*/), |
| + EnvToInt64(HEAP_PROFILE_ALLOCATION_INTERVAL, 1 << 30 /*1GB*/), |
| "If non-zero, dump heap profiling information once every " |
| "specified number of bytes allocated by the program since " |
| "the last dump."); |
| DEFINE_int64(heap_profile_deallocation_interval, |
| - EnvToInt64("HEAP_PROFILE_DEALLOCATION_INTERVAL", 0), |
| + EnvToInt64(HEAP_PROFILE_DEALLOCATION_INTERVAL, 0), |
| "If non-zero, dump heap profiling information once every " |
| "specified number of bytes deallocated by the program " |
| "since the last dump."); |
| // We could also add flags that report whenever inuse_bytes changes by |
| // X or -X, but there hasn't been a need for that yet, so we haven't. |
| DEFINE_int64(heap_profile_inuse_interval, |
| - EnvToInt64("HEAP_PROFILE_INUSE_INTERVAL", 100 << 20 /*100MB*/), |
| + EnvToInt64(HEAP_PROFILE_INUSE_INTERVAL, 100 << 20 /*100MB*/), |
| "If non-zero, dump heap profiling information whenever " |
| "the high-water memory usage mark increases by the specified " |
| "number of bytes."); |
| DEFINE_int64(heap_profile_time_interval, |
| - EnvToInt64("HEAP_PROFILE_TIME_INTERVAL", 0), |
| + EnvToInt64(HEAP_PROFILE_TIME_INTERVAL, 0), |
| "If non-zero, dump heap profiling information once every " |
| "specified number of seconds since the last dump."); |
| DEFINE_bool(mmap_log, |
| - EnvToBool("HEAP_PROFILE_MMAP_LOG", false), |
| + EnvToBool(HEAP_PROFILE_MMAP_LOG, false), |
| "Should mmap/munmap calls be logged?"); |
| DEFINE_bool(mmap_profile, |
| - EnvToBool("HEAP_PROFILE_MMAP", false), |
| + EnvToBool(HEAP_PROFILE_MMAP, false), |
| "If heap-profiling is on, also profile mmap, mremap, and sbrk)"); |
| DEFINE_bool(only_mmap_profile, |
| - EnvToBool("HEAP_PROFILE_ONLY_MMAP", false), |
| + EnvToBool(HEAP_PROFILE_ONLY_MMAP, false), |
| "If heap-profiling is on, only profile mmap, mremap, and sbrk; " |
| "do not profile malloc/new/etc"); |
| DEFINE_bool(deep_heap_profile, |
| - EnvToBool("DEEP_HEAP_PROFILE", false), |
| + EnvToBool(DEEP_HEAP_PROFILE, false), |
| "If heap-profiling is on, profile deeper (only on Linux)"); |
| #if defined(TYPE_PROFILING) |
| DEFINE_bool(heap_profile_type_statistics, |
| - EnvToBool("HEAP_PROFILE_TYPE_STATISTICS", false), |
| + EnvToBool(HEAP_PROFILE_TYPE_STATISTICS, false), |
| "If heap-profiling is on, dump type statistics."); |
| #endif // defined(TYPE_PROFILING) |
| @@ -642,13 +666,13 @@ extern "C" void HeapProfilerSetDeepHeapProfile(bool deep_heap_profile) { |
| static void HeapProfilerInit() { |
| // Everything after this point is for setting up the profiler based on envvar |
| char fname[PATH_MAX]; |
| - if (!GetUniquePathFromEnv("HEAPPROFILE", fname)) { |
| + if (!GetUniquePathFromEnv(HEAPPROFILE, fname)) { |
| return; |
| } |
| // We do a uid check so we don't write out files in a setuid executable. |
| #ifdef HAVE_GETEUID |
| if (getuid() != geteuid()) { |
| - RAW_LOG(WARNING, ("HeapProfiler: ignoring HEAPPROFILE because " |
| + RAW_LOG(WARNING, ("HeapProfiler: ignoring " HEAPPROFILE " because " |
| "program seems to be setuid\n")); |
| return; |
| } |