static
| 120 | |
| 121 | //static |
| 122 | void Profiler::Draw() |
| 123 | { |
| 124 | if (!sEnableProfiler) |
| 125 | return; |
| 126 | |
| 127 | ofPushMatrix(); |
| 128 | ofTranslate(30, 70); |
| 129 | ofPushStyle(); |
| 130 | ofFill(); |
| 131 | ofSetColor(0, 0, 0, 140); |
| 132 | //ofRect(-5,-15,600,sCosts.size()*15+10); |
| 133 | long entireFrameUs = GetSafeFrameLengthNanoseconds(); |
| 134 | for (int i = 0; i < PROFILER_MAX_TRACK; ++i) |
| 135 | { |
| 136 | if (sCosts[i].mName[0] == 0) |
| 137 | break; |
| 138 | const Cost& cost = sCosts[i]; |
| 139 | long maxCost = cost.MaxCost(); |
| 140 | |
| 141 | ofSetColor(255, 255, 255); |
| 142 | gFont.DrawString(std::string(sCosts[i].mName) + ": " + ofToString(maxCost / 1000), 13, 0, 0); |
| 143 | |
| 144 | if (maxCost > entireFrameUs) |
| 145 | ofSetColor(255, 0, 0); |
| 146 | else |
| 147 | ofSetColor(0, 255, 0); |
| 148 | ofRect(250, -10, (float)maxCost / entireFrameUs * (ofGetWidth() - 300) * .1f, 10); |
| 149 | |
| 150 | ofTranslate(0, 15); |
| 151 | } |
| 152 | ofPopStyle(); |
| 153 | ofPopMatrix(); |
| 154 | } |
| 155 | |
| 156 | //static |
| 157 | long Profiler::GetSafeFrameLengthNanoseconds() |
nothing calls this directly
no test coverage detected