OpenVZ Forum - RDF feed
type: channel
items: Calculating VE CPU Usage

Calculating VE CPU Usage
type: item
description: How should I be calculating per VE CPU usage I'm reading the values from /proc/vz/vestat idle_c is the change in number of idle cycles user_j, nice_j, system_j is the change in usage in jiffies $cpu_usage = 100 - (idle_c / (user_j + nice_j + system_j + idle_c) * 100); To me the above seems incorrect because I'm mixing cycles and jiffies. I've found the following definitions of jiffies and cycles $seconds = $jiffies / $CONFIG_HZ; $seconds = $cycles / $CPU_FREQ; So I should be able rework this to: $jiffies = $cycles / $CPU_FREQ * $CONFIG_HZ; My code becomes: $idle_j = $idle_c / $CPU_FREQ * $CONFIG_HZ; $cpu_usage = 100 - (idle_j / (user_j + nice_j + system_j + idle_j) * 100); Am I completely off base?
creator: xous
date: 2009-12-24T20:53:51-00:00