#include <ProfileNode.h>
Collaboration diagram for vpr::ProfileNode:

Public Types | |
| typedef std::pair< std::deque< float >::const_iterator, std::deque< float >::const_iterator > | NodeHistoryRange |
Public Methods | |
| ProfileNode (const char *name, ProfileNode *parent) | |
| constructor for a profile node Takes a static string pointer for the name and a reference to a parent. More... | |
| ProfileNode (const char *name, ProfileNode *parent, const unsigned int queue_size) | |
| ~ProfileNode (void) | |
| destructor. More... | |
| ProfileNode * | getSubNode (const char *name) |
| Returns a pointer to a subnode of this node given the name of the subnode If the name doesn't exist it creates the new node and adds it as a child to this node and returns this new node. More... | |
| ProfileNode * | getSubNode (const char *name, const unsigned int queue_size) |
| ProfileNode * | getParent (void) |
| return This nodes parent. More... | |
| ProfileNode * | getSibling (void) |
| ProfileNode * | getChild (void) |
| void | printTree (ProfileNode *node) |
| void | reset (void) |
| void | call (void) |
| bool | Return (void) |
| const char * | getName (void) |
| int | getTotalCalls (void) |
| float | getTotalTime (void) |
| const NodeHistoryRange | getNodeHistoryRange () |
| void | clearHistory () |
Protected Attributes | |
| const char * | mName |
| int | mTotalCalls |
| float | mTotalTime |
| std::deque< float > | mHistory |
| unsigned int | mHistorySize |
| vpr::Interval | mStartTime |
| int | mRecursionCounter |
| ProfileNode * | mParent |
| ProfileNode * | mChild |
| ProfileNode * | mSibling |
Definition at line 35 of file ProfileNode.h.
|
|
Definition at line 86 of file ProfileNode.h. Referenced by getNodeHistoryRange, and printTree. |
|
||||||||||||
|
constructor for a profile node Takes a static string pointer for the name and a reference to a parent.
Definition at line 9 of file ProfileNode.cpp. References mHistory, mHistorySize, mStartTime, reset, and vpr::Interval::secf. Referenced by getChild, getParent, getSibling, and getSubNode.
00009 : 00010 mName( name ), 00011 mTotalCalls( 0 ), 00012 mTotalTime( 0 ), 00013 mRecursionCounter( 0 ), 00014 mParent( parent ), 00015 mChild( NULL ), 00016 mSibling( NULL ) 00017 { 00018 mHistorySize = 1; 00019 mHistory.resize(mHistorySize); 00020 mStartTime.secf(0); 00021 reset(); 00022 } |
|
||||||||||||||||
|
Definition at line 24 of file ProfileNode.cpp. References mHistory, mHistorySize, mStartTime, reset, and vpr::Interval::secf.
00024 : 00025 mName( name ), 00026 mTotalCalls( 0 ), 00027 mTotalTime( 0 ), 00028 mRecursionCounter( 0 ), 00029 mParent( parent ), 00030 mChild( NULL ), 00031 mSibling( NULL ) 00032 { 00033 mHistorySize = queue_size; 00034 mHistory.resize(mHistorySize); 00035 mStartTime.secf(0); 00036 reset(); 00037 } |
|
|
destructor.
Definition at line 39 of file ProfileNode.cpp. References mChild, and mSibling.
|
|
|
Returns a pointer to a subnode of this node given the name of the subnode If the name doesn't exist it creates the new node and adds it as a child to this node and returns this new node.
Definition at line 45 of file ProfileNode.cpp. References mChild, and ProfileNode.
00046 {
00047 // Try to find this sub node
00048 ProfileNode* child = mChild;
00049 while ( child ) {
00050 if ( child->mName == name ) {
00051 return child;
00052 }
00053 child = child->mSibling;
00054 }
00055
00056 // We didn't find it, so add it
00057 ProfileNode* node = new ProfileNode( name, this );
00058 node->mSibling = mChild;
00059 mChild = node;
00060 return node;
00061 }
|
|
||||||||||||
|
Definition at line 63 of file ProfileNode.cpp. References mChild, and ProfileNode.
00064 {
00065 // Try to find this sub node
00066 ProfileNode* child = mChild;
00067 while ( child ) {
00068 if ( child->mName == name ) {
00069 return child;
00070 }
00071 child = child->mSibling;
00072 }
00073
00074 // We didn't find it, so add it
00075 ProfileNode* node = new ProfileNode( name, this, queue_size);
00076 node->mSibling = mChild;
00077 mChild = node;
00078 return node;
00079 }
|
|
|
return This nodes parent.
Definition at line 64 of file ProfileNode.h. References mParent, and ProfileNode.
00064 { return mParent; }
|
|
|
Definition at line 69 of file ProfileNode.h. References mSibling, and ProfileNode.
00069 { return mSibling; }
|
|
|
Definition at line 74 of file ProfileNode.h. References mChild, and ProfileNode.
00074 { return mChild; }
|
|
|
Definition at line 81 of file ProfileNode.cpp. References clrGREEN, clrOutBOLD, clrRED, clrRESET, clrSetBOLD, clrYELLOW, NodeHistoryRange, vprDBG_ALL, vprDEBUG, and vprDEBUG_FLUSH.
00082 {
00083 if(node == NULL) return;
00084
00085 ProfileNode::printTree(node->getSibling());
00086
00087 vprDEBUG(vprDBG_ALL, 0) << clrSetBOLD(clrGREEN) << "[PROFILE STATS] " << clrRESET
00088 << clrSetBOLD(clrRED) << node->getName() << clrRESET << clrSetBOLD(clrYELLOW)
00089 << " total calls: " << clrRESET << node->getTotalCalls()
00090 << clrSetBOLD(clrYELLOW) << " total time: " << clrRESET << node->getTotalTime()
00091 << clrSetBOLD(clrYELLOW) << " ave: " << clrRESET
00092 << node->getTotalTime() / node->getTotalCalls() << std::endl << vprDEBUG_FLUSH;
00093
00094 std::stringstream s;
00095 NodeHistoryRange p = node->getNodeHistoryRange();
00096 for(; p.first != p.second; p.first++)
00097 {
00098 s << *(p.first) << " ";
00099 }
00100
00101 vprDEBUG(vprDBG_ALL, 0) << clrOutBOLD(clrYELLOW, " history: ")
00102 << s.str() << std::endl << vprDEBUG_FLUSH;
00103
00104 ProfileNode::printTree(node->getChild());
00105
00106 }
|
|
|
Definition at line 109 of file ProfileNode.cpp. References mChild, mSibling, mTotalCalls, and mTotalTime. Referenced by ProfileNode.
00110 {
00111 mTotalCalls = 0;
00112 mTotalTime = 0.0f;
00113
00114 if ( mChild ) {
00115 mChild->reset();
00116 }
00117 if ( mSibling ) {
00118 mSibling->reset();
00119 }
00120 }
|
|
|
Definition at line 122 of file ProfileNode.cpp. References mRecursionCounter, mStartTime, mTotalCalls, and vpr::profileGetTicks.
00123 {
00124 mTotalCalls++;
00125 if (mRecursionCounter++ == 0) {
00126 profileGetTicks(&mStartTime);
00127 }
00128 }
|
|
|
Definition at line 130 of file ProfileNode.cpp. References mHistory, mHistorySize, mRecursionCounter, mStartTime, mTotalCalls, mTotalTime, vpr::profileGetTickRate, vpr::profileGetTicks, and vpr::Interval::secf.
00131 {
00132 if ( --mRecursionCounter == 0 && mTotalCalls != 0 ) {
00133 vpr::Interval time;
00134 profileGetTicks(&time);
00135 time-=mStartTime;
00136 mHistory.push_front((float)(time.secf() / profileGetTickRate().secf()));
00137 mHistory.resize(mHistorySize);
00138 mTotalTime += mHistory.front();
00139 }
00140 return ( mRecursionCounter == 0 );
00141 }
|
|
|
Definition at line 82 of file ProfileNode.h. References mName.
00082 { return mName; }
|
|
|
Definition at line 83 of file ProfileNode.h. References mTotalCalls.
00083 { return mTotalCalls; }
|
|
|
Definition at line 84 of file ProfileNode.h. References mTotalTime.
00084 { return mTotalTime; }
|
|
|
Definition at line 88 of file ProfileNode.h. References mHistory, and NodeHistoryRange.
|
|
|
Definition at line 90 of file ProfileNode.h. References mHistory.
00090 {mHistory.clear(); }
|
|
|
Definition at line 95 of file ProfileNode.h. Referenced by getName. |
|
|
Definition at line 96 of file ProfileNode.h. Referenced by call, getTotalCalls, reset, and Return. |
|
|
Definition at line 97 of file ProfileNode.h. Referenced by getTotalTime, reset, and Return. |
|
|
Definition at line 99 of file ProfileNode.h. Referenced by clearHistory, getNodeHistoryRange, ProfileNode, and Return. |
|
|
Definition at line 100 of file ProfileNode.h. Referenced by ProfileNode, and Return. |
|
|
Definition at line 102 of file ProfileNode.h. Referenced by call, ProfileNode, and Return. |
|
|
Definition at line 103 of file ProfileNode.h. |
|
|
Definition at line 105 of file ProfileNode.h. Referenced by getParent. |
|
|
Definition at line 106 of file ProfileNode.h. Referenced by getChild, getSubNode, reset, and ~ProfileNode. |
|
|
Definition at line 107 of file ProfileNode.h. Referenced by getSibling, reset, and ~ProfileNode. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002