BcmPort::BcmPort(BcmSwitch* hw, opennsl_port_t port, BcmPlatformPort* platformPort) : hw_(hw), port_(port), platformPort_(platformPort), unit_(hw->getUnit()) { // Obtain the gport handle from the port handle. int rv = opennsl_port_gport_get(unit_, port_, &gport_); bcmCheckError(rv, "Failed to get gport for BCM port ", port_); disablePause(); // Initialize our stats data structures auto statMap = fbData->getStatMap(); const auto expType = stats::AVG; outQueueLen_ = statMap->getLockAndStatItem(statName("out_queue_length"), &expType); auto histMap = fbData->getHistogramMap(); stats::ExportedHistogram pktLenHist(1, 0, kInPktLengthStats.size()); inPktLengths_ = histMap->getOrCreateUnlocked(statName("in_pkt_lengths"), &pktLenHist); outPktLengths_ = histMap->getOrCreateUnlocked(statName("out_pkt_lengths"), &pktLenHist); setConfiguredMaxSpeed(); VLOG(2) << "created BCM port:" << port_ << ", gport:" << gport_ << ", FBOSS PortID:" << platformPort_->getPortID(); }
void BcmPort::reinitPortStat(const string& statKey) { auto stat = getPortCounterIf(statKey); if (!stat) { portCounters_.emplace( statKey, MonotonicCounter({statName(statKey), stats::SUM, stats::RATE})); } else { MonotonicCounter newStat{statName(statKey), stats::SUM, stats::RATE}; stat->swap(newStat); } }
static void testSkpClip(TestState* data) { data->fResult.testOne(); SkString statName(data->fResult.fFilename); SkASSERT(statName.endsWith(".skp")); statName.remove(statName.size() - 4, 4); statName.appendf(".%d.%d.skp", data->fResult.fPixelError, data->fResult.fTime); SkString statusFile = get_out_path(data->fResult.fDirNo, outStatusDir); if (!statusFile.size()) { SkDebugf("failed to create %s", statusFile.c_str()); return; } statusFile.appendf("%s%s", PATH_SLASH, statName.c_str()); FILE* file = sk_fopen(statusFile.c_str(), kWrite_SkFILE_Flag); if (!file) { SkDebugf("failed to create %s", statusFile.c_str()); return; } sk_fclose(file); if (verbose()) { if (data->fResult.fPixelError || data->fResult.fTime) { SkDebugf("%s", data->fResult.progress().c_str()); } else { SkDebugf("."); } } }
void BcmPort::reinitPortStats() { if (!shouldReportStats()) { return; } reinitPortStat(kInBytes); reinitPortStat(kInUnicastPkts); reinitPortStat(kInMulticastPkts); reinitPortStat(kInBroadcastPkts); reinitPortStat(kInDiscards); reinitPortStat(kInErrors); reinitPortStat(kInPause); reinitPortStat(kInIpv4HdrErrors); reinitPortStat(kInIpv6HdrErrors); reinitPortStat(kInNonPauseDiscards); reinitPortStat(kOutBytes); reinitPortStat(kOutUnicastPkts); reinitPortStat(kOutMulticastPkts); reinitPortStat(kOutBroadcastPkts); reinitPortStat(kOutDiscards); reinitPortStat(kOutErrors); reinitPortStat(kOutPause); reinitPortStat(kOutCongestionDiscards); // (re) init out queue length auto statMap = fbData->getStatMap(); const auto expType = stats::AVG; outQueueLen_ = statMap->getLockableStat(statName("out_queue_length"), &expType); // (re) init histograms auto histMap = fbData->getHistogramMap(); stats::ExportedHistogram pktLenHist(1, 0, kInPktLengthStats.size()); inPktLengths_ = histMap->getOrCreateLockableHistogram( statName("in_pkt_lengths"), &pktLenHist); outPktLengths_ = histMap->getOrCreateLockableHistogram( statName("out_pkt_lengths"), &pktLenHist); }
Theory::Theory(TheoryId id, context::Context* satContext, context::UserContext* userContext, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, SmtGlobals* globals) throw() : d_id(id) , d_satContext(satContext) , d_userContext(userContext) , d_logicInfo(logicInfo) , d_facts(satContext) , d_factsHead(satContext, 0) , d_sharedTermsIndex(satContext, 0) , d_careGraph(NULL) , d_quantEngine(NULL) , d_checkTime(statName(id, "checkTime")) , d_computeCareGraphTime(statName(id, "computeCareGraphTime")) , d_sharedTerms(satContext) , d_out(&out) , d_valuation(valuation) , d_proofEnabled(false) , d_globals(globals) { smtStatisticsRegistry()->registerStat(&d_checkTime); smtStatisticsRegistry()->registerStat(&d_computeCareGraphTime); }