Enlarge statistics variables from 32 to 64 bit

Apparently at least the epoll cycles can wrap. Also use
integer types of explicit size.
This commit is contained in:
Johan Wikman
2016-09-07 10:40:06 +03:00
parent ce0b82ef25
commit 58a8bdd4ab
3 changed files with 35 additions and 32 deletions

View File

@ -58,7 +58,7 @@ void ts_stats_end()
ts_stats_t ts_stats_alloc()
{
ss_dassert(stats_initialized);
return MXS_CALLOC(thread_count, sizeof(int));
return MXS_CALLOC(thread_count, sizeof(int64_t));
}
/**
@ -80,13 +80,13 @@ void ts_stats_free(ts_stats_t stats)
* @param stats Statistics to read
* @return Value of statistics
*/
int ts_stats_sum(ts_stats_t stats)
int64_t ts_stats_sum(ts_stats_t stats)
{
ss_dassert(stats_initialized);
int sum = 0;
int64_t sum = 0;
for (int i = 0; i < thread_count; i++)
{
sum += ((int*)stats)[i];
sum += ((int64_t*)stats)[i];
}
return sum;
}