void PerfGraph::printHeaviestSections(const ConsoleStream & console, const unsigned int num_sections) { updateTiming(); console << "\nHeaviest Sections:\n"; // Indirect Sort The Self Time std::vector<size_t> sorted; Moose::indirectSort(_section_time_ptrs.begin(), _section_time_ptrs.end(), sorted, [](SectionTime * lhs, SectionTime * rhs) { if (lhs && rhs) return lhs->_self > rhs->_self; // If the LHS exists - it's definitely bigger than a non-existant RHS if (lhs) return true; // Both don't exist - so it doesn't matter how we sort them return false; }); HeaviestTable vtable({"Section", "Calls", "Self(s)", "Avg.", "%"}, 10); vtable.setColumnFormat({VariadicTableColumnFormat::AUTO, // Doesn't matter VariadicTableColumnFormat::AUTO, VariadicTableColumnFormat::FIXED, VariadicTableColumnFormat::FIXED, VariadicTableColumnFormat::PERCENT}); vtable.setColumnPrecision({1, 1, 3, 3, 2}); mooseAssert(!_section_time_ptrs.empty(), "updateTiming() must be run before printHeaviestSections()!"); // The total time of the root node auto total_root_time = _section_time_ptrs[0]->_total; // Now print out the largest ones for (unsigned int i = 0; i < num_sections; i++) { auto id = sorted[i]; vtable.addRow(_id_to_section_name[id], _section_time_ptrs[id]->_num_calls, _section_time_ptrs[id]->_self, _section_time_ptrs[id]->_self / static_cast<Real>(_section_time_ptrs[id]->_num_calls), 100 * _section_time_ptrs[id]->_self / total_root_time); } vtable.print(console); }
bool MC6845::init() { OECheckComponent(controlBus); OECheckComponent(floatingBus); controlBus->postMessage(this, CONTROLBUS_GET_POWERSTATE, &powerState); updateTiming(); return true; }
unsigned long int PerfGraph::getNumCalls(const std::string & section_name) { updateTiming(); auto section_it = _section_time.find(section_name); if (section_it == _section_time.end()) mooseError("Unknown section_name: ", section_name, " in PerfGraph::getNumCalls() "); return section_it->second._num_calls; }
Real PerfGraph::getTime(const TimeType type, const std::string & section_name) { updateTiming(); auto section_it = _section_time.find(section_name); if (section_it == _section_time.end()) mooseError("Unknown section_name: ", section_name, " in PerfGraph::getTime() "); auto app_time = _section_time_ptrs[0]->_total; switch (type) { case SELF: return section_it->second._self; case CHILDREN: return section_it->second._children; case TOTAL: return section_it->second._total; case SELF_AVG: return section_it->second._self / static_cast<Real>(section_it->second._num_calls); case CHILDREN_AVG: return section_it->second._children / static_cast<Real>(section_it->second._num_calls); case TOTAL_AVG: return section_it->second._total / static_cast<Real>(section_it->second._num_calls); case SELF_PERCENT: return 100. * (section_it->second._self / app_time); case CHILDREN_PERCENT: return 100. * (section_it->second._children / app_time); case TOTAL_PERCENT: return 100. * (section_it->second._total / app_time); default: ::mooseError("Unknown TimeType"); } }
void PerfGraph::printHeaviestBranch(const ConsoleStream & console) { updateTiming(); console << "\nHeaviest Branch:\n"; FullTable vtable({"Section", "Calls", "Self(s)", "Avg(s)", "%", "Children(s)", "Avg(s)", "%", "Total(s)", "Avg(s)", "%"}, 10); vtable.setColumnFormat({VariadicTableColumnFormat::AUTO, // Section Name VariadicTableColumnFormat::AUTO, // Calls VariadicTableColumnFormat::FIXED, // Self VariadicTableColumnFormat::FIXED, // Avg. VariadicTableColumnFormat::PERCENT, // % VariadicTableColumnFormat::FIXED, // Children VariadicTableColumnFormat::FIXED, // Avg. VariadicTableColumnFormat::PERCENT, // % VariadicTableColumnFormat::FIXED, // Total VariadicTableColumnFormat::FIXED, // Avg. VariadicTableColumnFormat::PERCENT}); // % vtable.setColumnPrecision({1, 0, 3, 3, 2, 3, 3, 2, 3, 3, 2}); recursivelyPrintHeaviestGraph(_root_node.get(), vtable); vtable.print(console); }
void MC6845::write(OEAddress address, OEChar value) { if (!(address & 0x1)) { addressRegister = value & 0x1f; return; } switch (addressRegister) { case MC6845_HORIZTOTAL: horizTotal = value + 1; updateTiming(); break; case MC6845_HORIZDISPLAYED: horizDisplayed = value; updateTiming(); break; case MC6845_HORIZSYNCPOSITION: horizSyncPosition = value; updateTiming(); break; case MC6845_HORIZSYNCWIDTH: horizSyncWidth = value & 0x0f; break; case MC6845_VERTTOTAL: vertTotalCell = (value & 0x7f) + 1; updateTiming(); break; case MC6845_VERTTOTALADJUST: vertTotalAdjust = value & 0x1f; updateTiming(); break; case MC6845_VERTDISPLAYED: vertDisplayedCell = value & 0x7f; updateTiming(); break; case MC6845_VERTSYNCPOSITION: vertSyncPositionCell = value & 0x7f; updateTiming(); break; case MC6845_MODECONTROL: modeControl = value & 0x03; updateTiming(); break; case MC6845_SCANLINE: scanline = (value & 0x1f) + 1; updateTiming(); break; case MC6845_CURSORSTART: refreshVideo(); setCursorStart(value); break; case MC6845_CURSOREND: refreshVideo(); cursorEnd = value & 0x1f; break; case MC6845_STARTADDRESSHIGH: refreshVideo(); startAddress.b.h = value & 0x3f; break; case MC6845_STARTADDRESSLOW: refreshVideo(); startAddress.b.l = value & 0xff; break; case MC6845_CURSORADDRESSHIGH: refreshVideo(); cursorAddress.b.h = value & 0x3f; break; case MC6845_CURSORADDRESSLOW: refreshVideo(); cursorAddress.b.l = value & 0xff; break; } }
void counter::updateSystem(void) {checkTiming() ? (updateTiming(), updateInc(count), updateCount(reset)) : updateCount(inc);}