diff options
author | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 15:04:25 +0000 |
---|---|---|
committer | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 15:04:25 +0000 |
commit | c5b97aac8117ffac51a2cf3cc7a1070ab5ff6e93 (patch) | |
tree | 7ebd0a45801c76467026b5c5e0950abbbcd70def /third_party/tcmalloc/chromium/src/symbolize.h | |
parent | 9b0b5b1d9f92505192c1c0a98bbdf3ad70e78842 (diff) | |
download | chromium_src-c5b97aac8117ffac51a2cf3cc7a1070ab5ff6e93.zip chromium_src-c5b97aac8117ffac51a2cf3cc7a1070ab5ff6e93.tar.gz chromium_src-c5b97aac8117ffac51a2cf3cc7a1070ab5ff6e93.tar.bz2 |
Revert 38766 - Temporarily land http://codereview.chromium.org/576001 to check the
performance.
TBR=antonm,jar
Review URL: http://codereview.chromium.org/597040
TBR=glider@chromium.org
Review URL: http://codereview.chromium.org/598064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc/chromium/src/symbolize.h')
-rw-r--r-- | third_party/tcmalloc/chromium/src/symbolize.h | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/third_party/tcmalloc/chromium/src/symbolize.h b/third_party/tcmalloc/chromium/src/symbolize.h index 1ab4ed6..72196f6 100644 --- a/third_party/tcmalloc/chromium/src/symbolize.h +++ b/third_party/tcmalloc/chromium/src/symbolize.h @@ -33,50 +33,18 @@ #ifndef TCMALLOC_SYMBOLIZE_H_ #define TCMALLOC_SYMBOLIZE_H_ -#include "config.h" -#ifdef HAVE_STDINT_H -#include <stdint.h> // for uintptr_t -#endif #include <map> using std::map; -// SymbolTable encapsulates the address operations necessary for stack trace -// symbolization. A common use-case is to Add() the addresses from one or -// several stack traces to a table, call Symbolize() once and use GetSymbol() -// to get the symbol names for pretty-printing the stack traces. -class SymbolTable { - public: - SymbolTable() - : symbol_buffer_(NULL) {} - ~SymbolTable() { - delete[] symbol_buffer_; - } +// An average size of memory allocated for a stack trace symbol. +static const int kSymbolSize = 1024; - // Adds an address to the table. This may overwrite a currently known symbol - // name, so Add() should not generally be called after Symbolize(). - void Add(const void* addr); +// TODO(glider): it's better to make SymbolMap a class that encapsulates the +// address operations and has the Symbolize() method. +typedef map<uintptr_t, char*> SymbolMap; - // Returns the symbol name for addr, if the given address was added before - // the last successful call to Symbolize(). Otherwise may return an empty - // c-string. - const char* GetSymbol(const void* addr); - - // Obtains the symbol names for the addresses stored in the table and returns - // the number of addresses actually symbolized. - int Symbolize(); - - private: - typedef map<const void*, const char*> SymbolMap; - - // An average size of memory allocated for a stack trace symbol. - static const int kSymbolSize = 1024; - - // Map from addresses to symbol names. - SymbolMap symbolization_table_; - - // Pointer to the buffer that stores the symbol names. - char *symbol_buffer_; -}; +extern bool Symbolize(char *out, int out_size, + SymbolMap *symbolization_table); #endif // TCMALLOC_SYMBOLIZE_H_ |