Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/lib/sysdep/arch/x86_x64/topology.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 12 Lines | |||||
/* | /* | ||||
* detection of CPU and cache topology | * detection of CPU and cache topology | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "lib/sysdep/arch/x86_x64/topology.h" | #include "lib/sysdep/arch/x86_x64/topology.h" | ||||
#include <bitset> | |||||
#include "lib/bits.h" | #include "lib/bits.h" | ||||
#include "lib/module_init.h" | #include "lib/module_init.h" | ||||
#include "lib/sysdep/cpu.h" // ERR::CPU_FEATURE_MISSING | #include "lib/sysdep/cpu.h" // ERR::CPU_FEATURE_MISSING | ||||
#include "lib/sysdep/os_cpu.h" | #include "lib/sysdep/os_cpu.h" | ||||
#include "lib/sysdep/numa.h" | #include "lib/sysdep/numa.h" | ||||
#include "lib/sysdep/arch/x86_x64/x86_x64.h" | #include "lib/sysdep/arch/x86_x64/x86_x64.h" | ||||
#include "lib/sysdep/arch/x86_x64/cache.h" | #include "lib/sysdep/arch/x86_x64/cache.h" | ||||
#include "lib/sysdep/arch/x86_x64/apic.h" | #include "lib/sysdep/arch/x86_x64/apic.h" | ||||
#include <bitset> | |||||
#include <vector> | |||||
namespace topology { | namespace topology { | ||||
//--------------------------------------------------------------------------------------------------------------------- | //--------------------------------------------------------------------------------------------------------------------- | ||||
// detect *maximum* number of cores/packages/caches. | // detect *maximum* number of cores/packages/caches. | ||||
// note: some of them may be disabled by the OS or BIOS. | // note: some of them may be disabled by the OS or BIOS. | ||||
// note: Intel Appnote 485 assures us that they are uniform across packages. | // note: Intel Appnote 485 assures us that they are uniform across packages. | ||||
static size_t MaxCoresPerPackage() | static size_t MaxCoresPerPackage() | ||||
▲ Show 20 Lines • Show All 426 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator