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

Unified Diff: base/allocator/allocated_type_profiler.h

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflected comments #21,22 Created 8 years, 4 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: base/allocator/allocated_type_profiler.h
diff --git a/base/allocator/allocated_type_profiler.h b/base/allocator/allocated_type_profiler.h
new file mode 100644
index 0000000000000000000000000000000000000000..37ca7ceea75cc6f891cb031ef8228df24d9ba1ff
--- /dev/null
+++ b/base/allocator/allocated_type_profiler.h
@@ -0,0 +1,29 @@
+// 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.
Ryan Sleevi 2012/08/10 04:16:09 style nit: See chromium-dev thread about new copyr
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Done for all new files.
+
+#ifndef BASE_ALLOCATOR_ALLOCATED_TYPE_PROFILER_H_
+#define BASE_ALLOCATOR_ALLOCATED_TYPE_PROFILER_H_
+
+// We use __linux__ since this file is included automatically by the compiler
+// option '-include' before build/build_config.h.
Ryan Sleevi 2012/08/10 04:16:09 Can you not include build/build_config.h? Alterna
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Used #if defined(PROFILING_ALLOCATED_TYPE).
+#if defined(__linux__) && defined(__clang__)
+
+#include <cstddef>
+#include <typeinfo>
+
+// These functions are inserted around all 'new' and 'delete' expressions by
+// the compiler option '-fintercept-allocation-functions' introduced in a
+// modified version of Clang at http://crrev.com/149572.
Ryan Sleevi 2012/08/10 04:16:09 nit: This comment can easily get out of date; it's
Dai Mikurube (NOT FULLTIME) 2012/08/10 07:30:03 Ok, but I guess we should have a description that
+
+void* __op_new_intercept__(void* ptr,
+ size_t size,
+ const std::type_info& type);
+
+void* __op_delete_intercept__(void* ptr,
+ size_t size,
+ const std::type_info& type);
+
+#endif // defined(__linux__) && defined(__clang__)
+
+#endif // BASE_ALLOCATOR_ALLOCATED_TYPE_PROFILER_H_
« no previous file with comments | « no previous file | base/allocator/allocated_type_profiler_control.h » ('j') | base/allocator/allocated_type_profiler_control.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698