Now that fmt plays nice with gcc let's actually use it: replace std::to_string, boost lexical_cast and a couple miscellaneous llformats with fmt. (Alchemy sync-ish)

This commit is contained in:
Router Gray
2020-05-20 14:38:30 -05:00
parent 34a7ebf53f
commit 3e78b74474
31 changed files with 92 additions and 113 deletions

View File

@@ -73,7 +73,6 @@
#include "llxfermanager.h"
#include "timing.h"
#include "llquaternion.h"
#include "u64.h"
#include "v3dmath.h"
#include "v3math.h"
#include "v4math.h"
@@ -2600,54 +2599,54 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)
// Incoming
str << buffer << std::endl << "Incoming:" << std::endl;
tmp_str = U64_to_str(mTotalBytesIn);
tmp_str = fmt::to_string(mTotalBytesIn);
buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time);
str << buffer << std::endl;
tmp_str = U64_to_str(mPacketsIn);
tmp_str = fmt::to_string(mPacketsIn);
buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time));
str << buffer << std::endl;
buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn);
str << buffer << std::endl;
tmp_str = U64_to_str(mReliablePacketsIn);
tmp_str = fmt::to_string(mReliablePacketsIn);
buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1));
str << buffer << std::endl;
tmp_str = U64_to_str(mCompressedPacketsIn);
tmp_str = fmt::to_string(mCompressedPacketsIn);
buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1));
str << buffer << std::endl;
S64 savings = mUncompressedBytesIn - mCompressedBytesIn;
tmp_str = U64_to_str(savings);
tmp_str = fmt::to_string(savings);
buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1));
tmp_str = fmt::to_string(savings/(mCompressedPacketsIn +1));
buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1));
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mPacketsIn+1));
tmp_str = fmt::to_string(savings/(mPacketsIn+1));
buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f));
// Outgoing
str << buffer << std::endl << std::endl << "Outgoing:" << std::endl;
tmp_str = U64_to_str(mTotalBytesOut);
tmp_str = fmt::to_string(mTotalBytesOut);
buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time );
str << buffer << std::endl;
tmp_str = U64_to_str(mPacketsOut);
tmp_str = fmt::to_string(mPacketsOut);
buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time));
str << buffer << std::endl;
buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut);
str << buffer << std::endl;
tmp_str = U64_to_str(mReliablePacketsOut);
tmp_str = fmt::to_string(mReliablePacketsOut);
buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1));
str << buffer << std::endl;
tmp_str = U64_to_str(mCompressedPacketsOut);
tmp_str = fmt::to_string(mCompressedPacketsOut);
buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1));
str << buffer << std::endl;
savings = mUncompressedBytesOut - mCompressedBytesOut;
tmp_str = U64_to_str(savings);
tmp_str = fmt::to_string(savings);
buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1));
tmp_str = fmt::to_string(savings/(mCompressedPacketsOut +1));
buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1));
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mPacketsOut+1));
tmp_str = fmt::to_string(savings/(mPacketsOut+1));
buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f));
str << buffer << std::endl << std::endl;
buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount);