Some more cleanup and restructuring.
authorMilian Wolff <mail@milianw.de>
Wed, 6 Aug 2014 21:19:14 +0000 (23:19 +0200)
committerMilian Wolff <mail@milianw.de>
Wed, 6 Aug 2014 21:19:14 +0000 (23:19 +0200)
CMakeLists.txt
heaptrack_interpret.cpp
heaptrack_print.cpp [moved from heaptrack_main.cpp with 99% similarity]
libheaptrack.cpp [moved from heaptrack.cpp with 98% similarity]
trace.h
tracetree.h

index 092e587..874a925 100644 (file)
@@ -14,19 +14,19 @@ include_directories(
 add_subdirectory(3rdparty)
 add_subdirectory(tests)
 
-add_library(libheaptrack SHARED heaptrack.cpp)
+add_library(libheaptrack SHARED libheaptrack.cpp)
 set_target_properties(libheaptrack
   PROPERTIES OUTPUT_NAME heaptrack)
 target_link_libraries(libheaptrack ${CMAKE_DL_LIBS} backtrace)
 
-add_executable(heaptrack_eval heaptrack_main.cpp)
-target_link_libraries(heaptrack_eval ${Boost_LIBRARIES})
-
 add_executable(heaptrack_interpret heaptrack_interpret.cpp)
 target_link_libraries(heaptrack_interpret backtrace)
 
+add_executable(heaptrack_print heaptrack_print.cpp)
+target_link_libraries(heaptrack_print ${Boost_LIBRARIES})
+
 # TODO: support running from an installed location
-# install(TARGETS libheaptrack heaptrack_eval heaptrack_interpret
+# install(TARGETS libheaptrack heaptrack_interpret heaptrack_print
 #   RUNTIME DESTINATION bin
 #   LIBRARY DESTINATION lib
 #   ARCHIVE DESTINATION lib
index 618103a..43eec7a 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/**
+ * @file heaptrack_interpret.cpp
+ *
+ * @brief Interpret raw heaptrack data and add Dwarf based debug information.
+ */
+
 #include <iostream>
 #include <sstream>
 #include <unordered_map>
similarity index 99%
rename from heaptrack_main.cpp
rename to heaptrack_print.cpp
index f347ea7..261d266 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/**
+ * @file heaptrack_print.cpp
+ *
+ * @brief Evaluate and print the collected heaptrack data.
+ */
+
 #include <iostream>
 #include <fstream>
 #include <sstream>
similarity index 98%
rename from heaptrack.cpp
rename to libheaptrack.cpp
index 6bb4f53..3dc2770 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+/**
+ * @file libheaptrack.cpp
+ *
+ * @brief Collect raw heaptrack data by overloading heap allocation functions.
+ */
+
 #include <cstdio>
 #include <cstdlib>
 
diff --git a/trace.h b/trace.h
index 725ab7d..aa25378 100644 (file)
--- a/trace.h
+++ b/trace.h
@@ -25,6 +25,9 @@
 #define UNW_LOCAL_ONLY
 #include <libunwind.h>
 
+/**
+ * @brief A libunwind based backtrace.
+ */
 struct Trace
 {
     using ip_t = void*;
index 2023b31..d1364f2 100644 (file)
 #ifndef TRACETREE_H
 #define TRACETREE_H
 
+/**
+ * @file tracetree.h
+ * @brief Efficiently combine and store the data of multiple Traces.
+ */
+
 #include <vector>
 #include <algorithm>
 
@@ -46,7 +51,9 @@ class TraceTree
 {
 public:
     /**
-     * Index the backtrace and return the index of the last instruction pointer.
+     * Index the data in @p trace and return the index of the last instruction pointer.
+     *
+     * Unknown instruction pointers will be printed to @p out.
      */
     std::size_t index(const Trace& trace, FILE* out)
     {