API: When combining histogram, return zeroed histogram on empty

This change make sure that when there are no results (ie. all the
histogram that are summed are empty) the return result will be a zerroed
histogram and not an empty object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman
2015-08-06 12:53:41 +03:00
parent 4329377556
commit 17ebebf268

View File

@@ -111,13 +111,13 @@ inline double pow2(double a) {
inline httpd::utils_json::histogram add_histogram(httpd::utils_json::histogram res,
const utils::ihistogram& val) {
if (val.count == 0) {
return res;
}
if (!res.count._set) {
res = val;
return res;
}
if (val.count == 0) {
return res;
}
if (res.min() > val.min) {
res.min = val.min;
}