4
4
5
5
/* Global map with FlexCounter instances for different polling interval */
6
6
static std::map<std::string, std::shared_ptr<FlexCounter>> g_flex_counters_map;
7
-
7
+ // List with supported counters
8
+ static std::set<sai_port_stat_t > supportedPortCounters;
9
+ static std::set<sai_queue_stat_t > supportedQueueCounters;
8
10
9
11
FlexCounter::PortCounterIds::PortCounterIds (
10
12
_In_ sai_object_id_t port,
@@ -56,7 +58,7 @@ void FlexCounter::setPortCounterList(
56
58
FlexCounter &fc = getInstance (instanceId);
57
59
58
60
// Initialize the supported counters list before setting
59
- if (fc. m_supportedPortCounters .size () == 0 )
61
+ if (supportedPortCounters .size () == 0 )
60
62
{
61
63
fc.saiUpdateSupportedPortCounters (portId);
62
64
}
@@ -352,14 +354,14 @@ bool FlexCounter::isPortCounterSupported(sai_port_stat_t counter) const
352
354
{
353
355
SWSS_LOG_ENTER ();
354
356
355
- return m_supportedPortCounters .count (counter) != 0 ;
357
+ return supportedPortCounters .count (counter) != 0 ;
356
358
}
357
359
358
360
bool FlexCounter::isQueueCounterSupported (sai_queue_stat_t counter) const
359
361
{
360
362
SWSS_LOG_ENTER ();
361
363
362
- return m_supportedQueueCounters .count (counter) != 0 ;
364
+ return supportedQueueCounters .count (counter) != 0 ;
363
365
}
364
366
365
367
FlexCounter::FlexCounter (std::string instanceId) : m_instanceId(instanceId)
@@ -654,7 +656,7 @@ void FlexCounter::saiUpdateSupportedPortCounters(sai_object_id_t portId)
654
656
continue ;
655
657
}
656
658
657
- m_supportedPortCounters .insert (counter);
659
+ supportedPortCounters .insert (counter);
658
660
}
659
661
}
660
662
@@ -665,7 +667,7 @@ void FlexCounter::saiUpdateSupportedQueueCounters(
665
667
SWSS_LOG_ENTER ();
666
668
667
669
uint64_t value;
668
- m_supportedQueueCounters .clear ();
670
+ supportedQueueCounters .clear ();
669
671
670
672
for (auto &counter : counterIds)
671
673
{
@@ -682,7 +684,7 @@ void FlexCounter::saiUpdateSupportedQueueCounters(
682
684
}
683
685
else
684
686
{
685
- m_supportedQueueCounters .insert (counter);
687
+ supportedQueueCounters .insert (counter);
686
688
}
687
689
}
688
690
}
0 commit comments