Exemplo n.º 1
0
def collect_cpu_metadata(metadata):
    collect_cpu_model(metadata)

    # CPU count
    cpu_count = get_logical_cpu_count()
    if cpu_count:
        metadata['cpu_count'] = cpu_count

    cpu_affinity = get_cpu_affinity()
    collect_cpu_affinity(metadata, cpu_affinity, cpu_count)

    all_cpus = cpu_affinity
    if not all_cpus and cpu_count:
        all_cpus = tuple(range(cpu_count))

    if all_cpus:
        collect_cpu_freq(metadata, all_cpus)
        collect_cpu_config(metadata, all_cpus)

    collect_cpu_temperatures(metadata)
Exemplo n.º 2
0
def collect_cpu_metadata(metadata):
    collect_cpu_model(metadata)

    # CPU count
    cpu_count = get_logical_cpu_count()
    if cpu_count:
        metadata['cpu_count'] = cpu_count

    cpu_affinity = get_cpu_affinity()
    collect_cpu_affinity(metadata, cpu_affinity, cpu_count)

    all_cpus = cpu_affinity
    if not all_cpus and cpu_count:
        all_cpus = tuple(range(cpu_count))

    if all_cpus:
        collect_cpu_freq(metadata, all_cpus)
        collect_cpu_config(metadata, all_cpus)

    collect_cpu_temperatures(metadata)
Exemplo n.º 3
0
    def show(self):
        self.ncpu = get_logical_cpu_count()
        if self.ncpu is None:
            self.error("Unable to get the number of CPUs")
            return

        release = os.uname()[2]
        try:
            version_txt = release.split('-', 1)[0]
            self.linux_version = tuple(map(int, version_txt.split('.')))
        except ValueError:
            self.error("Failed to get the Linux version: release=%r" % release)
            return

        # isolcpus= parameter existed prior to 2.6.12-rc2 (2005)
        # which is first commit of the Linux git repository
        self.check_isolcpus()

        # Commit 3fbfbf7a3b66ec424042d909f14ba2ddf4372ea8 added rcu_nocbs
        if self.linux_version >= (3, 8):
            self.check_rcu_nocbs()
Exemplo n.º 4
0
    def show(self):
        self.ncpu = get_logical_cpu_count()
        if self.ncpu is None:
            self.error("Unable to get the number of CPUs")
            return

        release = os.uname()[2]
        try:
            version_txt = release.split('-', 1)[0]
            self.linux_version = tuple(map(int, version_txt.split('.')))
        except ValueError:
            self.error("Failed to get the Linux version: release=%r" % release)
            return

        # isolcpus= parameter existed prior to 2.6.12-rc2 (2005)
        # which is first commit of the Linux git repository
        self.check_isolcpus()

        # Commit 3fbfbf7a3b66ec424042d909f14ba2ddf4372ea8 added rcu_nocbs
        if self.linux_version >= (3, 8):
            self.check_rcu_nocbs()
Exemplo n.º 5
0
    def init(self, args):
        if not self.operations:
            print("WARNING: no operation available for your platform")
            sys.exit()

        self.logical_cpu_count = get_logical_cpu_count()
        if not self.logical_cpu_count:
            print("ERROR: failed to get the number of logical CPUs")
            sys.exit(1)

        isolated = get_isolated_cpus()
        if isolated:
            self.cpus = tuple(isolated)
        elif args.affinity:
            self.cpus = tuple(args.affinity)
        else:
            self.cpus = tuple(range(self.logical_cpu_count))
        # The list of cpus must be sorted to avoid useless write in operations
        assert sorted(self.cpus) == list(self.cpus)

        self.log_state("CPU: use %s logical CPUs: %s"
                       % (len(self.cpus), format_cpu_list(self.cpus)))
Exemplo n.º 6
0
    def init(self, args):
        if not self.operations:
            print("WARNING: no operation available for your platform")
            sys.exit()

        self.logical_cpu_count = get_logical_cpu_count()
        if not self.logical_cpu_count:
            print("ERROR: failed to get the number of logical CPUs")
            sys.exit(1)

        isolated = get_isolated_cpus()
        if isolated:
            self.cpus = tuple(isolated)
        elif args.affinity:
            self.cpus = tuple(args.affinity)
        else:
            self.cpus = tuple(range(self.logical_cpu_count))
        # The list of cpus must be sorted to avoid useless write in operations
        assert sorted(self.cpus) == list(self.cpus)

        self.log_state("CPU: use %s logical CPUs: %s"
                       % (len(self.cpus), format_cpu_list(self.cpus)))