| Index: src/IceTimerTree.h
|
| diff --git a/src/IceTimerTree.h b/src/IceTimerTree.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3162587aed191081878a8064a9e2741351d48c59
|
| --- /dev/null
|
| +++ b/src/IceTimerTree.h
|
| @@ -0,0 +1,68 @@
|
| +//===- subzero/src/IceTimerTree.h - Pass timer defs -------------*- C++ -*-===//
|
| +//
|
| +// The Subzero Code Generator
|
| +//
|
| +// This file is distributed under the University of Illinois Open Source
|
| +// License. See LICENSE.TXT for details.
|
| +//
|
| +//===----------------------------------------------------------------------===//
|
| +//
|
| +// This file declares the TimerTree class, which allows flat and
|
| +// cumulative execution time collection of call chains.
|
| +//
|
| +//===----------------------------------------------------------------------===//
|
| +
|
| +#ifndef SUBZERO_SRC_ICETIMERTREE_H
|
| +#define SUBZERO_SRC_ICETIMERTREE_H
|
| +
|
| +namespace Ice {
|
| +
|
| +class TimerTreeNode;
|
| +
|
| +// Timer tree index type
|
| +typedef std::vector<TimerTreeNode>::size_type TTindex;
|
| +
|
| +// TimerTreeNode represents an interior or leaf node in the call tree.
|
| +// It contains a list of children, a pointer to its parent, and the
|
| +// timer ID for the node. It also holds the cumulative time spent at
|
| +// this node and below. The children are always at a higher index in
|
| +// the TimerTreeNode::Nodes array, and the parent is always at a lower
|
| +// index.
|
| +class TimerTreeNode {
|
| +public:
|
| + TimerTreeNode() : Parent(0), Interior(0), Time(0) {}
|
| + std::vector<TTindex> Children; // indexed by TimerIdT
|
| + TTindex Parent;
|
| + TimerIdT Interior;
|
| + double Time;
|
| +};
|
| +
|
| +class TimerStack {
|
| + TimerStack(const TimerStack &) LLVM_DELETED_FUNCTION;
|
| + TimerStack &operator=(const TimerStack &) LLVM_DELETED_FUNCTION;
|
| +
|
| +public:
|
| + TimerStack(const IceString &TopLevelName);
|
| + static TimerIdT getTimerID(const IceString &Name);
|
| + void push(TimerIdT ID);
|
| + void pop(TimerIdT ID);
|
| + void dump(Ostream &Str);
|
| +
|
| +private:
|
| + void update();
|
| + static double timestamp() {
|
| + // TODO: Implement in terms of std::chrono for C++11.
|
| + return llvm::TimeRecord::getCurrentTime(false).getWallTime();
|
| + }
|
| + const double FirstTimestamp;
|
| + double LastTimestamp;
|
| + uint64_t StateChangeCount;
|
| + static std::vector<IceString> IDs; // indexed by TimerIdT
|
| + std::vector<TimerTreeNode> Nodes; // indexed by TTindex
|
| + std::vector<double> LeafTimes; // indexed by TimerIdT
|
| + TTindex StackTop;
|
| +};
|
| +
|
| +} // end of namespace Ice
|
| +
|
| +#endif // SUBZERO_SRC_ICETIMERTREE_H
|
|
|