Changeset 2553 for code/branches/presentation/src/orxonox/gamestates
- Timestamp:
- Dec 30, 2008, 8:02:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/orxonox/gamestates/GSRoot.cc
r2550 r2553 223 223 224 224 // STATISTICS 225 statisticsTickInfo tickInfo = {timeAfterTick, timeAfterTick - timeBeforeTick}; 225 uint32_t currentTickTime = timeAfterTick - timeBeforeTick; 226 statisticsTickInfo tickInfo = {timeAfterTick, currentTickTime}; 226 227 statisticsTickTimes_.push_back(tickInfo); 227 228 … … 233 234 if (timeAfterTick > statisticsStartTime_ + statisticsRefreshCycle_) 234 235 { 235 while (statisticsTickTimes_.front().tickTime < timeAfterTick - statisticsAvgLength_) 236 std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin(); 237 assert(it != this->statisticsTickTimes_.end()); 238 uint64_t lastTime = timeAfterTick - statisticsAvgLength_; 239 if (it->tickTime < lastTime) 236 240 { 237 this->periodTickTime_ -= this->statisticsTickTimes_.front().tickLength; 238 this->statisticsTickTimes_.pop_front(); 241 do 242 { 243 this->periodTickTime_ -= it->tickLength; 244 ++it; 245 assert(it != this->statisticsTickTimes_.end()); 246 } while (it->tickTime < lastTime); 247 this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), --it); 239 248 } 240 249 241 250 uint32_t framesPerPeriod = this->statisticsTickTimes_.size(); 242 this->avgFPS_ = (float)framesPerPeriod / ( tickInfo.tickTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0;251 this->avgFPS_ = (float)framesPerPeriod / (currentTickTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0; 243 252 this->avgTickTime_ = (float)this->periodTickTime_ / framesPerPeriod / 1000.0; 244 253
Note: See TracChangeset
for help on using the changeset viewer.