diff --git a/tools/compute-hops/CMakeLists.txt b/tools/compute-hops/CMakeLists.txt index e81a680e..ff37c40e 100644 --- a/tools/compute-hops/CMakeLists.txt +++ b/tools/compute-hops/CMakeLists.txt @@ -9,5 +9,6 @@ if(NOT CONFIG_INJECTIONPOINT_HOPS) endif() add_executable(compute-hops main.cc ${SRCS}) -target_link_libraries(compute-hops ${PROTOBUF_LIBRARY} fail-util fail-comm procps) +# add procps for built-in memory-usage measurements: +target_link_libraries(compute-hops ${PROTOBUF_LIBRARY} fail-util fail-comm) install(TARGETS compute-hops RUNTIME DESTINATION bin) diff --git a/tools/compute-hops/ResultCollector.cc b/tools/compute-hops/ResultCollector.cc index 792fea25..1de9bd7b 100644 --- a/tools/compute-hops/ResultCollector.cc +++ b/tools/compute-hops/ResultCollector.cc @@ -17,7 +17,11 @@ #include "comm/InjectionPointHopsMessage.pb.h" +//#define MEASURE_MEM_USAGE + +#ifdef MEASURE_MEM_USAGE #include +#endif using std::hex; using std::dec; @@ -87,16 +91,16 @@ ResultCollector::addResult(std::vector& res, unsigned int costs) InjectionPointMessage_Hops *hop = hc.add_hops(); hop->set_address(it_hop->first.first); - enum InjectionPointMessage_Hops_AccessType at; + InjectionPointMessage::Hops::AccessType at; switch (it_hop->first.second) { case ACCESS_NONE: - at = InjectionPointMessage_Hops_AccessType_EXECUTE; + at = InjectionPointMessage::Hops::EXECUTE; break; case ACCESS_READ: - at = InjectionPointMessage_Hops_AccessType_READ; + at = InjectionPointMessage::Hops::READ; break; case ACCESS_WRITE: - at = InjectionPointMessage_Hops_AccessType_WRITE; + at = InjectionPointMessage::Hops::WRITE; break; case ACCESS_READORWRITE: LOG << "ReadOrWrite memory access event not yet" @@ -106,6 +110,9 @@ ResultCollector::addResult(std::vector& res, unsigned int costs) case ACCESS_CHECKPOINT: LOG << "Checkpoint not allowed after beginning of hop chain" << std::endl; exit(-1); + default: + LOG << "Unknown memory-access event" << std::endl; + exit(-1); } hop->set_accesstype(at); } @@ -153,9 +160,13 @@ ResultCollector::stopTimer() void ResultCollector::setMaxMemUsage() { +#ifdef MEASURE_MEM_USAGE struct proc_t usage; look_up_our_self(&usage); m_mem_usage = usage.vsize; +#else + m_mem_usage = 0; +#endif } void diff --git a/tools/compute-hops/main.cc b/tools/compute-hops/main.cc index 0c1134a7..f66a75be 100644 --- a/tools/compute-hops/main.cc +++ b/tools/compute-hops/main.cc @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) CommandLine::option_handle ALGORITHM = cmd.addOption("a", "algorithm", Arg::Required, - "-a,--algorithm \tHop algorithm (\"simple\"/\"smart\", default: \"none\")"); + "-a,--algorithm \tHop algorithm (\"simple\"/\"smart\", default: \"smart\")"); CommandLine::option_handle OUTPUT_MODE = cmd.addOption("m", "output-mode", Arg::Required,