1 # -*- coding: utf-8 -*-
3 from __future__ import division
48 ('delayacct_blkio_ticks', int),
62 def __init__(self, processid):
64 strstats = file('/proc/%s/stat' % processid).read()
66 # "getconf CLK_TCK" = 100 -> 1 tick = 1/100 seconds
67 strstats = strstats.rstrip('\n').split(' ')
68 for i, keycls in enumerate(__proc_keys__):
70 self[key] = cls(strstats[i])
74 nice_state = __states__.get(state, None)
77 return "%s (%s)" % (state, nice_state)
80 # "getconf CLK_TCK" = 100 -> 1 tick = 1/100 seconds
82 return self['utime'] / 100
85 return self['stime'] / 100