void ProfileNode::endAndRecordCall() { Call& last = lastCall(); ASSERT(isnan(last.totalTime())); last.setTotalTime(currentTime() - last.startTime()); m_totalTime += last.totalTime(); }
void Landlord::run() { ostringstream temp; temp << "Landlord got to work."; log(name, temp.str()); //greet and bartend until its time for last call while (!bLastCall) { greet(); bartend(); } //inform everyone in the bar of last call lastCall(); //continue to greek and bartend until only the barmaid and assistant are left while (!numPeopleInBar(2)) { greet(); bartend(); } //tell assistant and barmaid to close up for (map<int, Person*>::iterator it=people_in_bar.begin() ; it != people_in_bar.end(); it++ ) ((*it).second)->closeUp(); //say goodbye to employees until the bar is empty while (!numPeopleInBar(0)) { greet(); } string msg = "Clocking out."; log(name, msg); pthread_exit(NULL); }