From 6b838f0330c0ee569fda3b36f08c4669687f6960 Mon Sep 17 00:00:00 2001 From: "dmikurube@chromium.org" Date: Fri, 15 Jun 2012 21:31:51 +0000 Subject: 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 --- tools/deep_memory_profiler/dmprof | 25 +++++++++++++++++-------- tools/deep_memory_profiler/download.sh | 12 ++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100755 tools/deep_memory_profiler/download.sh (limited to 'tools') 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 -- cgit v1.1