Index: src/LinuxMallocProfiling.h |
diff --git a/src/LinuxMallocProfiling.h b/src/LinuxMallocProfiling.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c844a195c507f6bea4c22c3c4a6eb99ede6eddf8 |
--- /dev/null |
+++ b/src/LinuxMallocProfiling.h |
@@ -0,0 +1,45 @@ |
+//===--- subzero/src/LinuxMallocProfiling.h - malloc/new tracing ---------===// |
+// |
+// The Subzero Code Generator |
+// |
+// This file is distributed under the University of Illinois Open Source |
+// License. See LICENSE.TXT for details. |
+// |
+//===----------------------------------------------------------------------===// |
+/// |
+/// \file |
+/// \brief malloc/new/...caller tracing. |
+/// |
+//===----------------------------------------------------------------------===// |
John
2016/03/15 15:19:06
you're missing the
#ifndef LINUXMALLOCPROFILING_H
sehr
2016/03/17 16:47:14
Done.
|
+ |
+#include "IceDefs.h" |
+#include "IceTypes.h" |
+ |
+#include <iostream> |
+ |
+namespace Ice { |
+ |
+class LinuxMallocProfiling { |
+ public: |
Jim Stichnoth
2016/03/15 15:36:50
This doesn't look like normal clang-format indenta
sehr
2016/03/17 16:47:14
Done.
|
+ explicit LinuxMallocProfiling(size_t NumThreads) { |
John
2016/03/15 15:19:06
can you move the definitions to the .cpp file so t
sehr
2016/03/17 16:47:14
Done.
|
+ if (NumThreads != 0) { |
+#ifdef ALLOW_LINUX_MALLOC_PROFILE |
+ std::cout << "NOTE: Malloc profiling is not thread safe. " |
+ << "Use --threads=0 to enable.\n"; |
+#endif // ALLOW_LINUX_MALLOC_PROFILE |
+ return; |
+ } |
+ start(); |
+ } |
+ ~LinuxMallocProfiling() { |
+ end(); |
+ } |
+ |
+ private: |
+ LinuxMallocProfiling(const LinuxMallocProfiling&) = delete; |
John
2016/03/15 15:19:06
I honestly believe this is the proper place for de
sehr
2016/03/17 16:47:14
Done.
|
+ LinuxMallocProfiling &operator=(const LinuxMallocProfiling&) = delete; |
+ static void start(); |
John
2016/03/15 15:19:06
if you move the ctor/dtor implementation to the .c
sehr
2016/03/17 16:47:14
Done.
|
+ static void end(); |
+}; |
+ |
+} // end of namespace Ice |