summaryrefslogtreecommitdiffstats
path: root/tools/deep_memory_profiler
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 21:31:51 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 21:31:51 +0000
commit6b838f0330c0ee569fda3b36f08c4669687f6960 (patch)
tree5312cd6b1cc4414bc0c35321d4ab99f4dc2b7543 /tools/deep_memory_profiler
parent619aaf7a1255cf6e060d96dc397622eb239d63cd (diff)
downloadchromium_src-6b838f0330c0ee569fda3b36f08c4669687f6960.zip
chromium_src-6b838f0330c0ee569fda3b36f08c4669687f6960.tar.gz
chromium_src-6b838f0330c0ee569fda3b36f08c4669687f6960.tar.bz2
Use pprof in the same directory if exists, and add a downloading script.
It's to use deep_memory_profiler without checking out the entire Chromium tree. BUG=123750 TEST=run download.sh and dmprof. Review URL: https://chromiumcodereview.appspot.com/10534146 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/deep_memory_profiler')
-rwxr-xr-xtools/deep_memory_profiler/dmprof25
-rwxr-xr-xtools/deep_memory_profiler/download.sh12
2 files changed, 29 insertions, 8 deletions
diff --git a/tools/deep_memory_profiler/dmprof b/tools/deep_memory_profiler/dmprof
index a2f6919..b61248d 100755
--- a/tools/deep_memory_profiler/dmprof
+++ b/tools/deep_memory_profiler/dmprof
@@ -19,14 +19,23 @@ COMMITTED = 1
ALLOC_COUNT = 2
FREE_COUNT = 3
NULL_REGEX = re.compile('')
-PPROF_PATH = os.path.join(os.path.dirname(__file__),
- os.pardir,
- os.pardir,
- 'third_party',
- 'tcmalloc',
- 'chromium',
- 'src',
- 'pprof')
+
+# If an executable pprof script is in the directory of deep_memory_profiler,
+# use it. Otherwise, use tcmalloc's pprof.
+#
+# A pprof script in deep_memory_profiler/ is prioritized to allow packaging
+# deep_memory_profiler files with a pprof script. The packaged
+# deep_memory_profiler is downloaded with pprof by using download.sh.
+PPROF_PATH = os.path.join(os.path.dirname(__file__), 'pprof')
+if not (os.path.isfile(PPROF_PATH) and os.access(PPROF_PATH, os.X_OK)):
+ PPROF_PATH = os.path.join(os.path.dirname(__file__),
+ os.pardir,
+ os.pardir,
+ 'third_party',
+ 'tcmalloc',
+ 'chromium',
+ 'src',
+ 'pprof')
# Heap Profile Dump versions
diff --git a/tools/deep_memory_profiler/download.sh b/tools/deep_memory_profiler/download.sh
new file mode 100755
index 0000000..312ca1f
--- /dev/null
+++ b/tools/deep_memory_profiler/download.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+svn checkout --force \
+ http://src.chromium.org/chrome/trunk/src/tools/deep_memory_profiler \
+ deep_memory_profiler
+
+curl -o deep_memory_profiler/pprof \
+ http://src.chromium.org/chrome/trunk/src/third_party/tcmalloc/chromium/src/pprof
+
+chmod a+x deep_memory_profiler/pprof