Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: third_party/tcmalloc/chromium/src/stacktrace_with_context.cc

Issue 9323026: [NOT TO COMMIT!] r109: Diff of the current tcmalloc from the original google-perftools r109. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/stacktrace_with_context.cc
diff --git a/third_party/tcmalloc/chromium/src/stack_trace_table.h b/third_party/tcmalloc/chromium/src/stacktrace_with_context.cc
similarity index 55%
copy from third_party/tcmalloc/chromium/src/stack_trace_table.h
copy to third_party/tcmalloc/chromium/src/stacktrace_with_context.cc
index e1d6a8a988b88c12d70b321893f9a8ff90fe00bd..ed7bfe3f73b1c669523d5b8fbf6b4534e6553426 100644
--- a/third_party/tcmalloc/chromium/src/stack_trace_table.h
+++ b/third_party/tcmalloc/chromium/src/stacktrace_with_context.cc
@@ -1,10 +1,10 @@
// Copyright (c) 2009, Google Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
-//
+//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -28,62 +28,34 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---
-// Author: Andrew Fikes
+// Author: Paul Pluzhnikov
//
-// Utility class for coalescing sampled stack traces. Not thread-safe.
-
-#ifndef TCMALLOC_STACK_TRACE_TABLE_H_
-#define TCMALLOC_STACK_TRACE_TABLE_H_
+// This code logically belongs in stacktrace.cc, but
+// it is moved into (this) separate file in order to
+// prevent inlining of routines defined here.
+//
+// Inlining causes skip_count to be incorrect, and there
+// is no portable way to prevent it.
+//
+// Eventually LTO (link-time optimization) and/or LLVM
+// may inline this code anyway. Let's hope they respect
+// ATTRIBUTE_NOINLINE.
#include <config.h>
-#include <stdint.h> // for uintptr_t
-#include "common.h"
-
-namespace tcmalloc {
-
-class PERFTOOLS_DLL_DECL StackTraceTable {
- public:
- // REQUIRES: L < pageheap_lock
- StackTraceTable();
- ~StackTraceTable();
-
- // Adds stack trace "t" to table.
- //
- // REQUIRES: L >= pageheap_lock
- void AddTrace(const StackTrace& t);
-
- // Returns stack traces formatted per MallocExtension guidelines.
- // May return NULL on error. Clears state before returning.
- //
- // REQUIRES: L < pageheap_lock
- void** ReadStackTracesAndClear();
-
- // Exposed for PageHeapAllocator
- struct Bucket {
- // Key
- uintptr_t hash;
- StackTrace trace;
-
- // Payload
- int count;
- Bucket* next;
-
- bool KeyEqual(uintptr_t h, const StackTrace& t) const;
- };
-
- // For testing
- int depth_total() const { return depth_total_; }
- int bucket_total() const { return bucket_total_; }
-
- private:
- static const int kHashTableSize = 1 << 14; // => table_ is 128k
-
- bool error_;
- int depth_total_;
- int bucket_total_;
- Bucket** table_;
-};
-
-} // namespace tcmalloc
-
-#endif // TCMALLOC_STACK_TRACE_TABLE_H_
+#include <google/stacktrace.h>
+#include "stacktrace_config.h"
+#include "base/basictypes.h"
+
+#if !defined(STACKTRACE_SKIP_CONTEXT_ROUTINES)
+ATTRIBUTE_NOINLINE PERFTOOLS_DLL_DECL
+int GetStackFramesWithContext(void** pcs, int* sizes, int max_depth,
+ int skip_count, const void * /* uc */) {
+ return GetStackFrames(pcs, sizes, max_depth, skip_count + 1);
+}
+
+ATTRIBUTE_NOINLINE PERFTOOLS_DLL_DECL
+int GetStackTraceWithContext(void** result, int max_depth,
+ int skip_count, const void * /* uc */) {
+ return GetStackTrace(result, max_depth, skip_count + 1);
+}
+#endif
« no previous file with comments | « third_party/tcmalloc/chromium/src/stacktrace_win32-inl.h ('k') | third_party/tcmalloc/chromium/src/stacktrace_x86-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698