You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for saiplayer bulk API and add performance timers (sonic-net#666)
* [sairedis] Add PerformanceIntervalTimer class
* [sairedis] Add deserialize tests
* [sairedis] Add performance timer to route_entry bulk create
* [sairedis] Add PerformanceIntervalTimer class to makefile
* [saiplayer] Add support for bulk generic API and bulk route_entry
* [vs] Add performance timer for route_entry create API
* [syncd] Fix for ZeroMQSelectableChannel thread join
* [syncd] Add performance timers to syncd route_entry create and db
auto ccc = ContextConfigContainer::loadFromFile("context_config.json");
665
723
}
666
724
725
+
static std::vector<std::string> tokenize(
726
+
_In_ std::string input,
727
+
_In_ const std::string &delim)
728
+
{
729
+
SWSS_LOG_ENTER();
730
+
731
+
/*
732
+
* input is modified so it can't be passed as reference
733
+
*/
734
+
735
+
std::vector<std::string> tokens;
736
+
737
+
size_t pos = 0;
738
+
739
+
while ((pos = input.find(delim)) != std::string::npos)
740
+
{
741
+
std::string token = input.substr(0, pos);
742
+
743
+
input.erase(0, pos + delim.length());
744
+
tokens.push_back(token);
745
+
}
746
+
747
+
tokens.push_back(input);
748
+
749
+
return tokens;
750
+
}
751
+
752
+
staticsai_object_type_tdeserialize_object_type(
753
+
_In_ const std::string& s)
754
+
{
755
+
SWSS_LOG_ENTER();
756
+
757
+
sai_object_type_t object_type;
758
+
759
+
sai_deserialize_object_type(s, object_type);
760
+
761
+
return object_type;
762
+
}
763
+
764
+
voidtest_tokenize_bulk_route_entry()
765
+
{
766
+
SWSS_LOG_ENTER();
767
+
768
+
auto header = "2020-09-24.21:06:54.045505|C|SAI_OBJECT_TYPE_ROUTE_ENTRY";
769
+
auto route = "||{\"dest\":\"20c1:bb0:0:80::/64\",\"switch_id\":\"oid:0x21000000000000\",\"vr\":\"oid:0x3000000000022\"}|SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID=oid:0x500000000066c";
770
+
771
+
std::string line = header;
772
+
773
+
int per = 100;
774
+
775
+
for (int i = 0; i < per; i++)
776
+
{
777
+
line += route;
778
+
}
779
+
780
+
auto tstart = std::chrono::high_resolution_clock::now();
781
+
782
+
int n = 1000;
783
+
784
+
for (int c = 0; c < n; c++)
785
+
{
786
+
auto fields = tokenize(line, "||");
787
+
788
+
auto first = fields.at(0); // timestamp|action|objecttype
0 commit comments