示例#1
0
    def __init__(self):
        self.outputpercore(True)

        # I don't know how to create an object in a singleton manner in python
        # so simply instantiating an object of cputopology again here.
        self.ct = clr_nodeinfo.cputopology()

        self.cpus = self.ct.onlinecpus # just for convenience

        self.init = False

        for cpuid in self.cpus:
            tmp = cpustatvals(cpuid) # just for cpustatfn
            statpath = tmp.cpustatfn(cpuid)
            if not os.path.exists(statpath):
                # print 'Not found', statpath
                return

        self.init = True
        self.cnt = 0
        self.samples = [
            [cpustatvals(i) for i in self.cpus],
            [cpustatvals(i) for i in self.cpus] ]

        self.sample()
示例#2
0
    def __init__ (self):
        # default values
        self.cooldowntemp = 45  # depend on arch
        #self.output = sys.stdout
        self.intervalsec = 1
        #XXX: demo
        self.beacon = False
        self.logger = self.defaultlogger
        # instantiate class
        self.nc = clr_nodeinfo.nodeconfig()
        self.ct = clr_nodeinfo.cputopology()

        self.samples = []
        self.ctr = clr_hwmon.coretemp_reader()
        self.samples.append("temp") # XXX: fix coretemp_reader.init
        self.rapl = clr_rapl.rapl_reader()
        if self.rapl.init:
            self.samples.append("energy")
        #self.amp = clr_amperf.amperf_reader()
        self.freq =  clr_cpufreq.cpufreq_reader()
        if self.freq.init:
            self.samples.append("freq")
        self.acpi = clr_hwmon.acpi_power_meter_reader()
        if self.acpi.init:
            self.samples.append("acpi")