mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-18 12:55:25 +01:00
Fix various performance issues reported by cppcheck (#5628)
* Also remove 1 non declared but defined functions
This commit is contained in:
@@ -930,7 +930,7 @@ void Peer::DecUseCount()
|
||||
delete this;
|
||||
}
|
||||
|
||||
void Peer::RTTStatistics(float rtt, std::string profiler_id,
|
||||
void Peer::RTTStatistics(float rtt, const std::string &profiler_id,
|
||||
unsigned int num_samples) {
|
||||
|
||||
if (m_last_rtt > 0) {
|
||||
@@ -969,8 +969,7 @@ void Peer::RTTStatistics(float rtt, std::string profiler_id,
|
||||
m_rtt.jitter_avg = m_rtt.jitter_avg * (num_samples/(num_samples-1)) +
|
||||
jitter * (1/num_samples);
|
||||
|
||||
if (profiler_id != "")
|
||||
{
|
||||
if (profiler_id != "") {
|
||||
g_profiler->graphAdd(profiler_id + "_rtt", rtt);
|
||||
g_profiler->graphAdd(profiler_id + "_jitter", jitter);
|
||||
}
|
||||
|
||||
@@ -732,8 +732,8 @@ class Peer {
|
||||
virtual void reportRTT(float rtt) {};
|
||||
|
||||
void RTTStatistics(float rtt,
|
||||
std::string profiler_id="",
|
||||
unsigned int num_samples=1000);
|
||||
const std::string &profiler_id = "",
|
||||
unsigned int num_samples = 1000);
|
||||
|
||||
bool IncUseCount();
|
||||
void DecUseCount();
|
||||
|
||||
Reference in New Issue
Block a user