Skip to content

Commit

Permalink
Merge pull request #35362 from Dr15Jones/fixStatisticsSenderService
Browse files Browse the repository at this point in the history
Protect storage accounting UDP messages from NaN
  • Loading branch information
cmsbuild authored Sep 25, 2021
2 parents ac2754c + 1c36203 commit 2ae6e5d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Utilities/StorageFactory/src/StatisticsSenderService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ void StatisticsSenderService::FileStatistics::fillUDP(std::ostringstream &os) {
double single_sum = read_single_bytes - m_read_single_bytes;
double single_average = single_sum / static_cast<double>(single_op_count);
os << "\"read_single_sigma\":"
<< sqrt((static_cast<double>(read_single_square - m_read_single_square) -
single_average * single_average * single_op_count) /
static_cast<double>(single_op_count))
<< sqrt(std::abs((static_cast<double>(read_single_square - m_read_single_square) -
single_average * single_average * single_op_count) /
static_cast<double>(single_op_count)))
<< ", ";
os << "\"read_single_average\":" << single_average << ", ";
}
Expand All @@ -90,17 +90,17 @@ void StatisticsSenderService::FileStatistics::fillUDP(std::ostringstream &os) {
static_cast<double>(read_vector_bytes - m_read_vector_bytes) / static_cast<double>(vector_op_count);
os << "\"read_vector_average\":" << vector_average << ", ";
os << "\"read_vector_sigma\":"
<< sqrt((static_cast<double>(read_vector_square - m_read_vector_square) -
vector_average * vector_average * vector_op_count) /
static_cast<double>(vector_op_count))
<< sqrt(std::abs((static_cast<double>(read_vector_square - m_read_vector_square) -
vector_average * vector_average * vector_op_count) /
static_cast<double>(vector_op_count)))
<< ", ";
double vector_count_average =
static_cast<double>(read_vector_count_sum - m_read_vector_count_sum) / static_cast<double>(vector_op_count);
os << "\"read_vector_count_average\":" << vector_count_average << ", ";
os << "\"read_vector_count_sigma\":"
<< sqrt((static_cast<double>(read_vector_count_square - m_read_vector_count_square) -
vector_count_average * vector_count_average * vector_op_count) /
static_cast<double>(vector_op_count))
<< sqrt(std::abs((static_cast<double>(read_vector_count_square - m_read_vector_count_square) -
vector_count_average * vector_count_average * vector_op_count) /
static_cast<double>(vector_op_count)))
<< ", ";
}
m_read_vector_square = read_vector_square;
Expand Down

0 comments on commit 2ae6e5d

Please sign in to comment.