1c3123552SMauro Carvalho Chehab================== 2c3123552SMauro Carvalho ChehabControl Groupstats 3c3123552SMauro Carvalho Chehab================== 4c3123552SMauro Carvalho Chehab 5c3123552SMauro Carvalho ChehabControl Groupstats is inspired by the discussion at 6*05a5f51cSJoe Percheshttps://lore.kernel.org/r/461CF883.2030308@sw.ru and implements per cgroup statistics as 7*05a5f51cSJoe Perchessuggested by Andrew Morton in https://lore.kernel.org/r/20070411114927.1277d7c9.akpm@linux-foundation.org. 8c3123552SMauro Carvalho Chehab 9c3123552SMauro Carvalho ChehabPer cgroup statistics infrastructure re-uses code from the taskstats 10c3123552SMauro Carvalho Chehabinterface. A new set of cgroup operations are registered with commands 11c3123552SMauro Carvalho Chehaband attributes specific to cgroups. It should be very easy to 12c3123552SMauro Carvalho Chehabextend per cgroup statistics, by adding members to the cgroupstats 13c3123552SMauro Carvalho Chehabstructure. 14c3123552SMauro Carvalho Chehab 15c3123552SMauro Carvalho ChehabThe current model for cgroupstats is a pull, a push model (to post 16c3123552SMauro Carvalho Chehabstatistics on interesting events), should be very easy to add. Currently 17c3123552SMauro Carvalho Chehabuser space requests for statistics by passing the cgroup path. 18c3123552SMauro Carvalho ChehabStatistics about the state of all the tasks in the cgroup is returned to 19c3123552SMauro Carvalho Chehabuser space. 20c3123552SMauro Carvalho Chehab 21c3123552SMauro Carvalho ChehabNOTE: We currently rely on delay accounting for extracting information 22c3123552SMauro Carvalho Chehababout tasks blocked on I/O. If CONFIG_TASK_DELAY_ACCT is disabled, this 23c3123552SMauro Carvalho Chehabinformation will not be available. 24c3123552SMauro Carvalho Chehab 25c3123552SMauro Carvalho ChehabTo extract cgroup statistics a utility very similar to getdelays.c 26c3123552SMauro Carvalho Chehabhas been developed, the sample output of the utility is shown below:: 27c3123552SMauro Carvalho Chehab 28c3123552SMauro Carvalho Chehab ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup/a" 29c3123552SMauro Carvalho Chehab sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0 30c3123552SMauro Carvalho Chehab ~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup" 31c3123552SMauro Carvalho Chehab sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2 32