Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -24,6 +24,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/FileOutputBuffer.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Timer.h" #include using namespace llvm; @@ -365,8 +366,32 @@ InX::IgotPlt = make(); Add(InX::IgotPlt); + double TotalWallTime = 0.0; + double Min = std::numeric_limits::max(); + double Max = std::numeric_limits::min(); + uint64_t N = 0; + if (Config->GdbIndex) { - InX::GdbIndex = createGdbIndex(); + Timer T("Name", "Desc"); + + while (++N) { + T.startTimer(); + InX::GdbIndex = createGdbIndex(); + T.stopTimer(); + + double WallT = T.getTotalTime().getWallTime(); + T.clear(); + + Min = std::min(Min, WallT); + Max = std::max(Max, WallT); + TotalWallTime += WallT; + + outs() << "Avg: " << (TotalWallTime / N) << ", N: " << N + << " Min: " << Min << ", Max: " << Max << ", Last: " << WallT + << "\n"; + outs().flush(); + } + Add(InX::GdbIndex); }