| Index: src/IceTimerTree.cpp
|
| diff --git a/src/IceTimerTree.cpp b/src/IceTimerTree.cpp
|
| index 847941fa0aa59d270f725c1acb4c7836c89cd4bf..81ef7223a6b7e7839843640ee9bd236bb47bb000 100644
|
| --- a/src/IceTimerTree.cpp
|
| +++ b/src/IceTimerTree.cpp
|
| @@ -21,11 +21,10 @@ namespace Ice {
|
|
|
| std::vector<IceString> TimerStack::IDs;
|
|
|
| -TimerStack::TimerStack(const IceString &TopLevelName)
|
| +TimerStack::TimerStack()
|
| : FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp),
|
| StateChangeCount(0), StackTop(0) {
|
| Nodes.resize(1); // Reserve Nodes[0] for the root node.
|
| - push(getTimerID(TopLevelName));
|
| }
|
|
|
| // Returns the unique timer ID for the given Name, creating a new ID
|
| @@ -112,27 +111,29 @@ void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) {
|
|
|
| } // end of anonymous namespace
|
|
|
| -void TimerStack::dump(Ostream &Str) {
|
| +void TimerStack::dump(Ostream &Str, bool DumpCumulative) {
|
| update();
|
| double TotalTime = LastTimestamp - FirstTimestamp;
|
| assert(TotalTime);
|
| - Str << "Cumulative function times:\n";
|
| - DumpMapType CumulativeMap;
|
| - for (TTindex i = 1; i < Nodes.size(); ++i) {
|
| - TTindex Prefix = i;
|
| - IceString Suffix = "";
|
| - while (Prefix) {
|
| - if (Suffix.empty())
|
| - Suffix = IDs[Nodes[Prefix].Interior];
|
| - else
|
| - Suffix = IDs[Nodes[Prefix].Interior] + "." + Suffix;
|
| - assert(Nodes[Prefix].Parent < Prefix);
|
| - Prefix = Nodes[Prefix].Parent;
|
| + if (DumpCumulative) {
|
| + Str << "Cumulative times:\n";
|
| + DumpMapType CumulativeMap;
|
| + for (TTindex i = 1; i < Nodes.size(); ++i) {
|
| + TTindex Prefix = i;
|
| + IceString Suffix = "";
|
| + while (Prefix) {
|
| + if (Suffix.empty())
|
| + Suffix = IDs[Nodes[Prefix].Interior];
|
| + else
|
| + Suffix = IDs[Nodes[Prefix].Interior] + "." + Suffix;
|
| + assert(Nodes[Prefix].Parent < Prefix);
|
| + Prefix = Nodes[Prefix].Parent;
|
| + }
|
| + CumulativeMap.insert(std::make_pair(Nodes[i].Time, Suffix));
|
| }
|
| - CumulativeMap.insert(std::make_pair(Nodes[i].Time, Suffix));
|
| + dumpHelper(Str, CumulativeMap, TotalTime);
|
| }
|
| - dumpHelper(Str, CumulativeMap, TotalTime);
|
| - Str << "Flat function times:\n";
|
| + Str << "Flat times:\n";
|
| DumpMapType FlatMap;
|
| for (TimerIdT i = 0; i < LeafTimes.size(); ++i) {
|
| FlatMap.insert(std::make_pair(LeafTimes[i], IDs[i]));
|
|
|