Ensure no division by zero occours if no time has ever been spent writing llcache

This commit is contained in:
Vincent Sanders 2015-01-03 15:12:53 +00:00
parent f9ccd65545
commit 5464dc7778

View File

@ -3272,9 +3272,13 @@ llcache_initialise(const struct llcache_parameters *prm)
void llcache_finalise(void)
{
llcache_object *object, *next;
unsigned long total_bandwidth; /* total bandwidth */
unsigned long total_bandwidth = 0; /* total bandwidth */
if (llcache->total_elapsed > 0) {
total_bandwidth = (llcache->total_written * 1000) /
llcache->total_elapsed;
}
total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
/* Clean uncached objects */
for (object = llcache->uncached_objects; object != NULL; object = next) {
llcache_object_user *user, *next_user;