Exemplo n.º 1
0
    void
        Dashboard::printTimers(Table & theTable, TimerPtr theParent, const std::string & theIndent) {

            for (unsigned i = 0; i < _mySortedTimers.size(); ++i) {
                std::string & myTimerName = _mySortedTimers[i].first;
                TimerPtr myTimerPtr       = _mySortedTimers[i].second;

                if (myTimerPtr->getParent() == theParent) {
                    theTable.addRow();
                    theTable.setField("timername", theIndent + myTimerName);
                    unsigned long myCycleCount = _myGroupCounters[myTimerPtr->getGroup()].getCount();
                    if (myCycleCount) {
                        const asl::Timer & myTimer = _myCompleteCycleTimers[myTimerName];
                        theTable.setField("elapsed",as_string((double)(myTimer.getElapsed().micros())/1000.0/myCycleCount));
                        const asl::Counter & myCounter = myTimer.getCounter();
                        if (myCounter.getCount()>1) {
                            theTable.setField("intervals",as_string((myCounter.getCount()+1.0)/myCycleCount));
                            theTable.setField("persec",as_string(myCounter.getCount()/myTimer.getElapsed().seconds()));
                            theTable.setField("average",as_string(myTimer.getElapsed().micros()/1000.0/myCounter.getCount()));
                            theTable.setField("minimum",as_string(myTimer.getMin().micros()/1000.0));
                            theTable.setField("maximum",as_string(myTimer.getMax().micros()/1000.0));
                            theTable.setField("cycles",as_string(myCycleCount));
                        }
                    } else {
                        const asl::Timer & myTimer = *myTimerPtr;
                        const asl::Counter & myCounter = myTimer.getCounter();
                        theTable.setField("elapsed",as_string((double)(myTimer.getElapsed().micros())/1000.0));
                        if (myCounter.getCount()>1) {
                            theTable.setField("intervals",as_string(myCounter.getCount()));
                            theTable.setField("persec",as_string(myCounter.getCount()/myTimer.getElapsed().seconds()));
                            theTable.setField("average",as_string(myTimer.getElapsed().micros()/1000.0));
                        }
                        theTable.setField("cycles","incomplete");
                    }
                    printTimers(theTable, myTimerPtr, theIndent+"  ");
                }
            }
    }