compute-hops: detail fixes and optional procps dep
Cleanups, warning fix, optional procps dep, --help correction. Change-Id: Iba719493e4a8ec37acb7336a39172b3cdefbdc99
This commit is contained in:
@ -9,5 +9,6 @@ if(NOT CONFIG_INJECTIONPOINT_HOPS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(compute-hops main.cc ${SRCS})
|
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)
|
install(TARGETS compute-hops RUNTIME DESTINATION bin)
|
||||||
|
|||||||
@ -17,7 +17,11 @@
|
|||||||
|
|
||||||
#include "comm/InjectionPointHopsMessage.pb.h"
|
#include "comm/InjectionPointHopsMessage.pb.h"
|
||||||
|
|
||||||
|
//#define MEASURE_MEM_USAGE
|
||||||
|
|
||||||
|
#ifdef MEASURE_MEM_USAGE
|
||||||
#include <proc/readproc.h>
|
#include <proc/readproc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using std::hex;
|
using std::hex;
|
||||||
using std::dec;
|
using std::dec;
|
||||||
@ -87,16 +91,16 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
|
|||||||
InjectionPointMessage_Hops *hop = hc.add_hops();
|
InjectionPointMessage_Hops *hop = hc.add_hops();
|
||||||
hop->set_address(it_hop->first.first);
|
hop->set_address(it_hop->first.first);
|
||||||
|
|
||||||
enum InjectionPointMessage_Hops_AccessType at;
|
InjectionPointMessage::Hops::AccessType at;
|
||||||
switch (it_hop->first.second) {
|
switch (it_hop->first.second) {
|
||||||
case ACCESS_NONE:
|
case ACCESS_NONE:
|
||||||
at = InjectionPointMessage_Hops_AccessType_EXECUTE;
|
at = InjectionPointMessage::Hops::EXECUTE;
|
||||||
break;
|
break;
|
||||||
case ACCESS_READ:
|
case ACCESS_READ:
|
||||||
at = InjectionPointMessage_Hops_AccessType_READ;
|
at = InjectionPointMessage::Hops::READ;
|
||||||
break;
|
break;
|
||||||
case ACCESS_WRITE:
|
case ACCESS_WRITE:
|
||||||
at = InjectionPointMessage_Hops_AccessType_WRITE;
|
at = InjectionPointMessage::Hops::WRITE;
|
||||||
break;
|
break;
|
||||||
case ACCESS_READORWRITE:
|
case ACCESS_READORWRITE:
|
||||||
LOG << "ReadOrWrite memory access event not yet"
|
LOG << "ReadOrWrite memory access event not yet"
|
||||||
@ -106,6 +110,9 @@ ResultCollector::addResult(std::vector<result_tuple >& res, unsigned int costs)
|
|||||||
case ACCESS_CHECKPOINT:
|
case ACCESS_CHECKPOINT:
|
||||||
LOG << "Checkpoint not allowed after beginning of hop chain" << std::endl;
|
LOG << "Checkpoint not allowed after beginning of hop chain" << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
default:
|
||||||
|
LOG << "Unknown memory-access event" << std::endl;
|
||||||
|
exit(-1);
|
||||||
}
|
}
|
||||||
hop->set_accesstype(at);
|
hop->set_accesstype(at);
|
||||||
}
|
}
|
||||||
@ -153,9 +160,13 @@ ResultCollector::stopTimer()
|
|||||||
void
|
void
|
||||||
ResultCollector::setMaxMemUsage()
|
ResultCollector::setMaxMemUsage()
|
||||||
{
|
{
|
||||||
|
#ifdef MEASURE_MEM_USAGE
|
||||||
struct proc_t usage;
|
struct proc_t usage;
|
||||||
look_up_our_self(&usage);
|
look_up_our_self(&usage);
|
||||||
m_mem_usage = usage.vsize;
|
m_mem_usage = usage.vsize;
|
||||||
|
#else
|
||||||
|
m_mem_usage = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
CommandLine::option_handle ALGORITHM =
|
CommandLine::option_handle ALGORITHM =
|
||||||
cmd.addOption("a", "algorithm", Arg::Required,
|
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 =
|
CommandLine::option_handle OUTPUT_MODE =
|
||||||
cmd.addOption("m", "output-mode", Arg::Required,
|
cmd.addOption("m", "output-mode", Arg::Required,
|
||||||
|
|||||||
Reference in New Issue
Block a user