From 793802351c860dcb060c51235610ae5445fa8e37 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 10 May 2016 12:16:56 -0400 Subject: [PATCH] fixes --- .gitignore | 16 ++++++++-------- Makefile | 2 +- display.cc | 8 ++++++-- display.h | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index ca8c666..532c89b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,13 @@ -display -dynprof -out_dynprof.* -dyninst.h.gch CMakeCache.txt CMakeFiles -work +display +dyninst.h.gch +dynprof +*_dynprof example/test example/time -*.swp -*.o libdynprof.so -test_dynprof +*.o +out_dynprof.* +*.swp +work diff --git a/Makefile b/Makefile index 22cb584..98cef6b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ ifneq ($(filter clang++,$(CXX)),) CXXFLAGS += -Weverything -Wno-c++98-compat endif -CXXFLAGS += -ggdb3 +#CXXFLAGS += -ggdb3 #CXXFLAGS += -O2 #CXXFLAGS += -flto #CXXFLAGS += -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity diff --git a/display.cc b/display.cc index d0bdde1..78e544f 100644 --- a/display.cc +++ b/display.cc @@ -54,8 +54,6 @@ double Output::elapsed_time(CallPair calls) { } void Output::process_output(FuncMap funcs) { - std::cerr << "%\tcummulative\tself" << std::endl; - std::cerr << "time\tseconds\t\tseconds\t\tcalls\tname" << std::endl; double total = elapsed_time(funcs[DEFAULT_ENTRY_POINT].at(0)); std::vector output; for (auto func : funcs) { @@ -65,8 +63,14 @@ void Output::process_output(FuncMap funcs) { } output.push_back({(ftime / total * 100), ftime, func.second.size(), func.first}); } + std::cerr << "%\tcummulative\tself" << std::endl; + std::cerr << "time\tseconds\t\tseconds\t\tcalls\tname" << std::endl; std::sort(output.begin(), output.end()); for(auto func: output) { + // FIXME: figure out what's going on here. + if(func.percent < 0) { + func.percent = func.elapsed = -1; + } std::cerr << std::fixed << std::setprecision(2) << func.percent << "\t" << "TODO" << "\t\t" << std::setprecision(5) << func.elapsed << "\t\t" << func.calls << "\t" diff --git a/display.h b/display.h index d21aca7..78530fd 100644 --- a/display.h +++ b/display.h @@ -41,9 +41,9 @@ struct FuncOutput { double elapsed; size_t calls; std::string name; - // Default to sorting output by number of calls. + // Default to sorting output by percent of total execution time in descending order. bool operator<(const FuncOutput &other) { - return calls < other.calls; + return percent > other.percent; } };