Skip to content
Snippets Groups Projects
Commit efbbc4e9 authored by ericroman@google.com's avatar ericroman@google.com
Browse files

Add some information for memwatcher n00bs -- would also be good to be able to point to a wiki page.

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@623 0039d316-1c4b-4281-b951-d872f2087c98
parent 145d5c9f
No related branches found
No related tags found
No related merge requests found
memory_watcher is a library that can be linked into chromium to trace the
memory allocations. It works by hooking the system allocation/deallocation
functions, and recording the actions.
To use memory_watcher in chromium:
(1) Compile the memory_watcher library (it is part of the solution by default)
(2) Run chromium with these flags "--memory-profile -no-sandbox"
(The instrumentation doesn't work with the sandbox)
(3) Hit ctrl-alt-D to generate a dump of the memory allocations.
This will create a log file called memorywatcher.logXXXX for every
chromium process (where XXXX is the pid).
The log file is a human readable text format, which can be further analyzed
using the helpers in the "scripts/" directory.
#!/usr/bin/perl
#
# Given a memwatcher logfile, group memory allocations by callstack.
#
# Usage:
#
# memprof.pl <logfile>
#
# logfile -- The memwatcher.logXXXX file to summarize.
#
#
#
# Sample output:
#
# 54061617 100.00% AllocationStack::AllocationStack
# 41975368 77.64% malloc
# 11886592 21.99% VirtualAlloc
# 7168000 13.26% v8::internal::OS::Allocate
# 7168000 13.26% v8::internal::MemoryAllocator::AllocateRawMemory
# 5976184 11.05% WebCore::V8Bridge::evaluate
# 5767168 10.67% v8::internal::MemoryAllocator::AllocatePages
# 5451776 10.08% WebCore::V8Proxy::initContextIfNeeded
# ....
#
#
#
# ********
# Note: The output is not currently sorted. To make it more legible,
# you will want to sort numerically by the first field:
# $ ./memprof.pl memwatcher.log3620.txt | sort -n -r
# ********
#
sub process_raw($$) {
my $file = shift;
my $filter = shift;
......
#!/usr/bin/perl
#
# Blame callstacks for each memory allocation.
# Similar to memprof.pl, will also try to filter out unuseful stacks.
# TODO: better describe how these tools differ.
#
# Usage:
#
# memtrace.pl <logfile>
#
# logfile -- The memwatcher.logXXXX file to summarize.
#
#
#
# Sample output:
#
# 41975368 77.64% f:\sp\vctools\crt_bld\self_x86\crt\src\malloc.c (163): malloc
# 2097152 3.88% c:\src\chrome1\src\webkit\pending\frameloader.cpp (3300): WebCore::FrameLoader::committedLoad
# 1572864 2.91% c:\src\chrome1\src\webkit\port\bridge\v8bridge.cpp (214): WebCore::V8Bridge::evaluate
# 1572864 2.91% c:\src\chrome1\src\webkit\glue\webframeloaderclient_impl.cc (1071): WebFrameLoaderClient::committedLoad
# 1572864 2.91% c:\src\chrome1\src\v8\src\ast.h (1181): v8::internal::Visitor::Visit
#
#
#
# ********
# Note: The output is not currently sorted. To make it more legible,
# you will want to sort numerically by the first field:
# $ ./memtrace.pl memwatcher.log3620.txt | sort -n -r
# ********
#
sub process_raw($) {
my $file = shift;
......
#!/usr/bin/perl
#
# Summarizes output from memtrace using a set of heuristics
# Read a memtrace logfile from stdin and group memory allocations by logical
# code component. The code component is guessed from the callstack, and
# is something like {v8, sqlite, disk cache, skia, etc..}
#
# Usage:
#
# summary.pl
#
# [STDIN] -- The memwatcher.logXXXX file to summarize.
#
sub process_stdin() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment