From 37e6ace2c8f49d85a0d71883d280c456a8b45784 Mon Sep 17 00:00:00 2001 From: liuyifei Date: Mon, 6 Jan 2025 08:22:39 +0000 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuyifei --- frameworks/libhilog/utils/log_utils.cpp | 8 ++++---- services/hilogd/log_stats.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/libhilog/utils/log_utils.cpp b/frameworks/libhilog/utils/log_utils.cpp index be9ab9f..0e3d8d1 100644 --- a/frameworks/libhilog/utils/log_utils.cpp +++ b/frameworks/libhilog/utils/log_utils.cpp @@ -86,7 +86,7 @@ uint64_t Str2Size(const string& str) uint64_t index = str.size() - 1; uint64_t unit = g_SizeMap.GetValue(str[index]); - uint64_t value = stoull(str.substr(0, unit !=0 ? index : index + 1)); + uint64_t value = stoull(str.substr(0, unit != 0 ? index : index + 1)); return value * (unit != 0 ? unit : 1); } @@ -337,21 +337,21 @@ uint32_t GetBitsCount(uint64_t n) uint32_t count = 0; while (n != 0) { ++count; - n = n & (n-1); + n = n & (n - 1); } return count; } uint16_t GetBitPos(uint64_t n) { - if (!(n && (!(n & (n-1))))) { // only accpet the number which is power of 2 + if (!(n && (!(n & (n - 1))))) { // only accpet the number which is power of 2 return 0; } uint16_t i = 0; while (n >> (i++)) {} i--; - return i-1; + return i - 1; } enum class Radix { diff --git a/services/hilogd/log_stats.cpp b/services/hilogd/log_stats.cpp index c624610..fa18166 100644 --- a/services/hilogd/log_stats.cpp +++ b/services/hilogd/log_stats.cpp @@ -32,7 +32,7 @@ LogStats::LogStats() } LogStats::~LogStats() {} -static inline int idxLvl(uint16_t lvl) +static inline int IdxLvl(uint16_t lvl) { return static_cast(lvl) - LevelBase; } @@ -63,7 +63,7 @@ static void UpdateStats(StatsEntry &entry, const StatsInfo &info) entry.monoTimeAuditStart.SetTimeStamp(info.mono_sec, info.tv_nsec); } - int lvl = idxLvl(info.level); + int lvl = IdxLvl(info.level); entry.lines[lvl]++; entry.len[lvl] += info.len; entry.dropped += info.dropped; @@ -110,7 +110,7 @@ static void StatsInfo2NewStatsEntry(const StatsInfo &info, StatsEntry &entry) for (uint64_t &i : entry.len) { i = 0; } - int lvl = idxLvl(info.level); + int lvl = IdxLvl(info.level); entry.lines[lvl] = 1; entry.len[lvl] = info.len; } @@ -178,7 +178,7 @@ void LogStats::Count(const StatsInfo &info) { if (enable) { std::scoped_lock lk(lock); - int index = idxLvl(info.level); + int index = IdxLvl(info.level); totalLines[index]++; totalLens[index] += info.len; UpdateDomainTable(info); -- Gitee