* appropriate status code.
*/
static int
-check_treshold(int value, int warn, int crit, int less)
+check_treshold(intmax_t value, int warn, int crit, int less)
{
if (!less) {
if (value < warn)
* Exit with the correct return code.
*/
static void
-message_and_exit(int level, int value, const char *info)
+message_and_exit(int level, intmax_t value, const char *info)
{
if (level == 0)
printf("OK: ");
else
printf("Uknown: ");
- printf("%d %s\n", value, info);
+ printf("%ju %s\n", value, info);
exit(level);
}
{
int level;
double ratio = 0;
- int total;
+ int64_t total;
if (!strcmp(param, "hitrate")) {
total = VSL_stats->cache_hit + VSL_stats->cache_miss;
if (total > 0)
- ratio = VSL_stats->cache_hit / total;
- level = check_treshold((int)ratio*100, w, c, less);
+ ratio = 100.0 * (double)VSL_stats->cache_hit / (double)total;
+ level = check_treshold(ratio, w, c, less);
message_and_exit(level, ratio, "Hitrate ratio");
}
#define MAC_STAT(n, t, f, d) \