def get_system_statistics()

in mozetl/graphics/graphics_telemetry_dashboard.py [0:0]


def get_system_statistics():
    def get_logical_cores(p):
        cpu = p.get(CpuKey, None)
        if cpu is None:
            return "unknown"
        return cpu.get("count", "unknown")

    with Prof("logical cores"):
        logical_cores = general_pings.map(
            lambda p: (get_logical_cores(p),)
        ).countByKey()

    cpu_features = get_cpu_features(general_pings)

    with Prof("memory buckets"):
        memory = get_bucketed_memory(general_pings)

    def get_os_bits(p):
        arch = p.get(ArchKey, "unknown")
        if arch == "x86-64":
            return "64"
        if arch == "x86":
            wow64 = p.get("environment/system/isWow64", False)
            if wow64:
                return "32_on_64"
            return "32"
        return "unknown"

    with Prof("OS bit count"):
        os_bits = windows_pings.map(lambda p: (get_os_bits(p),)).countByKey()

    return {
        "logical_cores": logical_cores,
        "x86": cpu_features,
        "memory": memory,
        "wow": os_bits,
    }