1*4882a593Smuzhiyun================== 2*4882a593SmuzhiyunControl Groupstats 3*4882a593Smuzhiyun================== 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunControl Groupstats is inspired by the discussion at 6*4882a593Smuzhiyunhttp://lkml.org/lkml/2007/4/11/187 and implements per cgroup statistics as 7*4882a593Smuzhiyunsuggested by Andrew Morton in http://lkml.org/lkml/2007/4/11/263. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunPer cgroup statistics infrastructure re-uses code from the taskstats 10*4882a593Smuzhiyuninterface. A new set of cgroup operations are registered with commands 11*4882a593Smuzhiyunand attributes specific to cgroups. It should be very easy to 12*4882a593Smuzhiyunextend per cgroup statistics, by adding members to the cgroupstats 13*4882a593Smuzhiyunstructure. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunThe current model for cgroupstats is a pull, a push model (to post 16*4882a593Smuzhiyunstatistics on interesting events), should be very easy to add. Currently 17*4882a593Smuzhiyunuser space requests for statistics by passing the cgroup path. 18*4882a593SmuzhiyunStatistics about the state of all the tasks in the cgroup is returned to 19*4882a593Smuzhiyunuser space. 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunNOTE: We currently rely on delay accounting for extracting information 22*4882a593Smuzhiyunabout tasks blocked on I/O. If CONFIG_TASK_DELAY_ACCT is disabled, this 23*4882a593Smuzhiyuninformation will not be available. 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunTo extract cgroup statistics a utility very similar to getdelays.c 26*4882a593Smuzhiyunhas been developed, the sample output of the utility is shown below:: 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup/a" 29*4882a593Smuzhiyun sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0 30*4882a593Smuzhiyun ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup" 31*4882a593Smuzhiyun sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2 32