Skip to content

Commit

Permalink
logging for sendPacketCpuAndFrontPanel voq test
Browse files Browse the repository at this point in the history
Summary: As titled, logging for sendPacketCpuAndFrontPanel voq test. This helps catching regression when bcm runs the sanity tests.

Reviewed By: shri-khare

Differential Revision: D51293862

fbshipit-source-id: 684d356152207f61de840c512ce2b6d8f029455e
  • Loading branch information
srikrishnagopu authored and facebook-github-bot committed Nov 15, 2023
1 parent 5c42374 commit 3bd941a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fboss/agent/hw/test/HwVoqSwitchTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {
kDscpAclCounterName());
};

auto printQueueStats = [](std::string queueStatDesc,
std::string packetsOrBytes,
std::map<int16_t, int64_t> queueStatsMap) {
for (const auto& [queueId, pktsOrBytes] : queueStatsMap) {
XLOG(DBG2) << queueStatDesc << ": Queue ID: " << queueId << ", "
<< packetsOrBytes << ": " << pktsOrBytes;
}
};

int64_t beforeQueueOutPkts = 0, beforeQueueOutBytes = 0;
int64_t afterQueueOutPkts = 0, afterQueueOutBytes = 0;
int64_t beforeVoQOutBytes = 0, afterVoQOutBytes = 0;
Expand All @@ -534,10 +543,13 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {
auto beforeAllQueueOut = getAllQueueOutPktsBytes();
beforeQueueOutPkts = beforeAllQueueOut.first.at(kDefaultQueue);
beforeQueueOutBytes = beforeAllQueueOut.second.at(kDefaultQueue);
printQueueStats("Before Queue Out", "Packets", beforeAllQueueOut.first);
printQueueStats("Before Queue Out", "Bytes", beforeAllQueueOut.second);
}

auto beforeAllVoQOutBytes = getAllVoQOutBytes();
beforeVoQOutBytes = beforeAllVoQOutBytes.at(kDefaultQueue);
printQueueStats("Before VoQ Out", "Bytes", beforeAllVoQOutBytes);

auto [beforeOutPkts, beforeOutBytes] = getPortOutPktsBytes();
auto beforeAclPkts =
Expand All @@ -554,6 +566,8 @@ TEST_F(HwVoqSwitchTest, sendPacketCpuAndFrontPanel) {
maxRetryCount, std::chrono::milliseconds(sleepTimeMsecs), {
auto afterAllVoQOutBytes = getAllVoQOutBytes();
afterVoQOutBytes = afterAllVoQOutBytes.at(kDefaultQueue);
printQueueStats("After VoQ Out", "Bytes", afterAllVoQOutBytes);

if (getAsic()->isSupported(HwAsic::Feature::L3_QOS)) {
auto afterAllQueueOut = getAllQueueOutPktsBytes();
afterQueueOutPkts = afterAllQueueOut.first.at(kDefaultQueue);
Expand Down

0 comments on commit 3bd941a

Please sign in to comment.