This file is indexed.

/usr/lib/gdesklets/libdesklets/system/CPU.py is in gdesklets 0.36.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import gtop
from Device import Device

import threading


class Total(Device):

    def __init__(self):

        Device.__init__(self)

        self.__total = 0.0
        self.__user  = 0.0
        self.__sys   = 0.0
        self.__nice  = 0.0
        self.__idle  = 0.0
        self.__lock  = threading.Lock()



    def _get_cpu(self): return gtop.cpu()


    def poll(self):

        """
        @return : cpu load
        @rtype  : float
        """
        self.__lock.acquire()

        try:
            cpu = self._get_cpu()
            totaldiff = cpu.total - self.__total
            load = float(cpu.frequency * ((cpu.user + cpu.sys + cpu.nice) -
                                          (self.__user + self.__sys + self.__nice))
                         / (totaldiff + 0.001) + 0.5)

            if (load > 100.0): load = 100.0

            self.__total = cpu.total
            self.__user  = cpu.user
            self.__sys   = cpu.sys
            self.__nice  = cpu.nice
            self.__idle  = cpu.idle

            return load

        finally:
            self.__lock.release()




class CPU(Total):

    def __init__(self, n):

        Total.__init__(self)
        self.__n = n


    def _get_cpu(self): return gtop.cpu().cpus[self.__n]