Skip to content

Commit

Permalink
Use callback to initialize the histogram
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/fb303#56

Removing expensive unused temporary.

Reviewed By: ot

Differential Revision: D61207391

fbshipit-source-id: 6a3c83358b879be68956a9adf9f1a8abce598ddf
  • Loading branch information
DenisYaroshevskiy authored and facebook-github-bot committed Aug 15, 2024
1 parent 8f6e4d6 commit d5e00ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fboss/agent/hw/bcm/BcmPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,13 @@ void BcmPort::reinitPortStatsLocked(
statName("out_queue_length", portName), &expType);
// (re) init histograms
auto histMap = fb303::fbData->getHistogramMap();
fb303::ExportedHistogram pktLenHist(1, 0, kInPktLengthStats.size());
auto makeLenHist = [] {
return fb303::ExportedHistogram(1, 0, kInPktLengthStats.size());
};
inPktLengths_ = histMap->getOrCreateLockableHistogram(
statName("in_pkt_lengths", portName), &pktLenHist);
statName("in_pkt_lengths", portName), makeLenHist);
outPktLengths_ = histMap->getOrCreateLockableHistogram(
statName("out_pkt_lengths", portName), &pktLenHist);
statName("out_pkt_lengths", portName), makeLenHist);

*lockedPortStatsPtr =
BcmPortStats(queueManager_->getNumQueues(cfg::StreamType::UNICAST));
Expand Down

0 comments on commit d5e00ce

Please sign in to comment.