77
88#include " UcacheBenchClient.h"
99
10+ #include < fmt/format.h>
1011#include < netdb.h>
1112#include < sys/socket.h>
1213#include < unistd.h>
@@ -607,7 +608,7 @@ UcacheBenchClient::UcacheBenchClient() {
607608 // Build pool config with optional additional_fanout for high connection count
608609 std::string poolConfig;
609610 if (effectiveAdditionalFanout > 0 ) {
610- poolConfig = folly::sformat (
611+ poolConfig = fmt::format (
611612 R"json( {{
612613 "pools": {{
613614 "ucache_pool": {{
@@ -631,7 +632,7 @@ UcacheBenchClient::UcacheBenchClient() {
631632 FLAGS_send_timeout_ms,
632633 effectiveAdditionalFanout);
633634 } else {
634- poolConfig = folly::sformat (
635+ poolConfig = fmt::format (
635636 R"json( {{
636637 "pools": {{
637638 "ucache_pool": {{
@@ -1131,7 +1132,7 @@ UcacheBenchClient::WarmupResults UcacheBenchClient::warmup() {
11311132
11321133 if (FLAGS_enable_random_source_ip) {
11331134 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
1134- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
1135+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
11351136 try {
11361137 folly::IPAddress sourceIp (ipStr);
11371138 request.setSourceIpAddr (sourceIp);
@@ -1652,7 +1653,7 @@ UcacheBenchClient::BenchmarkResults UcacheBenchClient::runBenchmark() {
16521653
16531654 if (FLAGS_enable_random_source_ip) {
16541655 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
1655- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
1656+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
16561657 try {
16571658 folly::IPAddress sourceIp (ipStr);
16581659 request.setSourceIpAddr (sourceIp);
@@ -1712,7 +1713,7 @@ UcacheBenchClient::BenchmarkResults UcacheBenchClient::runBenchmark() {
17121713
17131714 if (FLAGS_enable_random_source_ip) {
17141715 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
1715- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
1716+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
17161717 try {
17171718 folly::IPAddress sourceIp (ipStr);
17181719 setRequest.setSourceIpAddr (sourceIp);
@@ -1777,7 +1778,7 @@ UcacheBenchClient::BenchmarkResults UcacheBenchClient::runBenchmark() {
17771778
17781779 if (FLAGS_enable_random_source_ip) {
17791780 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
1780- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
1781+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
17811782 try {
17821783 folly::IPAddress sourceIp (ipStr);
17831784 request.setSourceIpAddr (sourceIp);
@@ -2131,7 +2132,7 @@ std::string UcacheBenchClient::generateKey() {
21312132 : distribution_.setKeySizeAvg ;
21322133
21332134 // Generate key with approximately the right size
2134- std::string baseKey = folly::sformat (" key_{:08d}" , keyId);
2135+ std::string baseKey = fmt::format (" key_{:08d}" , keyId);
21352136
21362137 // Pad or trim to match average key size
21372138 int32_t targetSize = static_cast <int32_t >(avgKeySize);
@@ -2153,7 +2154,7 @@ std::string UcacheBenchClient::generateKey() {
21532154 }
21542155
21552156 // Default behavior: fixed format key
2156- return folly::sformat (" key_{:08d}" , keyId);
2157+ return fmt::format (" key_{:08d}" , keyId);
21572158}
21582159
21592160std::string UcacheBenchClient::generateValue () {
@@ -2214,7 +2215,7 @@ void UcacheBenchClient::sendUcbGetRequestSync(
22142215 // Generate a random IPv6 address in the format ::ffff:192.0.2.X
22152216 // Using IPv4-mapped IPv6 addresses for simplicity
22162217 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
2217- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
2218+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
22182219 try {
22192220 folly::IPAddress sourceIp (ipStr);
22202221 request.setSourceIpAddr (sourceIp);
@@ -2266,7 +2267,7 @@ void UcacheBenchClient::sendUcbSetRequestSync(
22662267 // Generate a random IPv6 address in the format ::ffff:192.0.2.X
22672268 // Using IPv4-mapped IPv6 addresses for simplicity
22682269 uint8_t randomOctet = folly::Random::rand32 (1 , 255 );
2269- std::string ipStr = folly::sformat (" ::ffff:192.0.2.{}" , randomOctet);
2270+ std::string ipStr = fmt::format (" ::ffff:192.0.2.{}" , randomOctet);
22702271 try {
22712272 folly::IPAddress sourceIp (ipStr);
22722273 request.setSourceIpAddr (sourceIp);
@@ -2408,7 +2409,7 @@ void UcacheBenchClient::loadTrafficDistribution(const std::string& configFile) {
24082409 std::ifstream file (configFile);
24092410 if (!file.is_open ()) {
24102411 throw std::runtime_error (
2411- folly::sformat (" Failed to open distribution config: {}" , configFile));
2412+ fmt::format (" Failed to open distribution config: {}" , configFile));
24122413 }
24132414
24142415 std::string content (
@@ -2420,7 +2421,7 @@ void UcacheBenchClient::loadTrafficDistribution(const std::string& configFile) {
24202421 config = folly::parseJson (content);
24212422 } catch (const std::exception& e) {
24222423 throw std::runtime_error (
2423- folly::sformat (" Failed to parse JSON config: {}" , e.what ()));
2424+ fmt::format (" Failed to parse JSON config: {}" , e.what ()));
24242425 }
24252426
24262427 // Load configuration values
0 commit comments