Comment 3 for bug 795935

Revision history for this message
Beniamin Bronisz (beniaminb) wrote :

I've had the same problem. I've edited: /usr/bin/indicator-sysmonitor (it is plain python script) and edited lines:

def _fetch_cpu(self):
        last = self.last
        current = ps.cpu_times()

        total_time_passed = sum([v-last.__dict__[k] if not isinstance(v,list) else 0 for k,v in current.__dict__.iteritems()])

        sys_time = current.system - last.system
        usr_time = current.user - last.user

        self.last = current

        if total_time_passed > 0:
            sys_percent = 100 * sys_time / total_time_passed
            usr_percent = 100 * usr_time / total_time_passed
            return sys_percent + usr_percent
        else:
            return 0

into:

def _fetch_cpu(self):
    return ps.cpu_percent(interval=0)

And it worked.