提交 e21b86e4 authored 作者: José Luis Millán's avatar José Luis Millán

Score: pretify logs

上级 67698cd8
...@@ -432,14 +432,24 @@ namespace RTC ...@@ -432,14 +432,24 @@ namespace RTC
} }
} }
// MS_ERROR( #ifdef MS_LOG_DEV
// "fixed values [expected:%" PRIu32 ",received:%" PRIu32 ", lost:%" PRIu32 ", repaired:%" PRIu32 MS_DEBUG_TAG(
// ", retransmitted:%" PRIu32, score,
// expected, "[totalExpected:%" PRIu32 ", totalReceived:%zu, totalRepaired:%zu",
// received, totalExpected,
// lost, totalReceived,
// repaired, totalRepaired);
// retransmitted);
MS_DEBUG_TAG(
score,
"fixed values [expected:%" PRIu32 ", received:%" PRIu32 ", lost:%" PRIu32
", repaired:%" PRIu32 ", retransmitted:%" PRIu32,
expected,
received,
lost,
repaired,
retransmitted);
#endif
float repairedRatio = static_cast<float>(repaired) / static_cast<float>(received); float repairedRatio = static_cast<float>(repaired) / static_cast<float>(received);
auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4); auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4);
...@@ -451,32 +461,18 @@ namespace RTC ...@@ -451,32 +461,18 @@ namespace RTC
lost -= repaired * repairedWeight; lost -= repaired * repairedWeight;
// MS_ERROR(
// "[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]",
// repairedRatio,
// repairedWeight,
// lost);
float deliveredRatio = static_cast<float>(received - lost) / static_cast<float>(received); float deliveredRatio = static_cast<float>(received - lost) / static_cast<float>(received);
auto score = std::round(std::pow(deliveredRatio, 4) * 10); auto score = std::round(std::pow(deliveredRatio, 4) * 10);
// MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score);
// MS_ERROR("==========\n");
#ifdef MS_LOG_DEV #ifdef MS_LOG_DEV
MS_DEBUG_TAG( MS_DEBUG_TAG(
score, score,
"[totalExpected:%" PRIu32 ", totalReceived:%zu, totalRepaired:%zu, expected:%" PRIu32 "[deliveredRatio:%f, repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 ", score: %lf]",
", received:%" PRIu32 ", repaired:%" PRIu32 ", lossPercentage:%f, score:%" PRIu8 "]", deliveredRatio,
totalExpected, repairedRatio,
totalReceived, repairedWeight,
totalRepaired, lost,
expected,
received,
repaired,
lossPercentage,
score); score);
#endif #endif
......
...@@ -555,12 +555,22 @@ namespace RTC ...@@ -555,12 +555,22 @@ namespace RTC
} }
} }
// MS_ERROR( #ifdef MS_LOG_DEV
// "fixed values [sent:%zu, lost:%" PRIu32 ", repaired:%" PRIu32 ", retransmitted:%" PRIu32, MS_DEBUG_TAG(
// sent, score,
// lost, "[totalSent:%zu, totalLost:%" PRIi32 ", totalRepaired:%zu",
// repaired, totalSent,
// retransmitted); totalLost,
totalRepaired);
MS_DEBUG_TAG(
score,
"fixed values [sent:%zu, lost:%" PRIu32 ", repaired:%" PRIu32 ", retransmitted:%" PRIu32,
sent,
lost,
repaired,
retransmitted);
#endif
float repairedRatio = static_cast<float>(repaired) / static_cast<float>(sent); float repairedRatio = static_cast<float>(repaired) / static_cast<float>(sent);
auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4); auto repairedWeight = std::pow(1 / (repairedRatio + 1), 4);
...@@ -572,30 +582,18 @@ namespace RTC ...@@ -572,30 +582,18 @@ namespace RTC
lost -= repaired * repairedWeight; lost -= repaired * repairedWeight;
// MS_ERROR(
// "[repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 "]",
// repairedRatio,
// repairedWeight,
// lost);
float deliveredRatio = static_cast<float>(sent - lost) / static_cast<float>(sent); float deliveredRatio = static_cast<float>(sent - lost) / static_cast<float>(sent);
auto score = std::round(std::pow(deliveredRatio, 4) * 10); auto score = std::round(std::pow(deliveredRatio, 4) * 10);
// MS_ERROR("RESULT [deliveredRatio:%f, score:%f]", deliveredRatio, score);
// MS_ERROR("++++++++++\n");
#ifdef MS_LOG_DEV #ifdef MS_LOG_DEV
MS_DEBUG_TAG( MS_DEBUG_TAG(
score, score,
"[totalSent:%zu, totalLost:%" PRIi32 ", totalRepaired:%zu, repaired:%" PRIu32 "[deliveredRatio:%f, repairedRatio:%f, repairedWeight:%f, new lost:%" PRIu32 ", score: %lf]",
", lossPercentage:%f, score:%" PRIu8 "]", deliveredRatio,
totalSent, repairedRatio,
totalLost, repairedWeight,
totalRepaired, lost,
repaired,
lossPercentage,
score); score);
report->Dump(); report->Dump();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论