My favorites | Sign in
Google
                
Search
for
Updated Jun 05, 2007 by csilvers
GooglePerformanceTools  
Home page for Google Performance Tools

Google Performance Tools

The fastest malloc we've seen; works particularly well with threads and STL. Also: thread-friendly heap-checker, heap-profiler, and cpu-profiler.

Overview

Perf Tools is a collection of a high-performance multi-threaded malloc() implementation, plus some pretty nifty performance analysis tools.

Perf Tools is distributed under the terms of the BSD License.

For downloads, news, and other information, visit our Project Page.

Example

Note: this is by no means complete documentation, but simply gives you an idea of what the API is like.

No recompilation is necessary to use these tools.

TC Malloc:

gcc [...] -ltcmalloc

Heap Checker:

gcc [...] -o myprogram -ltcmalloc
HEAPCHECK=normal ./myprogram

Heap Profiler:

gcc [...] -o myprogram -ltcmalloc
HEAPPROFILE=/tmp/netheap ./myprogram

Cpu Profiler:

gcc [...] -o myprogram -lprofiler
CPUPROFILE=/tmp/profile ./myprogram

Sample Output

The heap profiler can pop up a window that displays information as a directed graph:

The cpu profiler can produce a weighted call graph:

Documentation

Downloads

For downloads, please visit our Downloads Page.

News

  • Version 0.91 released, Apr 2007
  • Version 0.90 released, Apr 2007
  • Version 0.8 released, Jun 2006
  • Version 0.7 released, Apr 2006
  • Version 0.6 released, Jan 2006
  • Version 0.5 released, Nov 2005
  • Version 0.4 released, Oct 2005
  • Version 0.3 released, June 2005
  • Initial Launch, March 2005

Links to Other Sites

Russ Cox's gperftools-httpd, a simple http server based on thttpd that enables remote profiling via google-perftool's pprof.

Brett Viren's Perftools project at the Brookhaven National Laboratory -- a similar project with the same name as Google's. [docs], [download]


Comment by david.coallier, Aug 29, 2007

Works pretty well, and very simple to use. If one doesn't use valgrind, this should be used :)

Good work guys.

Comment by yaserzt, Nov 27, 2007

I wonder what the performance of the memory allocator is like, compared to the Hoard memory allocator. Has there been a comparison or benchmark?

Comment by maximus.ka, Nov 29, 2007

Really cool. Much more help full than using gcc -pg. And the concept of being able enabling this on demand is superb.

Comment by shashibg, Feb 19, 2008

Awesome tool and library! This has taken guesswork and speculation out of my profiling needs besides the great performance.

Why not expose other parts of the implementation also as an API (via installed header files)\? For example, I found SpinLock? to be highly performant and useful for my other needs. I suppose there are other efficient spin lock implementations out there that I could use, but since I already link against tcmalloc, it makes sense for me to just use this.

All this needs is to include spinlock.h in the installed header files under PREFIX/include/google

Comment by mdcallag, Jun 10, 2008

Very impressive. We have used the CPU profiler, heap checker and tcmalloc with our MySQL builds (at Google). The next MySQL patch distributed by Google will have changes so that it can optionally build with support for each of these. We replaced a custom memory heap in InnoDB with tcmalloc and that made it much faster. Numbers will be released soon. All of this has made our debugging work easier and our servers run faster.

Comment by vicaya, Jun 24, 2008

Great malloc replacement for servers. Beware of the huge start time though. It takes 2-3 seconds for any program linked with tcmalloc just to get to the main function. It's like starting a jvm :)

Comment by cleiserson, Jan 14, 2009

I don't see an answer to yaserzt from over a month ago. How does it compare to Hoard? How does it compare to Miser?

Comment by yukuku, Jan 26, 2009

How is the custom built of MySQL going on? I would really be interested in seeing those results.

Comment by Franz.Fe...@fja.com, Jan 27, 2009

On AIX 5.3 i get on executing configure checking how to access the program counter from a struct ucontext... configure: WARNING: Could not find the PC. Will not try to compile libprofiler... Is it possible to access the program counter (PC) on AIX 5.3 and if so how?

Comment by mdcallag, Feb 21, 2009

TCMalloc doubled the throughput for sysbench on MySQL because malloc is a hot spot.

Comment by elseano, Apr 28, 2009

Important: centos 5.3 64 bit. You gotsta compile tcmalloc from the tarball. Then for a mysqld build do:

export LD_LIBRARY_PATH='/usr/local/lib';

./configure --with-mysqld-ldflags=-ltcmalloc_minimal --with-named-curses-libs=/usr/lib64/libncurses.so.5 ; 

make ; make install
Comment by aaron.vinson, May 04, 2009

According to the tcmalloc docs, you can set LD_PRELOAD and avoid having to rebuild a binary (like mysql) from source. What's the advantage of rebuilding mysql?

Comment by rogerpack2005, May 20, 2009

The links to documentation are pretty scarce here http://goog-perftools.sourceforge.net/doc/tcmalloc.html

Comment by mohan85, May 26, 2009

ERROR when compiling it

$ make check source='src/tcmalloc.cc' object='libtcmalloc_minimal_la-tcmalloc.lo' libtool=yes \ DEPDIR=.deps depmode=gcc /bin/sh ./depcomp \ /bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -c -o libtcmalloc_minimal_la-tcmalloc.lo test -f 'src/tcmalloc.cc' || echo './'src/tcmalloc.cc

g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -c src/tcmalloc.cc -Wp,-MD,.deps/libtcmalloc_minimal_la-tcmalloc.TPlo -fPIC -DPIC -o .libs/libtcmalloc_minimal_la-tcmalloc.o
In file included from src/tcmalloc.cc:116: src/base/spinlock.h:70: macro `EXCLUSIVE_LOCK_FUNCTION' used without args src/base/spinlock.h:90: macro `UNLOCK_FUNCTION' used without args src/base/spinlock.h:147: macro `UNLOCK_FUNCTION' used without args make: libtcmalloc_minimal_la-tcmalloc.lo? Error 1

Comment by mohan85, May 26, 2009

please help me in fixing this ERROR


Sign in to add a comment