├── tests ├── awk │ ├── results │ │ ├── pp_dpm_mclk │ │ ├── pp_dpm_sclk │ │ ├── amdgpu_pm_info │ │ ├── aticonfig-odgt │ │ ├── aticonfig-odgc-load │ │ ├── aticonfig-odgc-mclk │ │ ├── aticonfig-odgc-sclk │ │ ├── radeon_pm_info-mclk │ │ ├── radeon_pm_info-sclk │ │ ├── radeon_pm_info-vddc │ │ ├── nvidia-settings-GPUUtilization │ │ ├── nvidia-settings-GPUCurrentClockFreqs-mclk │ │ └── nvidia-settings-GPUCurrentClockFreqs-sclk │ ├── samples │ │ ├── nvidia-settings-GPUCurrentClockFreqs │ │ ├── pp_dpm_mclk │ │ ├── nvidia-settings-GPUUtilization │ │ ├── radeon_pm_info │ │ ├── aticonfig-odgt │ │ ├── pp_dpm_sclk │ │ ├── aticonfig-odgc │ │ └── amdgpu_pm_info │ └── test_regex.sh ├── grep │ ├── results │ │ ├── nouveau_pstate_first_core │ │ ├── nouveau_pstate_forced_core │ │ ├── nouveau_pstate_first_memory │ │ └── nouveau_pstate_forced_memory │ ├── samples │ │ ├── nouveau_pstate_first │ │ └── nouveau_pstate_forced │ └── test_regex.sh ├── CMakeLists.txt └── common.sh ├── src ├── core │ ├── dmidecode │ │ ├── .gitignore │ │ ├── .hash │ │ ├── CMakeLists.txt │ │ ├── config.h │ │ ├── dmioem.h │ │ ├── README.md │ │ ├── util.h │ │ ├── types.h │ │ ├── libdmidecode.h │ │ ├── dmioutput.h │ │ ├── dmiopt.h │ │ ├── dmidecode.h │ │ ├── AUTHORS │ │ └── dmioutput.c │ ├── bandwidth │ │ ├── OOC │ │ │ ├── Image_shrink.h │ │ │ ├── README.txt │ │ │ ├── PKChar.h │ │ │ ├── RectStack.h │ │ │ ├── RectStack.c │ │ │ ├── Log.h │ │ │ ├── FontPK.h │ │ │ ├── Utility.h │ │ │ ├── Controller.h │ │ │ ├── FontBuiltin.h │ │ │ ├── Console.h │ │ │ ├── Double.h │ │ │ ├── FontFreetype.h │ │ │ ├── Int.h │ │ │ ├── OperatingSystem.h │ │ │ ├── MutableData.h │ │ │ ├── Array.h │ │ │ ├── Dictionary.h │ │ │ ├── Object.h │ │ │ ├── Keycodes.h │ │ │ ├── MutableArray.h │ │ │ ├── Data.h │ │ │ ├── CPU.h │ │ │ ├── DateTime.h │ │ │ ├── MutableString.h │ │ │ ├── Display.h │ │ │ ├── Image.h │ │ │ ├── View.h │ │ │ ├── StackTemplate.h │ │ │ ├── String.h │ │ │ ├── Hardware.h │ │ │ ├── utility-x86.h │ │ │ ├── Model3D.h │ │ │ ├── Object.c │ │ │ ├── RULES.txt │ │ │ ├── Controller.c │ │ │ ├── Font.h │ │ │ └── Window.h │ │ ├── README.md │ │ ├── TestingARM.h │ │ ├── TestingRISCV.h │ │ ├── TestingX86.h │ │ ├── CMakeLists.txt │ │ └── libbandwidth.h │ ├── core.hpp │ └── internal.hpp ├── daemon │ ├── client.hpp │ ├── server.hpp │ └── daemon.h ├── logger.hpp └── logger.cpp ├── .gitignore ├── data ├── logos │ ├── AMD.png │ ├── ARM.png │ ├── DEC.png │ ├── NSC.png │ ├── SiS.png │ ├── UMC.png │ ├── Apple.png │ ├── Cyrix.png │ ├── Hygon.png │ ├── Intel.png │ ├── Rise.png │ ├── Ampere.png │ ├── Broadcom.png │ ├── Cavium.png │ ├── Centaur.png │ ├── Faraday.png │ ├── Fujitsu.png │ ├── Infineon.png │ ├── Marvell.png │ ├── NVIDIA.png │ ├── NexGen.png │ ├── Phytium.png │ ├── Qualcomm.png │ ├── Samsung.png │ ├── Unknown.png │ ├── Freescale.png │ ├── HiSilicon.png │ ├── Microsoft.png │ ├── Transmeta.png │ └── CMakeLists.txt ├── icons │ ├── CPU-X_128x128.png │ ├── CPU-X_16x16.png │ ├── CPU-X_192x192.png │ ├── CPU-X_22x22.png │ ├── CPU-X_24x24.png │ ├── CPU-X_256x256.png │ ├── CPU-X_32x32.png │ ├── CPU-X_36x36.png │ ├── CPU-X_384x384.png │ ├── CPU-X_48x48.png │ ├── CPU-X_512x512.png │ ├── CPU-X_64x64.png │ ├── CPU-X_72x72.png │ ├── CPU-X_96x96.png │ ├── CPU-X_original.png │ └── CMakeLists.txt ├── cpu-x-gtk-3.20.css ├── cpu-x-gtk-3.20-dark.css ├── cpu-x-gtk-3.12.css ├── cpu-x-gtk-3.12-dark.css ├── io.github.thetumultuousunicornofdarkness.cpu-x.desktop.in ├── cpu-x-gtk-3.12.cmb ├── completions │ ├── CMakeLists.txt │ ├── bash │ ├── zsh │ └── fish ├── io.github.thetumultuousunicornofdarkness.cpu-x-daemon.policy.in ├── CMakeLists.txt └── io.github.thetumultuousunicornofdarkness.cpu-x.gschema.xml ├── .github ├── ISSUE_TEMPLATE.md ├── main.workflow ├── ISSUE_TEMPLATE │ ├── libcpuid.md │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── lock_threads.yml │ ├── update_pot_file.yml │ ├── linux.yml │ └── appimage_continuous.yml ├── po ├── LINGUAS └── CMakeLists.txt ├── .cirrus.yml ├── scripts ├── check_new_strings.sh ├── patch_dmidecode.sh ├── build_libcpuid.sh └── bump_cpu_x_version.sh ├── cmake ├── cmake_uninstall.cmake.in ├── gettext_create_translations.cmake └── GSettings.cmake └── vagrant ├── Vagrantfile └── bootstrap_common.sh /tests/awk/results/pp_dpm_mclk: -------------------------------------------------------------------------------- 1 | 300 2 | -------------------------------------------------------------------------------- /tests/awk/results/pp_dpm_sclk: -------------------------------------------------------------------------------- 1 | 900 2 | -------------------------------------------------------------------------------- /src/core/dmidecode/.gitignore: -------------------------------------------------------------------------------- 1 | *.bash 2 | -------------------------------------------------------------------------------- /tests/awk/results/amdgpu_pm_info: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /tests/awk/results/aticonfig-odgt: -------------------------------------------------------------------------------- 1 | 48.50 2 | -------------------------------------------------------------------------------- /tests/awk/results/aticonfig-odgc-load: -------------------------------------------------------------------------------- 1 | 77 2 | -------------------------------------------------------------------------------- /tests/awk/results/aticonfig-odgc-mclk: -------------------------------------------------------------------------------- 1 | 300 2 | -------------------------------------------------------------------------------- /tests/awk/results/aticonfig-odgc-sclk: -------------------------------------------------------------------------------- 1 | 157 2 | -------------------------------------------------------------------------------- /tests/awk/results/radeon_pm_info-mclk: -------------------------------------------------------------------------------- 1 | 150000 2 | -------------------------------------------------------------------------------- /tests/awk/results/radeon_pm_info-sclk: -------------------------------------------------------------------------------- 1 | 37500 2 | -------------------------------------------------------------------------------- /tests/awk/results/radeon_pm_info-vddc: -------------------------------------------------------------------------------- 1 | 950 2 | -------------------------------------------------------------------------------- /tests/grep/results/nouveau_pstate_first_core: -------------------------------------------------------------------------------- 1 | 405 2 | -------------------------------------------------------------------------------- /tests/grep/results/nouveau_pstate_forced_core: -------------------------------------------------------------------------------- 1 | 900 2 | -------------------------------------------------------------------------------- /tests/awk/results/nvidia-settings-GPUUtilization: -------------------------------------------------------------------------------- 1 | 33 2 | -------------------------------------------------------------------------------- /tests/grep/results/nouveau_pstate_first_memory: -------------------------------------------------------------------------------- 1 | 838 2 | -------------------------------------------------------------------------------- /tests/grep/results/nouveau_pstate_forced_memory: -------------------------------------------------------------------------------- 1 | 4000 2 | -------------------------------------------------------------------------------- /tests/awk/results/nvidia-settings-GPUCurrentClockFreqs-mclk: -------------------------------------------------------------------------------- 1 | 405 2 | -------------------------------------------------------------------------------- /tests/awk/results/nvidia-settings-GPUCurrentClockFreqs-sclk: -------------------------------------------------------------------------------- 1 | 135 2 | -------------------------------------------------------------------------------- /tests/awk/samples/nvidia-settings-GPUCurrentClockFreqs: -------------------------------------------------------------------------------- 1 | 135,405 2 | -------------------------------------------------------------------------------- /src/core/dmidecode/.hash: -------------------------------------------------------------------------------- 1 | b960e98506912ca6a2eceeafc59be0d659e7f299 2 | -------------------------------------------------------------------------------- /tests/awk/samples/pp_dpm_mclk: -------------------------------------------------------------------------------- 1 | 0: 300Mhz * 2 | 1: 1000Mhz 3 | 2: 2235Mhz 4 | -------------------------------------------------------------------------------- /tests/awk/samples/nvidia-settings-GPUUtilization: -------------------------------------------------------------------------------- 1 | graphics=33, memory=8, video=0, PCIe=0 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.log 3 | build/ 4 | packages 5 | .vscode 6 | .vagrant 7 | bandwidth.bmp 8 | -------------------------------------------------------------------------------- /data/logos/AMD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/AMD.png -------------------------------------------------------------------------------- /data/logos/ARM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/ARM.png -------------------------------------------------------------------------------- /data/logos/DEC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/DEC.png -------------------------------------------------------------------------------- /data/logos/NSC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/NSC.png -------------------------------------------------------------------------------- /data/logos/SiS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/SiS.png -------------------------------------------------------------------------------- /data/logos/UMC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/UMC.png -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Image_shrink.h: -------------------------------------------------------------------------------- 1 | 2 | extern Image* Image_shrink (Image *self, unsigned, unsigned); 3 | -------------------------------------------------------------------------------- /data/logos/Apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Apple.png -------------------------------------------------------------------------------- /data/logos/Cyrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Cyrix.png -------------------------------------------------------------------------------- /data/logos/Hygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Hygon.png -------------------------------------------------------------------------------- /data/logos/Intel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Intel.png -------------------------------------------------------------------------------- /data/logos/Rise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Rise.png -------------------------------------------------------------------------------- /data/logos/Ampere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Ampere.png -------------------------------------------------------------------------------- /data/logos/Broadcom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Broadcom.png -------------------------------------------------------------------------------- /data/logos/Cavium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Cavium.png -------------------------------------------------------------------------------- /data/logos/Centaur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Centaur.png -------------------------------------------------------------------------------- /data/logos/Faraday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Faraday.png -------------------------------------------------------------------------------- /data/logos/Fujitsu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Fujitsu.png -------------------------------------------------------------------------------- /data/logos/Infineon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Infineon.png -------------------------------------------------------------------------------- /data/logos/Marvell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Marvell.png -------------------------------------------------------------------------------- /data/logos/NVIDIA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/NVIDIA.png -------------------------------------------------------------------------------- /data/logos/NexGen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/NexGen.png -------------------------------------------------------------------------------- /data/logos/Phytium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Phytium.png -------------------------------------------------------------------------------- /data/logos/Qualcomm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Qualcomm.png -------------------------------------------------------------------------------- /data/logos/Samsung.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Samsung.png -------------------------------------------------------------------------------- /data/logos/Unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Unknown.png -------------------------------------------------------------------------------- /data/logos/Freescale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Freescale.png -------------------------------------------------------------------------------- /data/logos/HiSilicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/HiSilicon.png -------------------------------------------------------------------------------- /data/logos/Microsoft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Microsoft.png -------------------------------------------------------------------------------- /data/logos/Transmeta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/logos/Transmeta.png -------------------------------------------------------------------------------- /data/icons/CPU-X_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_128x128.png -------------------------------------------------------------------------------- /data/icons/CPU-X_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_16x16.png -------------------------------------------------------------------------------- /data/icons/CPU-X_192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_192x192.png -------------------------------------------------------------------------------- /data/icons/CPU-X_22x22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_22x22.png -------------------------------------------------------------------------------- /data/icons/CPU-X_24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_24x24.png -------------------------------------------------------------------------------- /data/icons/CPU-X_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_256x256.png -------------------------------------------------------------------------------- /data/icons/CPU-X_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_32x32.png -------------------------------------------------------------------------------- /data/icons/CPU-X_36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_36x36.png -------------------------------------------------------------------------------- /data/icons/CPU-X_384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_384x384.png -------------------------------------------------------------------------------- /data/icons/CPU-X_48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_48x48.png -------------------------------------------------------------------------------- /data/icons/CPU-X_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_512x512.png -------------------------------------------------------------------------------- /data/icons/CPU-X_64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_64x64.png -------------------------------------------------------------------------------- /data/icons/CPU-X_72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_72x72.png -------------------------------------------------------------------------------- /data/icons/CPU-X_96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_96x96.png -------------------------------------------------------------------------------- /data/icons/CPU-X_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/HEAD/data/icons/CPU-X_original.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /tests/awk/samples/radeon_pm_info: -------------------------------------------------------------------------------- 1 | uvd vclk: 0 dclk: 0 2 | power level 0 sclk: 37500 mclk: 150000 vddc: 950 vddci: 875 pcie gen: 3 3 | -------------------------------------------------------------------------------- /tests/awk/samples/aticonfig-odgt: -------------------------------------------------------------------------------- 1 | Default Adapter - ATI Mobility Radeon HD 5000 Series 2 | Sensor 0: Temperature - 48.50 C 3 | -------------------------------------------------------------------------------- /tests/awk/samples/pp_dpm_sclk: -------------------------------------------------------------------------------- 1 | 0: 300Mhz 2 | 1: 600Mhz 3 | 2: 900Mhz * 4 | 3: 1145Mhz 5 | 4: 1215Mhz 6 | 5: 1257Mhz 7 | 6: 1300Mhz 8 | 7: 1420Mhz 9 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | af ar ber bg ca cs_CZ da de el eo es fa fi fr ga gl hu id it ja ka kk kmr ko lv ml mr ms nb_NO nl pa pl pt pt_BR ro ru si sv ta tr tzm uk zh zh_Hant 2 | -------------------------------------------------------------------------------- /data/cpu-x-gtk-3.20.css: -------------------------------------------------------------------------------- 1 | box#footer_box { 2 | color: rgb(46, 52, 54); 3 | background-color: rgb(76, 153, 230); 4 | } 5 | 6 | label#value, 7 | progressbar { 8 | color: rgb(0, 0, 128); 9 | } 10 | -------------------------------------------------------------------------------- /data/cpu-x-gtk-3.20-dark.css: -------------------------------------------------------------------------------- 1 | box#footer_box { 2 | color: rgb(46, 52, 54); 3 | background-color: rgb(76, 153, 230); 4 | } 5 | 6 | label#value, 7 | progressbar { 8 | color: rgb(192, 192, 0); 9 | } 10 | -------------------------------------------------------------------------------- /data/cpu-x-gtk-3.12.css: -------------------------------------------------------------------------------- 1 | GtkBox#footer_box { 2 | color: rgb(46, 52, 54); 3 | background-color: rgb(76, 153, 230); 4 | } 5 | 6 | GtkLabel#value, 7 | GtkProgressBar { 8 | color: rgb(0, 0, 128); 9 | } 10 | -------------------------------------------------------------------------------- /data/cpu-x-gtk-3.12-dark.css: -------------------------------------------------------------------------------- 1 | GtkBox#footer_box { 2 | color: rgb(46, 52, 54); 3 | background-color: rgb(76, 153, 230); 4 | } 5 | 6 | GtkLabel#value, 7 | GtkProgressBar { 8 | color: rgb(192, 192, 0); 9 | } 10 | -------------------------------------------------------------------------------- /data/logos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(logos 2 | LANGUAGES NONE 3 | ) 4 | 5 | 6 | # Logos 7 | file(GLOB 8 | logos 9 | *.png 10 | ) 11 | 12 | install(FILES 13 | ${logos} 14 | DESTINATION ${CPU_X_DATA_DIRECTORY}/ 15 | ) 16 | -------------------------------------------------------------------------------- /tests/grep/samples/nouveau_pstate_first: -------------------------------------------------------------------------------- 1 | 07: core 270-405 MHz memory 838 MHz 2 | 0a: core 270-900 MHz memory 1560 MHz 3 | 0e: core 270-900 MHz memory 4000 MHz 4 | 0f: core 270-900 MHz memory 5016 MHz 5 | AC: core 405 MHz memory 5016 MHz 6 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/README.txt: -------------------------------------------------------------------------------- 1 | 2 | This is a pared-down version of object-oriented C (OOC), 3 | my experimental library for object-oriented programming in C, 4 | which I mention on my webpage https://zsmith.co/OOC.php. 5 | 6 | -Zack Smith 7 | -------------------------------------------------------------------------------- /tests/grep/samples/nouveau_pstate_forced: -------------------------------------------------------------------------------- 1 | 07: core 270-405 MHz memory 838 MHz 2 | 0a: core 270-900 MHz memory 1560 MHz 3 | 0e: core 270-900 MHz memory 4000 MHz AC DC * 4 | 0f: core 270-900 MHz memory 5016 MHz 5 | AC: core 405 MHz memory 5016 MHz 6 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(tests 2 | LANGUAGES NONE 3 | ) 4 | 5 | add_test(NAME test_awk_regex COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/awk/test_regex.sh") 6 | add_test(NAME test_grep_regex COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/grep/test_regex.sh") 7 | -------------------------------------------------------------------------------- /.github/main.workflow: -------------------------------------------------------------------------------- 1 | action "Cirrus CI Email" { 2 | uses = "docker://cirrusactions/email:latest" 3 | env = { 4 | APP_NAME = "Cirrus CI" 5 | } 6 | secrets = ["GITHUB_TOKEN", "MAIL_FROM", "MAIL_HOST", "MAIL_USERNAME", "MAIL_PASSWORD"] 7 | } 8 | -------------------------------------------------------------------------------- /tests/awk/samples/aticonfig-odgc: -------------------------------------------------------------------------------- 1 | Adapter 1 - ATI Radeon HD 5700 Series 2 | Core (MHz) Memory (MHz) 3 | Current Clocks : 157 300 4 | Current Peak : 900 1200 5 | Configurable Peak Range : [500-1080] [1200-1450] 6 | GPU load : 77% 7 | -------------------------------------------------------------------------------- /data/io.github.thetumultuousunicornofdarkness.cpu-x.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=CPU-X 3 | Comment=Gathers information on CPU, motherboard and more 4 | Exec=@APP_EXEC@ 5 | Icon=io.github.thetumultuousunicornofdarkness.cpu-x 6 | Type=Application 7 | Categories=GTK;System; 8 | Terminal=false 9 | Keywords=CPU;system;core;speed;clock;rate;Intel;AMD;motherboard; 10 | -------------------------------------------------------------------------------- /data/cpu-x-gtk-3.12.cmb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/libcpuid.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Wrong CPU Code Name 3 | about: Create a report to help us to improve libcpuid 4 | 5 | --- 6 | 7 | 10 | 11 | **libcpuid dump** 12 | 13 | -------------------------------------------------------------------------------- /tests/common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | success() { 4 | local msg="$1" 5 | local details="$2" 6 | echo -e "\033[1;32m$msg\033[0m $details" 7 | } 8 | 9 | error() { 10 | local msg="$1" 11 | local details="$2" 12 | echo -e "\033[1;31m$msg\033[0m $details" 13 | } 14 | 15 | summary() { 16 | local failed=$1 17 | echo 18 | if [[ $failed -eq 0 ]]; then 19 | success "All tests passed!" 20 | else 21 | error "$failed tests failed." 22 | fi 23 | exit "$failed" 24 | } 25 | -------------------------------------------------------------------------------- /data/completions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(completions 2 | LANGUAGES NONE 3 | ) 4 | 5 | install(FILES 6 | bash 7 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/bash-completion/completions/ 8 | RENAME ${CMAKE_PROJECT_NAME} 9 | ) 10 | 11 | install(FILES 12 | fish 13 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/fish/vendor_completions.d/ 14 | RENAME ${CMAKE_PROJECT_NAME}.fish 15 | ) 16 | 17 | install(FILES 18 | zsh 19 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/zsh/site-functions/ 20 | RENAME _${CMAKE_PROJECT_NAME} 21 | ) 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for CPU-X 4 | 5 | --- 6 | 7 | 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | 13 | 14 | **Describe the solution you'd like** 15 | 16 | -------------------------------------------------------------------------------- /data/icons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(icons 2 | LANGUAGES NONE 3 | ) 4 | 5 | 6 | # Icons 7 | file(GLOB 8 | icons 9 | CPU-X_*x*.png 10 | ) 11 | 12 | foreach(icon ${icons}) 13 | get_filename_component(filename ${icon} NAME_WE) 14 | string(REGEX REPLACE "CPU-X_" "" size "${filename}") 15 | install(FILES 16 | ${icon} 17 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/${size}/apps/ 18 | RENAME io.github.thetumultuousunicornofdarkness.cpu-x.png 19 | ) 20 | endforeach() 21 | 22 | install(FILES 23 | CPU-X_original.png 24 | DESTINATION ${CPU_X_DATA_DIRECTORY}/ 25 | RENAME CPU-X.png 26 | ) 27 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | task: 2 | name: FreeBSD # https://www.freebsd.org/releases 3 | freebsd_instance: # https://cirrus-ci.org/guide/FreeBSD/#list-of-available-image-families 4 | matrix: 5 | image_family: freebsd-13-4 6 | image_family: freebsd-14-2 7 | env: 8 | IGNORE_OSVERSION: yes # supress package installation error on FreeBSD-13 9 | 10 | install_script: 11 | - pkg update -f 12 | - sudo pkg install -y bash 13 | 14 | build_script: 15 | - ./scripts/build_libcpuid.sh 16 | - ./scripts/build_cpu_x.sh -s "$(realpath .)" 17 | 18 | run_script: 19 | - sudo CPUX_BCLK=100 cpu-x --issue-fmt 20 | - cat /tmp/cpu-x.log 21 | - cat /tmp/cpu-x-daemon.log 22 | -------------------------------------------------------------------------------- /.github/workflows/lock_threads.yml: -------------------------------------------------------------------------------- 1 | name: Lock Old Threads 2 | 3 | on: 4 | schedule: 5 | - cron: '42 4 * * 1' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | discussions: write 12 | 13 | concurrency: 14 | group: lock-threads 15 | 16 | jobs: 17 | action: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: JC5/lock-threads@v6 21 | with: 22 | github-token: ${{ github.token }} 23 | issue-inactive-days: '30' 24 | issue-lock-reason: 'resolved' 25 | pr-inactive-days: '30' 26 | pr-lock-reason: 'resolved' 27 | discussion-inactive-days: '30' 28 | log-output: true 29 | -------------------------------------------------------------------------------- /src/core/dmidecode/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(dmidecode 2 | VERSION "3.6.20250725" 3 | LANGUAGES C 4 | ) 5 | 6 | # Config (dmidecode) 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 8 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-shift-count-overflow") 9 | message(STATUS "Using built-in ${PROJECT_NAME}, version ${PROJECT_VERSION}") 10 | 11 | # Build (dmidecode) 12 | add_definitions(-DVERSION="${PROJECT_VERSION}") 13 | add_library(dmidecode 14 | STATIC 15 | types.h 16 | util.c 17 | util.h 18 | dmiopt.h 19 | dmiopt.c 20 | dmioem.c 21 | dmioem.h 22 | dmidecode.c 23 | dmidecode.h 24 | dmioutput.c 25 | dmioutput.h 26 | ) 27 | 28 | target_link_libraries(dmidecode) 29 | set(DMIDECODE_VERSION ${PROJECT_VERSION} PARENT_SCOPE) 30 | -------------------------------------------------------------------------------- /src/core/dmidecode/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration 3 | */ 4 | 5 | #ifndef CONFIG_H 6 | #define CONFIG_H 7 | 8 | /* Default memory device file */ 9 | #if defined(__BEOS__) || defined(__HAIKU__) 10 | #define DEFAULT_MEM_DEV "/dev/misc/mem" 11 | #else 12 | #ifdef __sun 13 | #define DEFAULT_MEM_DEV "/dev/xsvc" 14 | #else 15 | #define DEFAULT_MEM_DEV "/dev/mem" 16 | #endif 17 | #endif 18 | 19 | /* Use mmap or not */ 20 | #ifndef __BEOS__ 21 | #define USE_MMAP 22 | #endif 23 | 24 | /* Use memory alignment workaround or not */ 25 | #if defined(__ia64__) || defined(__arm__) 26 | #define ALIGNMENT_WORKAROUND 27 | #endif 28 | 29 | /* Avoid unaligned memcpy on /dev/mem */ 30 | #ifdef __aarch64__ 31 | #define USE_SLOW_MEMCPY 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/core/bandwidth/README.md: -------------------------------------------------------------------------------- 1 | # Bandwidth: a memory bandwidth benchmark 2 | 3 | Distributed under the terms of the [GNU GPL v2](https://raw.githubusercontent.com/TheTumultuousUnicornOfDarkness/CPU-X/master/src/core/bandwidth/COPYING.txt). 4 | 5 | 6 | ### CPU-X NOTE 7 | 8 | This sofware has been patched to be used within CPU-X. 9 | You can find the official web page of this project here: https://zs3.me/bandwidth 10 | This is based on bandwidth [1.14.10](https://zs3.me/archives/bandwidth-1.14.10.tar.bz2). 11 | 12 | This software is used to retrieve following data: 13 | * Caches tab 14 | * L1 cache speed 15 | * L2 cache speed 16 | * L3 cache speed 17 | * L4 cache speed 18 | 19 | You can reproduce the output of `bandwidth` command by using `cpu-x --bandwidth`. 20 | It will produce a graph named `bandwidth.bmp` in the current working directory. 21 | -------------------------------------------------------------------------------- /tests/grep/test_regex.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEST_DIR="$(dirname "$(realpath "$0")")" 4 | 5 | # shellcheck disable=SC1090 6 | source "$TEST_DIR/../common.sh" 7 | cd "$TEST_DIR" || exit 255 8 | 9 | failed=0 10 | for samplefile in samples/nouveau_pstate_*; do 11 | file=$(basename "$samplefile") 12 | pstate=$(grep '\*' "$samplefile" || sed -n 1p "$samplefile") 13 | samplecore=$(echo "$pstate" | grep -oP '(?<=core )[^ ]*' | cut -d- -f2) 14 | samplememory=$(echo "$pstate" | grep -oP '(?<=memory )[^ ]*') 15 | resultcore=$(< "results/${file}_core") 16 | resultmemory=$(< "results/${file}_memory") 17 | printf "%-41s: " "$file" 18 | if [[ "$samplecore" == "$resultcore" ]] && [[ "$samplememory" == "$resultmemory" ]]; then 19 | success "OK" 20 | else 21 | error "KO" "(got $samplecore/$samplememory, wanted $resultcore/$resultmemory)" 22 | ((failed++)) 23 | fi 24 | done 25 | summary "$failed" 26 | -------------------------------------------------------------------------------- /data/completions/bash: -------------------------------------------------------------------------------- 1 | _cpu_x() { 2 | local cur prev display opts 3 | COMPREPLY=() 4 | cur="${COMP_WORDS[COMP_CWORD]}" 5 | prev="${COMP_WORDS[COMP_CWORD-1]}" 6 | display=(-G --gtk -N --ncurses -D --dump -M --dmidecode -B --bandwidth -h --help -V --version) 7 | opts=(-r --refresh -t --tab -c --core -b --cachetest -d --daemon -v --verbose --nocolor --issue-fmt --keymap) 8 | 9 | case $prev in 10 | -G|--gtk|-N|--ncurses|-D|dump|-M|--dmidecode|-B|--bandwidth) 11 | COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) 12 | ;; 13 | -h|--help|-V|--version) 14 | return 0 15 | ;; 16 | -r|--refresh|-t|--tab|-c|--core|-b|--cachetest|-d|--daemon|-v|--verbose|--nocolor|--debug|--issue-fmt|--keymap) 17 | COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) 18 | ;; 19 | *) 20 | COMPREPLY=($(compgen -W "${display[*]} ${opts[*]}" -- "$cur")) 21 | ;; 22 | esac 23 | } 24 | 25 | complete -F _cpu_x cpu-x 26 | -------------------------------------------------------------------------------- /data/io.github.thetumultuousunicornofdarkness.cpu-x-daemon.policy.in: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | io.github.thetumultuousunicornofdarkness.cpu-x 7 | The CPU-X Project 8 | https://thetumultuousunicornofdarkness.github.io/CPU-X/ 9 | 10 | 11 | Run CPU-X daemon 12 | Authentication is required to run CPU-X daemon. 13 | 14 | 15 | auth_admin 16 | auth_admin 17 | auth_admin 18 | 19 | @DAEMON_PATH@ 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /scripts/check_new_strings.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This script is used to check if there are new strings in source files 3 | 4 | set -euo pipefail 5 | 6 | GIT_DIR="$(git rev-parse --show-toplevel)" 7 | SHA=${GITHUB_SHA:-HEAD~0} 8 | cd "$GIT_DIR" || exit 1 9 | 10 | if [[ "$(git show -s --format='%ce' "$SHA")" == "hosted@weblate.org" ]]; then 11 | echo "Commit by Weblate, nothing to do." > /dev/stderr 12 | echo "NO_CHANGE" 13 | exit 0 14 | fi 15 | 16 | for file in $(git show --pretty="" --name-only "$SHA"); do 17 | if [[ "$file" =~ \.(c|h|cpp|hpp)$ ]]; then 18 | if git show --unified=0 "$SHA" "$file" | grep -E -qw '_\(|N_\('; then 19 | git --no-pager show "$SHA" "$file" > /dev/stderr 20 | echo "REGEN" 21 | exit 0 22 | fi 23 | elif [[ "$file" =~ \.(ui)$ ]]; then 24 | if git show --unified=0 "$SHA" "$file" | grep -E -qw 'translatable="yes"'; then 25 | git --no-pager show "$SHA" "$file" > /dev/stderr 26 | echo "REGEN" 27 | exit 0 28 | fi 29 | fi 30 | done 31 | 32 | echo "No commit with translation change." > /dev/stderr 33 | echo "NO_CHANGE" 34 | -------------------------------------------------------------------------------- /data/completions/zsh: -------------------------------------------------------------------------------- 1 | #compdef cpu-x 2 | 3 | _cpu_x() { 4 | _arguments -C \ 5 | {-G,--gtk}'[Start graphical user interface (GUI)]' \ 6 | {-N,--ncurses}'[Start text-based user interface (TUI)]' \ 7 | {-D,--dump}'[Dump all data on standard output and exit]' \ 8 | {-M,--dmidecode}'[Run embedded command dmidecode and exit]' \ 9 | {-B,--bandwidth}'[Run embedded command bandwidth and exi]' \ 10 | {-r,--refresh}'[Set custom time between two refreshes (in seconds)]' \ 11 | {-t,--tab}'[Set default tab (integer)]' \ 12 | {-c,--core}'[Select CPU core to monitor (integer)]' \ 13 | {-b,--cachetest}'[Set custom bandwidth test for CPU caches speed (integer)]' \ 14 | {-d,--daemon}'[Start and connect to daemon]' \ 15 | {-v,--verbose}'[Verbose output]' \ 16 | {-h,--help}'[Print help and exit]' \ 17 | {-V,--version}'[Print version and exit]' \ 18 | '--nocolor[Disable colored output]' \ 19 | '--debug[Print information for debugging]' \ 20 | '--issue-fmt[Print required informations to paste in an issue]' \ 21 | '--keymap[Set key mapping for NCurses mode (arrows|emacs|inverted-T|vim)]' 22 | } 23 | 24 | _cpu_x "$@" 25 | -------------------------------------------------------------------------------- /src/core/dmidecode/dmioem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Decoding of OEM-specific entries 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2007-2008 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | struct dmi_header; 23 | 24 | void dmi_set_vendor(const char *s, const char *p); 25 | int dmi_decode_oem(const struct dmi_header *h); 26 | -------------------------------------------------------------------------------- /src/core/dmidecode/README.md: -------------------------------------------------------------------------------- 1 | # Dmidecode: Desktop Management Interface table related utilities 2 | 3 | Distributed under the terms of the [GNU GPL v2](https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/blob/master/src/core/dmidecode/LICENSE). 4 | 5 | ### CPU-X NOTE 6 | 7 | This sofware has been patched to be used within CPU-X. 8 | You can find the official web page of this project here: https://savannah.nongnu.org/projects/dmidecode/ 9 | This is based on dmidecode 3.6+[b960e98](https://git.savannah.gnu.org/cgit/dmidecode.git/commit/?id=b960e98506912ca6a2eceeafc59be0d659e7f299). 10 | 11 | This software is used to retrieve following data: 12 | 13 | - CPU tab 14 | - Package 15 | - Bus speed (fallback) 16 | - Motherboard tab 17 | - Motherboard manufacturer 18 | - Motherboard model 19 | - Motherboard revision 20 | - BIOS brand 21 | - BIOS version 22 | - BIOS date 23 | - BIOS ROM size 24 | 25 | You can reproduce the output of `dmidecode` command by using `cpu-x --dmidecode`. 26 | It will dump all DMI data on standard output. 27 | Note: you can increase dmidecode verbosity by using `cpu-x --verbose --dmidecode`. 28 | -------------------------------------------------------------------------------- /scripts/patch_dmidecode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | CPUX_DIR="$(git rev-parse --show-toplevel)/src/core/dmidecode" 6 | DMIDECODE_DIR="/tmp/dmidecode" 7 | HASH_FILE="$CPUX_DIR/.hash" 8 | OLD_HASH=$(cat "$HASH_FILE") 9 | OLD_HASH_SHORT=${OLD_HASH:0:7} 10 | 11 | # Get dmidecode source code 12 | git clone https://git.savannah.gnu.org/git/dmidecode.git "$DMIDECODE_DIR" 13 | cd "$DMIDECODE_DIR" || exit 255 14 | 15 | # Retrieve informations about repo 16 | VER=$(git describe --abbrev=0 --tags | sed 's/^dmidecode-//;s/-/./') 17 | DATE=$(git show -s --format=%cd --date=format:%Y%m%d) 18 | NEW_HASH=$(git rev-parse HEAD) 19 | NEW_HASH_SHORT=$(git rev-parse --short HEAD) 20 | git diff "$OLD_HASH" master > "dmidecode.patch" 21 | 22 | # Patch to the new version 23 | cd "$CPUX_DIR" || exit 255 24 | echo "$NEW_HASH" > "$HASH_FILE" 25 | sed -i "s/$OLD_HASH/$NEW_HASH/" "README.md" 26 | sed -i "s/$OLD_HASH_SHORT/$NEW_HASH_SHORT/" "README.md" 27 | sed -i "s/VERSION \"[^ ]*\"/VERSION \"$VER.$DATE\"/" "CMakeLists.txt" 28 | patch --batch --no-backup-if-mismatch --input="$DMIDECODE_DIR/dmidecode.patch" 29 | 30 | # Commit 31 | git commit "$CPUX_DIR" -m "Patch dmidecode to version $VER commit $NEW_HASH_SHORT" 32 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # See: http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 5 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | string(REGEX REPLACE "\n" ";" files "${files}") 9 | foreach(file ${files}) 10 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 11 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval 15 | ) 16 | if(NOT "${rm_retval}" STREQUAL 0) 17 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 18 | endif(NOT "${rm_retval}" STREQUAL 0) 19 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 20 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 21 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 22 | endforeach(file) 23 | 24 | file(REMOVE_RECURSE @CPU_X_DATA_DIRECTORY@) 25 | -------------------------------------------------------------------------------- /src/core/dmidecode/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the dmidecode project. 3 | * 4 | * Copyright (C) 2003-2023 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | 23 | #include "types.h" 24 | 25 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) 26 | 27 | int checksum(const u8 *buf, size_t len); 28 | void *read_file(off_t base, size_t *len, const char *filename); 29 | void *mem_chunk(off_t base, size_t len, const char *devmem); 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us to improve CPU-X 4 | 5 | --- 6 | 7 | 14 | 15 | **Describe the bug/Expected behavior** 16 | 19 | 20 | **Additional information** 21 | * Operating system name and version: 22 | * CPU-X installation type: 23 | 24 | **Bug information** 25 | 29 | ``` 30 | ========================= Backtrace ========================= 31 | PASTE BACKTRACE HERE 32 | ======================== End Backtrace ======================= 33 | ``` 34 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/PKChar.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | FontPK, an object-oriented C font class for PK (TeX) fonts. 3 | Copyright (C) 2018, 2021 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | typedef struct { 22 | short encoding; 23 | short height; 24 | short width; 25 | short xoffset; 26 | short yoffset; 27 | const char* pattern; 28 | } PKChar; 29 | #define kTotalPKChars 256 30 | 31 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/RectStack.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | RectStack, a stack of Rects. 3 | Copyright (C) 2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_RECTSTACK_H 22 | #define _OOC_RECTSTACK_H 23 | 24 | #include "Object.h" 25 | #include "GraphicsTypes.h" 26 | 27 | #include 28 | 29 | #define ValueType Rect 30 | #define StackType RectStack 31 | 32 | #include "StackTemplate.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/core/dmidecode/types.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPES_H 2 | #define TYPES_H 3 | 4 | #include "config.h" 5 | 6 | typedef unsigned char u8; 7 | typedef unsigned short u16; 8 | typedef signed short i16; 9 | typedef unsigned int u32; 10 | typedef unsigned long long int u64; 11 | 12 | /* 13 | * You may use the following defines to adjust the type definitions 14 | * depending on the architecture: 15 | * - Define BIGENDIAN on big-endian systems. 16 | * - Define ALIGNMENT_WORKAROUND if your system doesn't support 17 | * non-aligned memory access. In this case, we use a slower, but safer, 18 | * memory access method. This should be done automatically in config.h 19 | * for architectures which need it. 20 | */ 21 | 22 | /* 23 | * Per SMBIOS v2.8.0 and later, all structures assume a little-endian 24 | * ordering convention. 25 | */ 26 | #if defined(ALIGNMENT_WORKAROUND) || defined(BIGENDIAN) 27 | #define WORD(x) (u16)((x)[0] + ((x)[1] << 8)) 28 | #define DWORD(x) (u32)((x)[0] + ((x)[1] << 8) + ((x)[2] << 16) + ((x)[3] << 24)) 29 | #define QWORD(x) (((u64)DWORD((x) + 4) << 32) + DWORD(x)) 30 | #else /* ALIGNMENT_WORKAROUND || BIGENDIAN */ 31 | #define WORD(x) (u16)(*(const u16 *)(x)) 32 | #define DWORD(x) (u32)(*(const u32 *)(x)) 33 | #define QWORD(x) (u64)(*(const u64 *)(x)) 34 | #endif /* ALIGNMENT_WORKAROUND || BIGENDIAN */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/core/dmidecode/libdmidecode.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE core/dmidecode/libdmidecode.h 22 | */ 23 | 24 | #ifndef _LIBDMIDECODE_H_ 25 | #define _LIBDMIDECODE_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | int dmidecode(int argc, char *const argv[], int quiet, void *cpux_pdata); 33 | 34 | 35 | #ifdef __cplusplus 36 | } /* extern "C" */ 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/daemon/client.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE daemon/client.hpp 22 | */ 23 | 24 | #ifndef _DAEMON_CLIENT_HPP_ 25 | #define _DAEMON_CLIENT_HPP_ 26 | 27 | 28 | /* Start daemon in background */ 29 | const char *start_daemon(bool graphical); 30 | 31 | /* Check if daemon is running */ 32 | bool daemon_is_alive(void); 33 | 34 | /* Establish connection to daemon */ 35 | int connect_to_daemon(int &socket_fd); 36 | 37 | 38 | #endif /* _DAEMON_CLIENT_HPP_ */ 39 | -------------------------------------------------------------------------------- /src/daemon/server.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE daemon/server.hpp 22 | */ 23 | 24 | #ifndef _DAEMON_SERVER_HPP_ 25 | #define _DAEMON_SERVER_HPP_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #define POLL_TIMEOUT (5 * 1000) // 5 seconds 32 | #define NFDS 1 33 | #define LOG_FILE "/tmp/cpu-x-daemon.log" 34 | 35 | 36 | struct ThreadsInfo 37 | { 38 | uint16_t running_threads = 0; 39 | std::mutex mutex; 40 | std::vector threads {}; 41 | }; 42 | 43 | 44 | #endif /* _DAEMON_SERVER_HPP_ */ 45 | -------------------------------------------------------------------------------- /tests/awk/samples/amdgpu_pm_info: -------------------------------------------------------------------------------- 1 | Clock Gating Flags Mask: 0x3fbcf 2 | Graphics Medium Grain Clock Gating: On 3 | Graphics Medium Grain memory Light Sleep: On 4 | Graphics Coarse Grain Clock Gating: On 5 | Graphics Coarse Grain memory Light Sleep: On 6 | Graphics Coarse Grain Tree Shader Clock Gating: Off 7 | Graphics Coarse Grain Tree Shader Light Sleep: Off 8 | Graphics Command Processor Light Sleep: On 9 | Graphics Run List Controller Light Sleep: On 10 | Graphics 3D Coarse Grain Clock Gating: Off 11 | Graphics 3D Coarse Grain memory Light Sleep: Off 12 | Memory Controller Light Sleep: On 13 | Memory Controller Medium Grain Clock Gating: On 14 | System Direct Memory Access Light Sleep: Off 15 | System Direct Memory Access Medium Grain Clock Gating: On 16 | Bus Interface Medium Grain Clock Gating: Off 17 | Bus Interface Light Sleep: On 18 | Unified Video Decoder Medium Grain Clock Gating: On 19 | Video Compression Engine Medium Grain Clock Gating: On 20 | Host Data Path Light Sleep: On 21 | Host Data Path Medium Grain Clock Gating: On 22 | Digital Right Management Medium Grain Clock Gating: Off 23 | Digital Right Management Light Sleep: Off 24 | Rom Medium Grain Clock Gating: On 25 | Data Fabric Medium Grain Clock Gating: Off 26 | 27 | GFX Clocks and Power: 28 | 1000 MHz (MCLK) 29 | 472 MHz (SCLK) 30 | 600 MHz (PSTATE_SCLK) 31 | 1000 MHz (PSTATE_MCLK) 32 | 950 mV (VDDGFX) 33 | 35.114 W (average GPU) 34 | 35 | GPU Temperature: 35 C 36 | GPU Load: 42 % 37 | 38 | UVD: Disabled 39 | 40 | VCE: Disabled 41 | -------------------------------------------------------------------------------- /.github/workflows/update_pot_file.yml: -------------------------------------------------------------------------------- 1 | name: Update POT file 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | workflow_dispatch: 8 | 9 | jobs: 10 | check_new_string: 11 | name: Linux x64_64 (check) 12 | runs-on: ubuntu-latest 13 | 14 | outputs: 15 | output1: ${{ steps.step1.outputs.check_ret }} 16 | 17 | steps: 18 | - uses: actions/checkout@v5 19 | with: 20 | fetch-depth: '0' 21 | 22 | - id: step1 23 | name: Check if POT file needs to be regenerated 24 | run: echo "check_ret=$(bash ./scripts/check_new_strings.sh)" >> $GITHUB_OUTPUT 25 | 26 | update_pot_file: 27 | name: Linux x64_64 (L10n) 28 | runs-on: ubuntu-latest 29 | needs: check_new_string 30 | if: ${{ needs.check_new_string.outputs.output1 == 'REGEN' }} 31 | 32 | steps: 33 | - uses: actions/checkout@v5 34 | 35 | - uses: abbbi/github-actions-tune@v1 36 | 37 | - name: Install packages 38 | run: sudo apt-get install -y -qq cmake ninja-build gettext 39 | 40 | - name: Disable all options in CMakeLists.txt 41 | run: sed -i 's/ ON)$/ OFF)/g' "$GITHUB_WORKSPACE/CMakeLists.txt" 42 | 43 | - name: Generate files for build system 44 | run: cmake -S "$GITHUB_WORKSPACE" -B build -GNinja -DWITH_GETTEXT=1 45 | 46 | - name: Generate new POT file 47 | run: ninja -C build genpot 48 | 49 | - uses: EndBug/add-and-commit@v9 50 | with: 51 | add: 'po' 52 | message: 'Regen POT file' 53 | pull: '--ff-only' 54 | push: true 55 | -------------------------------------------------------------------------------- /src/core/dmidecode/dmioutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic output functions 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2020 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include "dmidecode.h" 23 | 24 | void pr_comment(const char *format, ...); 25 | void pr_info(const char *format, ...); 26 | void pr_handle(const struct dmi_header *h); 27 | void pr_handle_name(const char *format, ...); 28 | void pr_attr(const char *name, const char *format, ...); 29 | void pr_subattr(const char *name, const char *format, ...); 30 | void pr_list_start(const char *name, const char *format, ...); 31 | void pr_list_item(const char *format, ...); 32 | void pr_list_end(void); 33 | void pr_sep(void); 34 | void pr_struct_err(const char *format, ...); 35 | -------------------------------------------------------------------------------- /data/completions/fish: -------------------------------------------------------------------------------- 1 | set -l progname cpu-x 2 | complete -c $progname -f 3 | 4 | set -l noopt 'not __fish_contains_opt -s G -s N -s D -s M -s B V gtk ncurses dump dmidecode bandwidth' 5 | 6 | complete -c $progname -s G -l gtk -n $noopt -d 'Start graphical user interface (GUI)' 7 | complete -c $progname -s N -l ncurses -n $noopt -d 'Start text-based user interface (TUI)' 8 | complete -c $progname -s D -l dump -n $noopt -d 'Dump all data on standard output and exit' 9 | complete -c $progname -s M -l dmidecode -n $noopt -d 'Run embedded command dmidecode and exit' 10 | complete -c $progname -s B -l bandwidth -n $noopt -d 'Run embedded command bandwidth and exit' 11 | complete -c $progname -s h -l help -n $noopt -d 'Print help and exit' 12 | complete -c $progname -s V -l version -n $noopt -d 'Print version and exit' 13 | 14 | complete -c $progname -s r -l refresh -x -d 'Set custom time between two refreshes (in seconds)' 15 | complete -c $progname -s t -l tab -x -d 'Set default tab (integer)' 16 | complete -c $progname -s c -l core -x -d 'Select CPU core to monitor (integer)' 17 | complete -c $progname -s b -l cachetest -x -d 'Set custom bandwidth test for CPU caches speed (integer)' 18 | complete -c $progname -s d -l daemon -d 'Start and connect to daemon' 19 | complete -c $progname -s v -l verbose -d 'Verbose output' 20 | complete -c $progname -l nocolor -d 'Disable colored output' 21 | complete -c $progname -l debug -d 'Print information for debugging' 22 | complete -c $progname -l issue-fmt -d 'Print required informations to paste in an issue' 23 | complete -c $progname -l keymap -x -d 'Set key mapping for NCurses mode (arrows|emacs|inverted-T|vim)' 24 | -------------------------------------------------------------------------------- /cmake/gettext_create_translations.cmake: -------------------------------------------------------------------------------- 1 | # See: /usr/share/cmake-*.*/Modules/FindGettext.cmake 2 | # This is the GETTEXT_CREATE_TRANSLATIONS macro without GETTEXT_MSGMERGE_EXECUTABLE command 3 | 4 | macro(GETTEXT_CONVERT_TRANSLATIONS _potFile _firstPoFileArg) 5 | # make it a real variable, so we can modify it here 6 | set(_firstPoFile "${_firstPoFileArg}") 7 | 8 | set(_gmoFiles) 9 | get_filename_component(_potName ${_potFile} NAME) 10 | string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) 11 | get_filename_component(_absPotFile ${_potFile} ABSOLUTE) 12 | 13 | set(_addToAll) 14 | if(${_firstPoFile} STREQUAL "ALL") 15 | set(_addToAll "ALL") 16 | set(_firstPoFile) 17 | endif() 18 | 19 | foreach (_currentPoFile ${_firstPoFile} ${ARGN}) 20 | get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) 21 | get_filename_component(_abs_PATH ${_absFile} PATH) 22 | get_filename_component(_lang ${_absFile} NAME_WE) 23 | set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) 24 | 25 | add_custom_command( 26 | OUTPUT ${_gmoFile} 27 | COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} 28 | DEPENDS ${_absPotFile} ${_absFile} 29 | ) 30 | 31 | install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) 32 | set(_gmoFiles ${_gmoFiles} ${_gmoFile}) 33 | 34 | endforeach () 35 | 36 | if(NOT TARGET translations) 37 | add_custom_target(translations) 38 | endif() 39 | 40 | _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) 41 | 42 | add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) 43 | 44 | add_dependencies(translations ${uniqueTargetName}) 45 | 46 | endmacro() 47 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/RectStack.c: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | RectStack, an object-oriented C mutable vector class. 3 | Copyright (C) 2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #include 22 | 23 | #include "RectStack.h" 24 | 25 | #define StackType RectStack 26 | #define ValueType Rect 27 | 28 | void RectStack_print (RectStack* self, FILE *outputFile) 29 | { 30 | if (!self) { 31 | return; 32 | } 33 | verifyCorrectClass(self, StackType); 34 | 35 | if (!outputFile) { 36 | outputFile = stdout; 37 | } 38 | 39 | fprintf (outputFile, "%s(%lu)\n", $(self, className), (unsigned long) self->count); 40 | 41 | int index = self->count - 1; 42 | while (index >= 0) { 43 | Rect rect = self->array[index]; 44 | printf ("\tItem %d = ", index); 45 | Rect_print (rect, NULL); 46 | putchar ('\n'); 47 | index--; 48 | } 49 | } 50 | 51 | #include "StackTemplate.c" 52 | 53 | -------------------------------------------------------------------------------- /src/core/dmidecode/dmiopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line handling of dmidecode 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2005-2023 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #if !HAS_LIBPCI 23 | # include "types.h" 24 | #endif 25 | 26 | 27 | struct string_keyword 28 | { 29 | const char *keyword; 30 | u8 type; 31 | u8 offset; 32 | }; 33 | 34 | struct opt 35 | { 36 | const char *devmem; 37 | unsigned int flags; 38 | u8 *type; 39 | const struct string_keyword *string; 40 | char *dumpfile; 41 | u32 handle; 42 | }; 43 | extern struct opt opt; 44 | 45 | #define FLAG_VERSION (1 << 0) 46 | #define FLAG_HELP (1 << 1) 47 | #define FLAG_DUMP (1 << 2) 48 | #define FLAG_QUIET (1 << 3) 49 | #define FLAG_DUMP_BIN (1 << 4) 50 | #define FLAG_FROM_DUMP (1 << 5) 51 | #define FLAG_NO_SYSFS (1 << 6) 52 | #define FLAG_NO_QUIRKS (1 << 7) 53 | #define FLAG_LIST (1 << 8) 54 | 55 | int parse_command_line(int argc, char * const argv[]); 56 | void print_help(void); 57 | -------------------------------------------------------------------------------- /src/logger.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE logger.hpp 22 | */ 23 | 24 | #ifndef _LOGGER_HPP_ 25 | #define _LOGGER_HPP_ 26 | 27 | #include 28 | 29 | #define DEFAULT "\x1b[0m" 30 | #define BOLD_RED "\x1b[1;31m" 31 | #define BOLD_GREEN "\x1b[1;32m" 32 | #define BOLD_YELLOW "\x1b[1;33m" 33 | #define BOLD_BLUE "\x1b[1;34m" 34 | #define BOLD_MAGENTA "\x1b[1;35m" 35 | 36 | 37 | enum LogPriority 38 | { 39 | LOG_DEBUG, 40 | LOG_VERBOSE, 41 | LOG_STANDARD, 42 | LOG_WARNING, 43 | LOG_ERROR, 44 | }; 45 | 46 | class Logger 47 | { 48 | public: 49 | static void set_verbosity(LogPriority priority); 50 | static LogPriority get_verbosity(); 51 | static void log(LogPriority priority, bool print_errno, std::string message); 52 | 53 | private: 54 | static inline LogPriority verbosity = LOG_STANDARD; 55 | Logger() = delete; 56 | ~Logger() = delete; 57 | }; 58 | 59 | 60 | #endif /* _LOGGER_HPP_ */ 61 | -------------------------------------------------------------------------------- /src/core/dmidecode/dmidecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the dmidecode project. 3 | * 4 | * Copyright (C) 2005-2025 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef DMIDECODE_H 22 | #define DMIDECODE_H 23 | 24 | #include "types.h" 25 | 26 | #define out_of_spec "" 27 | 28 | struct dmi_header 29 | { 30 | u8 type; 31 | u8 length; 32 | u16 handle; 33 | u8 *data; 34 | }; 35 | 36 | enum cpuid_type 37 | { 38 | cpuid_none, 39 | cpuid_80386, 40 | cpuid_80486, 41 | cpuid_arm_legacy, 42 | cpuid_arm_soc_id, 43 | cpuid_x86_intel, 44 | cpuid_x86_amd, 45 | cpuid_loongarch, 46 | }; 47 | 48 | extern enum cpuid_type cpuid_type; 49 | 50 | int is_printable(const u8 *data, int len); 51 | const char *dmi_string(const struct dmi_header *dm, u8 s); 52 | void dmi_print_memory_size(const char *attr, u64 code, int shift); 53 | void dmi_print_storage_size(const char *attr, u64 code, unsigned int shift); 54 | void dmi_print_cpuid(void (*print_cb)(const char *name, const char *format, ...), 55 | const char *label, enum cpuid_type sig, const u8 *p); 56 | void dmi_memory_manufacturer_id(const char *attr, u16 code); 57 | void dmi_memory_product_id(const char *attr, u16 code); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Log.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Log, a simple logging facility. 3 | Copyright (C) 2018, 2021 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _LOG_H 22 | #define _LOG_H 23 | 24 | #include "GraphicsTypes.h" 25 | 26 | #include 27 | 28 | extern bool Log_show_debug_output; 29 | 30 | extern bool Log_reopen (const char *path); 31 | extern void Log_close(); 32 | 33 | extern void Log_print (const char *message); 34 | extern void Log_println (const char *message); 35 | 36 | extern void Log_error (const char *whereabouts, const char *message); 37 | extern void Log_warning (const char *whereabouts, const char *message); 38 | extern void Log_debug (const char *whereabouts, const char *message); 39 | extern void Log_errorNullParameter (const char *whereabouts); 40 | extern void Log_perror (const char *whereabouts, const char *calledFunction); 41 | 42 | extern void Log_error_printf (const char *funcName, const char *format, ...); 43 | extern void Log_warning_printf (const char *funcName, const char *format, ...); 44 | extern void Log_debug_printf (const char *funcName, const char *format, ...); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/FontPK.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | FontPK, an object-oriented C font class for PK (TeX) fonts. 3 | Copyright (C) 2018, 2021 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_FONTPK_H 22 | #define _OOC_FONTPK_H 23 | 24 | #include "Font.h" 25 | #include "PKChar.h" 26 | 27 | #define DECLARE_FONTPK_INSTANCE_VARS(TYPE_POINTER) 28 | 29 | #define DECLARE_FONTPK_METHODS(TYPE_POINTER) 30 | 31 | struct fontpk; 32 | 33 | typedef struct fontpkclass { 34 | DECLARE_OBJECT_CLASS_VARS 35 | DECLARE_OBJECT_METHODS(struct fontpk*) 36 | DECLARE_FONT_METHODS(struct fontpk*) 37 | DECLARE_FONTPK_METHODS(struct fontpk*) 38 | } FontPKClass; 39 | 40 | extern FontPKClass *_FontPKClass; 41 | extern FontPKClass* FontPKClass_init (FontPKClass*); 42 | 43 | typedef struct fontpk { 44 | FontPKClass *is_a; 45 | DECLARE_OBJECT_INSTANCE_VARS(struct fontpk*) 46 | DECLARE_FONT_INSTANCE_VARS(struct fontpk*) 47 | DECLARE_FONTPK_INSTANCE_VARS(struct fontpk*) 48 | } FontPK; 49 | 50 | extern FontPK *FontPK_new (); 51 | extern void FontPK_destroy (Any *); 52 | extern FontPK *FontPK_init (FontPK *self); 53 | extern FontPK *FontPK_with (const char *, int size); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Utility.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * This file is part of zBenchmark, which is a system benchmarking tool. 3 | * (C) 2021 Zack T Smith. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | * The author may be reached at 1 at zsmith dot co. 20 | *=======================================================================*/ 21 | 22 | #ifndef _UTILITY_H 23 | #define _UTILITY_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | extern bool file_exists (const char *path); 35 | extern long long get_file_size (const char *path); 36 | extern long get_file_line_count (const char *path); 37 | extern bool read_float_from_file (const char *path, float *); 38 | extern bool read_hex_from_file (const char *path, unsigned long*); 39 | extern bool read_unsigned_from_file (const char *path, unsigned *); 40 | extern bool read_longlong_from_file (const char *path, long long *); 41 | extern unsigned read_trimmed_line_from_file (const char *path, char *result, unsigned maxlen); 42 | extern bool has_prefix (const char *string, const char *prefix); 43 | extern bool has_suffix (const char *string, const char *suffix); 44 | extern char *execute_and_return_first_line (char *cmd); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/core.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE core/core.hpp 22 | */ 23 | 24 | #ifndef _CORE_CORE_HPP_ 25 | #define _CORE_CORE_HPP_ 26 | 27 | #include 28 | #include "data.hpp" 29 | 30 | 31 | /***************************** External headers *****************************/ 32 | 33 | /* Load and apply settings from GSettings */ 34 | void load_settings(void); 35 | 36 | /* Start CPU-X in GTK mode */ 37 | int start_gui_gtk(Data &data); 38 | 39 | /* Start CPU-X in NCurses mode */ 40 | void start_tui_ncurses(Data &data); 41 | 42 | 43 | /************************* Public functions *************************/ 44 | 45 | /* Fill labels by calling core functions */ 46 | int fill_labels(Data &data); 47 | 48 | /* Refresh some labels */ 49 | int do_refresh(Data &data, TabNumber tab_number); 50 | 51 | /* Call Dmidecode through CPU-X but do nothing else */ 52 | int run_dmidecode(std::list &args); 53 | 54 | /* Call Bandwidth through CPU-X but do nothing else */ 55 | int run_bandwidth(std::list &args); 56 | 57 | /* Perform a multithreaded benchmark (compute prime numbers) */ 58 | void start_benchmarks(Data &data); 59 | 60 | 61 | #endif /* _CORE_CORE_HPP_ */ 62 | -------------------------------------------------------------------------------- /cmake/GSettings.cmake: -------------------------------------------------------------------------------- 1 | # See: https://raw.githubusercontent.com/ammonkey/marlin/master/cmake/GSettings.cmake 2 | # GSettings.cmake, CMake macros written for Marlin, feel free to re-use them. 3 | 4 | option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON) 5 | 6 | option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL}) 7 | 8 | if(GSETTINGS_LOCALINSTALL) 9 | message(STATUS "GSettings schemas will be installed locally.") 10 | endif() 11 | 12 | if(GSETTINGS_COMPILE) 13 | message(STATUS "GSettings shemas will be compiled.") 14 | endif() 15 | 16 | macro(add_schema SCHEMA_NAME) 17 | 18 | set(PKG_CONFIG_EXECUTABLE pkg-config) 19 | # Have an option to not install the schema into where GLib is 20 | if (GSETTINGS_LOCALINSTALL) 21 | SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/") 22 | else (GSETTINGS_LOCALINSTALL) 23 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) 24 | SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/") 25 | endif (GSETTINGS_LOCALINSTALL) 26 | 27 | # Run the validator and error if it fails 28 | execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE) 29 | execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE) 30 | 31 | if (_schemas_invalid) 32 | message (SEND_ERROR "Schema validation error: ${_schemas_invalid}") 33 | endif (_schemas_invalid) 34 | 35 | # Actually install and recomple schemas 36 | message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}") 37 | install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL) 38 | 39 | if (GSETTINGS_COMPILE) 40 | install (CODE "message (STATUS \"Compiling GSettings schemas\")") 41 | install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})") 42 | endif () 43 | endmacro() 44 | -------------------------------------------------------------------------------- /vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | VAGRANTFILE_API_VERSION = "2" 2 | VM_CPU = "2" 3 | VM_MEMORY = "4096" 4 | 5 | vms = { 6 | "ubuntu/jammy64" => { :name => "jammy", :bootstrap => "ubuntu" }, 7 | "fedora/38-cloud-base" => { :name => "fedora", :bootstrap => "fedora" } 8 | } 9 | 10 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 11 | config.ssh.disable_deprecated_algorithms = true 12 | 13 | if Vagrant.has_plugin?("vagrant-vbguest") then 14 | config.vbguest.iso_path = "/usr/lib/virtualbox/additions/VBoxGuestAdditions.iso" 15 | config.vbguest.auto_update = false 16 | config.vbguest.no_remote = true 17 | end 18 | 19 | vms.each_with_index do |(box, info), index| 20 | config.vm.define info[:name] do |node| 21 | node.vm.box = box 22 | node.vm.hostname = info[:name] 23 | node.vm.synced_folder ".", "/vagrant", disabled: true 24 | #node.vm.synced_folder '../', '/home/vagrant/CPU-X' 25 | #node.vm.provision :shell, path: "bootstrap_" + info[:bootstrap] + ".sh" 26 | 27 | if Vagrant.has_plugin?("vagrant-proxyconf") 28 | node.proxy.http = ENV['HTTP_PROXY'] || ENV['http_proxy'] || "" 29 | node.proxy.https = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || "" 30 | node.proxy.no_proxy = $no_proxy 31 | end 32 | 33 | node.vm.provider :virtualbox do |vb, override| 34 | vb.name = info[:name] 35 | vb.cpus = VM_CPU 36 | vb.memory = VM_MEMORY 37 | vb.gui = true 38 | vb.customize ["modifyvm", :id, "--vram", "128", "--clipboard-mode=bidirectional", "--drag-and-drop=bidirectional"] 39 | vb.customize ["setextradata", "global", "GUI/Customizations", "noMenuBar"] 40 | node.vm.provision :shell, reboot: true, env: {"HOST_LANG" => ENV['LANG']}, path: "bootstrap_common.sh", args: "virtualbox" 41 | end 42 | 43 | node.vm.provider :libvirt do |libvirt, override| 44 | libvirt.cpus = VM_CPU 45 | libvirt.memory = VM_MEMORY 46 | libvirt.loader = "/usr/share/edk2/x64/OVMF.4m.fd" 47 | libvirt.disk_driver :cache => 'none' 48 | node.vm.provision :shell, reboot: true, env: {"HOST_LANG" => ENV['LANG']}, path: "bootstrap_common.sh", args: "libvirt" 49 | end 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /src/logger.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE logger.cpp 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "options.hpp" 29 | #include "logger.hpp" 30 | 31 | 32 | void Logger::set_verbosity(LogPriority priority) 33 | { 34 | Logger::verbosity = priority; 35 | } 36 | 37 | LogPriority Logger::get_verbosity() 38 | { 39 | return Logger::verbosity; 40 | } 41 | 42 | void Logger::log(LogPriority priority, bool print_errno, std::string message) 43 | { 44 | std::string color; 45 | std::ostream *os; 46 | 47 | if(priority < Logger::verbosity) 48 | return; 49 | 50 | switch(priority) 51 | { 52 | case LOG_DEBUG: os = &std::cout; color = BOLD_MAGENTA; break; 53 | case LOG_VERBOSE: os = &std::cout; color = BOLD_GREEN; break; 54 | case LOG_STANDARD: os = &std::cout; color = DEFAULT; break; 55 | case LOG_WARNING: os = &std::cout; color = BOLD_YELLOW; break; 56 | case LOG_ERROR: os = &std::cerr; color = BOLD_RED; break; 57 | } 58 | 59 | if(Options::get_color()) 60 | *os << color; 61 | *os << message; 62 | if(print_errno) 63 | *os << " (" << std::strerror(errno) << ")"; 64 | if(Options::get_color()) 65 | *os << DEFAULT; 66 | *os << std::endl; 67 | } 68 | -------------------------------------------------------------------------------- /src/core/bandwidth/TestingARM.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | TestingARM, an Object-Oriented C benchmark for aarch64 and aarch32. 3 | Copyright (C) 2022 by Zack T Smith. 4 | 5 | "bandwidth" is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | "bandwidth" is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1 at zsmith dot co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_TESTING_ARM_H 22 | #define _OOC_TESTING_ARM_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "OOC/Object.h" 29 | #include "Testing.h" 30 | 31 | #define DECLARE_TESTING_ARM_INSTANCE_VARS(TYPE_POINTER) 32 | 33 | #define DECLARE_TESTING_ARM_METHODS(TYPE_POINTER) 34 | 35 | struct testing_arm; 36 | 37 | typedef struct testing_arm_class { 38 | DECLARE_OBJECT_CLASS_VARS 39 | DECLARE_OBJECT_METHODS(struct testing_arm*) 40 | DECLARE_TESTING_METHODS(struct testing_arm*) 41 | DECLARE_TESTING_ARM_METHODS(struct testing_arm*) 42 | } TestingARMClass; 43 | 44 | extern TestingARMClass *_TestingARMClass; 45 | extern TestingARMClass *TestingARMClass_init (TestingARMClass*); 46 | 47 | typedef struct testing_arm { 48 | TestingARMClass *is_a; 49 | DECLARE_OBJECT_INSTANCE_VARS(struct testing_arm*) 50 | DECLARE_TESTING_INSTANCE_VARS(struct testing_arm*) 51 | DECLARE_TESTING_ARM_INSTANCE_VARS(struct testing_arm*) 52 | } TestingARM; 53 | 54 | extern TestingARM *TestingARM_new (); 55 | extern TestingARM *TestingARM_init (TestingARM *self); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /tests/awk/test_regex.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEST_DIR="$(dirname "$(realpath "$0")")" 4 | 5 | # shellcheck disable=SC1090 6 | source "$TEST_DIR/../common.sh" 7 | cd "$TEST_DIR/samples" || exit 255 8 | 9 | tmp_dir="$(mktemp --tmpdir --directory CPU-X.XXXXXX)" 10 | for awk in gawk mawk nawk; do 11 | if [[ -z "$(command -v "$awk")" ]]; then 12 | continue 13 | fi 14 | $awk '/Sensor/ { print $5 }' aticonfig-odgt &> "$tmp_dir/aticonfig-odgt.$awk" 15 | $awk '/GPU Load/ { print $3 }' amdgpu_pm_info &> "$tmp_dir/amdgpu_pm_info.$awk" 16 | $awk -F '(: |Mhz)' '/\*/ { print $2 }' pp_dpm_sclk &> "$tmp_dir/pp_dpm_sclk.$awk" 17 | $awk -F '(: |Mhz)' '/\*/ { print $2 }' pp_dpm_mclk &> "$tmp_dir/pp_dpm_mclk.$awk" 18 | $awk '/GPU load/ { sub("%","",$4); print $4 }' aticonfig-odgc &> "$tmp_dir/aticonfig-odgc-load.$awk" 19 | $awk '/Current Clocks/ { print $4 }' aticonfig-odgc &> "$tmp_dir/aticonfig-odgc-sclk.$awk" 20 | $awk '/Current Clocks/ { print $5 }' aticonfig-odgc &> "$tmp_dir/aticonfig-odgc-mclk.$awk" 21 | $awk -F '(sclk: | mclk:)' 'NR==2 { print $2 }' radeon_pm_info &> "$tmp_dir/radeon_pm_info-sclk.$awk" 22 | $awk -F '(mclk: | vddc:)' 'NR==2 { print $2 }' radeon_pm_info &> "$tmp_dir/radeon_pm_info-mclk.$awk" 23 | $awk -F '(vddc: | vddci:)' 'NR==2 { print $2 }' radeon_pm_info &> "$tmp_dir/radeon_pm_info-vddc.$awk" 24 | $awk -F '[,= ]' '{ print $2 }' nvidia-settings-GPUUtilization &> "$tmp_dir/nvidia-settings-GPUUtilization.$awk" 25 | $awk -F '[,]' '{ print $1 }' nvidia-settings-GPUCurrentClockFreqs &> "$tmp_dir/nvidia-settings-GPUCurrentClockFreqs-sclk.$awk" 26 | $awk -F '[,]' '{ print $2 }' nvidia-settings-GPUCurrentClockFreqs &> "$tmp_dir/nvidia-settings-GPUCurrentClockFreqs-mclk.$awk" 27 | done 28 | 29 | cd "$tmp_dir" || exit 255 30 | failed=0 31 | for res_file in *; do 32 | exp_file="$TEST_DIR/results/$(basename "${res_file%.*}")" 33 | printf "%-50s: " "$res_file" 34 | if cmp --quiet "$exp_file" "$res_file"; then 35 | success "OK" 36 | else 37 | error "KO" "(got '$(< "$res_file")', wanted '$(< "$exp_file")')" 38 | ((failed++)) 39 | fi 40 | done 41 | summary "$failed" 42 | rm -rf "$tmp_dir" 43 | -------------------------------------------------------------------------------- /src/core/bandwidth/TestingRISCV.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | TestingRISCV, an Object-Oriented C benchmark for riscv64. 3 | Copyright (C) 2023 by Zack T Smith. 4 | 5 | "bandwidth" is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | "bandwidth" is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1 at zsmith dot co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_TESTING_RISCV_H 22 | #define _OOC_TESTING_RISCV_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "OOC/Object.h" 29 | #include "Testing.h" 30 | 31 | #define DECLARE_TESTING_RISCV_INSTANCE_VARS(TYPE_POINTER) 32 | 33 | #define DECLARE_TESTING_RISCV_METHODS(TYPE_POINTER) 34 | 35 | struct testing_riscv; 36 | 37 | typedef struct testing_riscv_class { 38 | DECLARE_OBJECT_CLASS_VARS 39 | DECLARE_OBJECT_METHODS(struct testing_riscv*) 40 | DECLARE_TESTING_METHODS(struct testing_riscv*) 41 | DECLARE_TESTING_RISCV_METHODS(struct testing_riscv*) 42 | } TestingRISCVClass; 43 | 44 | extern TestingRISCVClass *_TestingRISCVClass; 45 | extern TestingRISCVClass *TestingRISCVClass_init (TestingRISCVClass*); 46 | 47 | typedef struct testing_riscv { 48 | TestingRISCVClass *is_a; 49 | DECLARE_OBJECT_INSTANCE_VARS(struct testing_riscv*) 50 | DECLARE_TESTING_INSTANCE_VARS(struct testing_riscv*) 51 | DECLARE_TESTING_RISCV_INSTANCE_VARS(struct testing_riscv*) 52 | } TestingRISCV; 53 | 54 | extern TestingRISCV *TestingRISCV_new (); 55 | extern TestingRISCV *TestingRISCV_init (TestingRISCV *self); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Controller.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Controller, an object-oriented C user interface controller class. 3 | Copyright (C) 2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_CONTROLLER_H 22 | #define _OOC_CONTROLLER_H 23 | 24 | #include "Window.h" 25 | 26 | #define DECLARE_CONTROLLER_INSTANCE_VARS(FOO) \ 27 | Window *window; 28 | 29 | #define DECLARE_CONTROLLER_METHODS(TYPE_POINTER) \ 30 | bool (*construct) (TYPE_POINTER); /* If returns false => construct failed */ \ 31 | bool (*update) (TYPE_POINTER); /* If returns false => app should exit */ \ 32 | void (*layout) (TYPE_POINTER); \ 33 | void (*dismantle) (TYPE_POINTER); \ 34 | void (*setWindow) (TYPE_POINTER, Any*); \ 35 | Window *(*window) (TYPE_POINTER); 36 | 37 | struct controller; 38 | 39 | typedef struct controllerclass { 40 | DECLARE_OBJECT_CLASS_VARS 41 | DECLARE_OBJECT_METHODS(struct controller*) 42 | DECLARE_CONTROLLER_METHODS(struct controller*) 43 | } ControllerClass; 44 | 45 | extern ControllerClass *_ControllerClass; 46 | extern ControllerClass* ControllerClass_init (ControllerClass*); 47 | 48 | typedef struct controller { 49 | ControllerClass *is_a; 50 | DECLARE_OBJECT_INSTANCE_VARS(struct controller*) 51 | DECLARE_CONTROLLER_INSTANCE_VARS(struct controller*) 52 | } Controller; 53 | 54 | extern void Controller_destroy (Any *); 55 | extern Controller *Controller_init (Controller *self); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/FontBuiltin.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | FontBuiltin, an object-oriented C font class for the built-in font. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_FONTBUILTIN_H 22 | #define _OOC_FONTBUILTIN_H 23 | 24 | #include "Font.h" 25 | 26 | #define DECLARE_FONTBUILTIN_INSTANCE_VARS(TYPE_POINTER) 27 | 28 | #define DECLARE_FONTBUILTIN_METHODS(TYPE_POINTER) 29 | 30 | struct fontbuiltin; 31 | 32 | typedef struct fontbuiltinclass { 33 | DECLARE_OBJECT_CLASS_VARS 34 | DECLARE_OBJECT_METHODS(struct fontbuiltin*) 35 | DECLARE_FONT_METHODS(struct fontbuiltin*) 36 | DECLARE_FONTBUILTIN_METHODS(struct fontbuiltin*) 37 | } FontBuiltinClass; 38 | 39 | extern FontBuiltinClass *_FontBuiltinClass; 40 | extern FontBuiltinClass* FontBuiltinClass_init (FontBuiltinClass*); 41 | 42 | typedef struct fontbuiltin { 43 | FontBuiltinClass *is_a; 44 | DECLARE_OBJECT_INSTANCE_VARS(struct fontbuiltin*) 45 | DECLARE_FONT_INSTANCE_VARS(struct fontbuiltin*) 46 | DECLARE_FONTBUILTIN_INSTANCE_VARS(struct fontbuiltin*) 47 | } FontBuiltin; 48 | 49 | extern FontBuiltin *FontBuiltin_new (); 50 | extern void FontBuiltin_destroy (Any *); 51 | extern FontBuiltin *FontBuiltin_init (FontBuiltin *self); 52 | extern FontBuiltin *FontBuiltin_with (const char* name, int size, bool bold, bool italic); 53 | 54 | #define _FontBuiltin() FontBuiltin_with(NULL,14,false,false) 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/core/dmidecode/AUTHORS: -------------------------------------------------------------------------------- 1 | DEVELOPER AND MAINTAINER 2 | Jean Delvare 3 | 4 | ORIGINAL AUTHORS 5 | Alan Cox 6 | Jean Delvare 7 | 8 | CODE CONTRIBUTORS (IN CHRONOLOGICAL ORDER) 9 | Matt Domsch 10 | Arjan van de Ven 11 | Mark D. Studebaker 12 | Larry Lile 13 | Dave Johnson 14 | Petter Reinholdtsen 15 | Roberto Nibali 16 | John Cagle 17 | Jens Elkner 18 | Jarod Wilson 19 | Anton Arapov 20 | Roy Franz 21 | Tyler Bell 22 | Xie XiuQi 23 | Petr Oros 24 | Prabhakar Pujeri 25 | Erwan Velu 26 | Jerry Hoemann 27 | 28 | MANY THANKS TO (IN CHRONOLOGICAL ORDER) 29 | Werner Heuser 30 | Alexandre Duret-Lutz 31 | Xavier Roche 32 | Pamela Huntley 33 | Gael Stephan 34 | Sebastian Henschel 35 | Richard Sharpe 36 | David Wilson 37 | Glen Foster 38 | Chad Smith 39 | Joshua Goldenhar 40 | Luc Van de Velde 41 | Mario Lang 42 | Hugues Lepesant 43 | Sergey Leonovich 44 | Mike Cooper 45 | Marc Rieffel 46 | Jeff Moyer 47 | Josef Moellers 48 | Zing Zing Shishak 49 | Rafael Avila de Espindola 50 | Roger Koot 51 | Martin Pool 52 | Doug Brenner 53 | Alex Williamson 54 | Durval Menezes 55 | Raphael Raimbault 56 | Raul Nunez de Arenas Coronado 57 | Francois Revol 58 | Dominik Klein 59 | Erwan Velu 60 | Don Howard 61 | Frans Pop 62 | Tomek Mateja 63 | Myke Olson 64 | Torsten Seemann 65 | Garry Belka 66 | Klaus Muth 67 | Antoine Fuselier 68 | Matthew Garrett 69 | Landry Breuil 70 | Luke Suchocki 71 | Attila Nagy 72 | Alex Iribarren 73 | Sebastien Douche 74 | William Lallemand 75 | Olivier Guerrier 76 | Pascal Terjan 77 | Stuart Hayes 78 | Sofian Brabez 79 | Vincent Pelletier 80 | Andreas Gruenbacher 81 | Lin Li 82 | Thomas Hiller 83 | Paul Flo Williams 84 | Olof Johansson 85 | Alexandre Lissy 86 | Michal Svec 87 | Vojtech Pavlik 88 | Murlin Wenzel 89 | Harald Mueller-Ney 90 | Lars Mueller 91 | Thomas Mingarelli 92 | Andrey Matveyev 93 | Stefan Tauner 94 | Naga Chumbalkar 95 | Jens Rosenboom 96 | Lianbo Jiang 97 | Tianjia Zhang 98 | Ivan Tkachenko 99 | -------------------------------------------------------------------------------- /src/core/bandwidth/TestingX86.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | TestingX86, an Object-Oriented C benchmark for i386 and x86_64. 3 | Copyright (C) 2022, 2023 by Zack T Smith. 4 | 5 | "bandwidth" is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | "bandwidth" is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1 at zsmith dot co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_TESTING_X86_H 22 | #define _OOC_TESTING_X86_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "OOC/Object.h" 29 | #include "Testing.h" 30 | 31 | #define DECLARE_TESTING_X86_INSTANCE_VARS(TYPE_POINTER) \ 32 | bool use_sse2; \ 33 | bool use_sse4; \ 34 | bool use_avx; \ 35 | bool use_avx512; \ 36 | bool use_direct_transfers; 37 | 38 | #define DECLARE_TESTING_X86_METHODS(TYPE_POINTER) 39 | 40 | struct testing_x86; 41 | 42 | typedef struct testing_x86_class { 43 | DECLARE_OBJECT_CLASS_VARS 44 | DECLARE_OBJECT_METHODS(struct testing_x86*) 45 | DECLARE_TESTING_METHODS(struct testing_x86*) 46 | DECLARE_TESTING_X86_METHODS(struct testing_x86*) 47 | } TestingX86Class; 48 | 49 | extern TestingX86Class *_TestingX86Class; 50 | extern TestingX86Class *TestingX86Class_init (TestingX86Class*); 51 | 52 | typedef struct testing_x86 { 53 | TestingX86Class *is_a; 54 | DECLARE_OBJECT_INSTANCE_VARS(struct testing_x86*) 55 | DECLARE_TESTING_INSTANCE_VARS(struct testing_x86*) 56 | DECLARE_TESTING_X86_INSTANCE_VARS(struct testing_x86*) 57 | } TestingX86; 58 | 59 | extern TestingX86 *TestingX86_new (); 60 | extern TestingX86 *TestingX86_init (TestingX86 *self); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/core/bandwidth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(bandwidth 2 | VERSION "1.14.10" 3 | LANGUAGES C 4 | ) 5 | 6 | # Config (bandwidth) 7 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-sign-compare -Wno-type-limits -Wno-strict-prototypes -Wno-unused-parameter") 8 | 9 | if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") 10 | set(NASM_FLAGS_DEBUG "-gdwarf") 11 | endif(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") 12 | 13 | # Build (bandwidth) 14 | check_language(ASM_NASM) 15 | if(CMAKE_ASM_NASM_COMPILER) 16 | enable_language(ASM_NASM) 17 | set(BANDWIDTH_FOUND ON PARENT_SCOPE) 18 | message(STATUS "Using built-in ${PROJECT_NAME}, version ${PROJECT_VERSION}, object format ${CMAKE_ASM_NASM_OBJECT_FORMAT}") 19 | 20 | # NASM routines build 21 | if(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "elf64" OR CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "elfx32") 22 | set(ROUTINES "routines-x86-64bit") 23 | set(UTILITY "utility-x86-64bit") 24 | else() 25 | set(ROUTINES "routines-x86-32bit") 26 | set(UTILITY "utility-x86-32bit") 27 | endif() 28 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ROUTINES}.o 29 | COMMAND ${CMAKE_ASM_NASM_COMPILER} ${NASM_FLAGS_DEBUG} -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} ${ROUTINES}.asm -o ${CMAKE_CURRENT_BINARY_DIR}/${ROUTINES}.o 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 31 | ) 32 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${UTILITY}.o 33 | COMMAND ${CMAKE_ASM_NASM_COMPILER} ${NASM_FLAGS_DEBUG} -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} ${UTILITY}.asm -o ${CMAKE_CURRENT_BINARY_DIR}/${UTILITY}.o 34 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OOC 35 | ) 36 | 37 | if(LIBCPUID_FOUND AND WITH_LIBCPUID) 38 | add_definitions(-DHAS_LIBCPUID=1) 39 | else(LIBCPUID_FOUND AND WITH_LIBCPUID) 40 | add_definitions(-DHAS_LIBCPUID=0) 41 | endif(LIBCPUID_FOUND AND WITH_LIBCPUID) 42 | 43 | file(GLOB OOC_FILES 44 | "OOC/*.c" 45 | "OOC/*.h" 46 | ) 47 | add_library(bandwidth 48 | STATIC 49 | ${OOC_FILES} 50 | main.c 51 | libbandwidth.h 52 | Testing.c 53 | TestingX86.c 54 | ${ROUTINES}.o 55 | ${UTILITY}.o 56 | ) 57 | 58 | target_link_libraries(bandwidth) 59 | set(BANDWIDTH_VERSION ${PROJECT_VERSION} PARENT_SCOPE) 60 | 61 | else(CMAKE_ASM_NASM_COMPILER) 62 | set(BANDWIDTH_FOUND OFF PARENT_SCOPE) 63 | endif(CMAKE_ASM_NASM_COMPILER) 64 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Console.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Console, an object-oriented C console I/O class. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_CONSOLE_H 22 | #define _OOC_CONSOLE_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | #include "String.h" 29 | 30 | #define DECLARE_CONSOLE_INSTANCE_VARS(FOO) 31 | 32 | #define DECLARE_CONSOLE_METHODS(TYPE_POINTER) \ 33 | void (*newline) (TYPE_POINTER); \ 34 | void (*flush) (TYPE_POINTER); \ 35 | void (*puts) (TYPE_POINTER, const char*); \ 36 | void (*printInt) (TYPE_POINTER, int); \ 37 | void (*printUnsigned) (TYPE_POINTER, unsigned); \ 38 | void (*printf) (TYPE_POINTER, const char* fmt, ...); \ 39 | void (*printObject) (TYPE_POINTER, Any*); 40 | 41 | struct console; 42 | 43 | typedef struct consoleclass { 44 | DECLARE_OBJECT_CLASS_VARS 45 | DECLARE_OBJECT_METHODS(struct console*) 46 | DECLARE_CONSOLE_METHODS(struct console*) 47 | } ConsoleClass; 48 | 49 | extern ConsoleClass *_ConsoleClass; 50 | extern ConsoleClass* ConsoleClass_init (ConsoleClass*); 51 | 52 | typedef struct console { 53 | ConsoleClass *is_a; 54 | DECLARE_OBJECT_INSTANCE_VARS(struct console*) 55 | DECLARE_CONSOLE_INSTANCE_VARS(struct console*) 56 | } Console; 57 | 58 | extern Console *Console_singleton (); 59 | extern Console *Console_new (); 60 | extern void Console_destroy (Any*); 61 | extern Console *Console_init (Console *self); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Double.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Double, an object-oriented C floating point class. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_DOUBLE_H 22 | #define _OOC_DOUBLE_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | 29 | #define DECLARE_DOUBLE_INSTANCE_VARS(FOO) \ 30 | double floatingPoint; 31 | 32 | #define DECLARE_DOUBLE_METHODS(TYPE_POINTER) \ 33 | long long (*asLongLong) (TYPE_POINTER); \ 34 | bool (*asBool) (TYPE_POINTER); \ 35 | double (*asDouble) (TYPE_POINTER); 36 | 37 | struct floatingpoint; 38 | 39 | typedef struct floatingpointclass { 40 | DECLARE_OBJECT_CLASS_VARS 41 | DECLARE_OBJECT_METHODS(struct floatingpoint*) 42 | DECLARE_DOUBLE_METHODS(struct floatingpoint*) 43 | } DoubleClass; 44 | 45 | extern DoubleClass *_DoubleClass; 46 | extern DoubleClass* DoubleClass_init (DoubleClass*); 47 | 48 | typedef struct floatingpoint { 49 | DoubleClass *is_a; 50 | DECLARE_OBJECT_INSTANCE_VARS(struct floatingpoint*) 51 | DECLARE_DOUBLE_INSTANCE_VARS(struct floatingpoint*) 52 | } Double; 53 | 54 | extern Double *Double_new (); 55 | extern Double *Double_init (Double *self); 56 | extern void Double_destroy (Any *); 57 | extern Double *Double_withLongLong (long long value); 58 | extern Double *Double_withDouble (double value); 59 | extern Double *Double_withUTF8String (const char *string); 60 | 61 | // Convenience instantiator macro 62 | #define _Double(VALUE) Double_withDouble((double)VALUE) 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/FontFreetype.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | FontFreetype, an object-oriented C class to provide TTF fonts. 3 | This code originates from my FrugalWidgets project. 4 | Copyright (C) 2019 by Zack T Smith. 5 | 6 | Object-Oriented C is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published 8 | by the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Object-Oriented C is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with this software. If not, see . 18 | 19 | The author may be reached at 1@zsmith.co. 20 | *===========================================================================*/ 21 | 22 | #ifndef _OOC_FONTFREETYPE_H 23 | #define _OOC_FONTFREETYPE_H 24 | 25 | #include "Font.h" 26 | 27 | #define DECLARE_FONTFREETYPE_INSTANCE_VARS(TYPE_POINTER) \ 28 | 29 | #define DECLARE_FONTFREETYPE_METHODS(TYPE_POINTER) \ 30 | 31 | struct fontfreetype; 32 | 33 | typedef struct fontfreetypeclass { 34 | DECLARE_OBJECT_CLASS_VARS 35 | DECLARE_OBJECT_METHODS(struct fontfreetype*) 36 | DECLARE_FONT_METHODS(struct fontfreetype*) 37 | DECLARE_FONTFREETYPE_METHODS(struct fontfreetype*) 38 | } FontFreetypeClass; 39 | 40 | extern FontFreetypeClass *_FontFreetypeClass; 41 | 42 | typedef struct fontfreetype { 43 | FontFreetypeClass *is_a; 44 | DECLARE_OBJECT_INSTANCE_VARS(struct fontfreetype*) 45 | DECLARE_FONT_INSTANCE_VARS(struct fontfreetype*) 46 | DECLARE_FONTFREETYPE_INSTANCE_VARS(struct fontfreetype*) 47 | } FontFreetype; 48 | 49 | extern FontFreetypeClass *FontFreetypeClass_init (FontFreetypeClass *class); 50 | 51 | extern bool FontFreetype_isAvailable (void); 52 | extern FontFreetype *FontFreetype_new (void); 53 | extern FontFreetype *FontFreetype_init (FontFreetype *self); 54 | extern FontFreetype *FontFreetype_fromFile (const char* path, int size); 55 | // extern FontFreetype *FontFreetype_newWith (const char* name, int size, bool bold, bool italic); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Int.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Int, an object-oriented C integer class. 3 | Copyright (C) 2019, 2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_INT_H 22 | #define _OOC_INT_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | 29 | #define DECLARE_INT_INSTANCE_VARS(FOO) \ 30 | long long integer; 31 | 32 | #define DECLARE_INT_METHODS(TYPE_POINTER) \ 33 | int (*asInt) (TYPE_POINTER); \ 34 | long long (*asLongLong) (TYPE_POINTER); \ 35 | bool (*asBool) (TYPE_POINTER); \ 36 | double (*asDouble) (TYPE_POINTER); \ 37 | const char* (*asCString) (TYPE_POINTER); 38 | 39 | struct integer; 40 | 41 | typedef struct integerclass { 42 | DECLARE_OBJECT_CLASS_VARS 43 | DECLARE_OBJECT_METHODS(struct integer*) 44 | DECLARE_INT_METHODS(struct integer*) 45 | } IntClass; 46 | 47 | extern IntClass *_IntClass; 48 | extern IntClass* IntClass_init (IntClass*); 49 | 50 | typedef struct integer { 51 | IntClass *is_a; 52 | DECLARE_OBJECT_INSTANCE_VARS(struct integer*) 53 | DECLARE_INT_INSTANCE_VARS(struct integer*) 54 | } Int; 55 | 56 | extern Int *Int_new (); 57 | extern void Int_destroy (Any *); 58 | extern Int *Int_init (Int *self); 59 | extern Int* Int_withBool (bool); 60 | extern Int* Int_withUnsignedLong (unsigned long value); 61 | extern Int* Int_withLongLong (long long value); 62 | extern Int* Int_withDouble (double value); 63 | extern Int* Int_fromCString (const char*); 64 | extern Int* Int_fromFile (const char* path); 65 | 66 | // Convenience instantiator macro 67 | #define _Int(VALUE) Int_withLongLong((long long)VALUE) 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/OperatingSystem.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | OperatingSystem, an object-oriented C operating system information class. 3 | Copyright (C) 2009-2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_OPERATINGSYSTEM_H 22 | #define _OOC_OPERATINGSYSTEM_H 23 | 24 | #include "String.h" 25 | #include "MutableArray.h" 26 | 27 | #define DECLARE_OPERATINGSYSTEM_METHODS(TYPE_POINTER) \ 28 | long (*load) (TYPE_POINTER); \ 29 | long (*uptime) (TYPE_POINTER); \ 30 | unsigned (*memoryPageSize) (TYPE_POINTER); \ 31 | String* (*osType) (TYPE_POINTER); \ 32 | String* (*kernelName) (TYPE_POINTER); \ 33 | String* (*kernelRelease) (TYPE_POINTER); \ 34 | String* (*username) (TYPE_POINTER); \ 35 | unsigned (*userid) (TYPE_POINTER); 36 | 37 | struct operatingsysteminfo; 38 | 39 | typedef struct operatingsysteminfoclass { 40 | DECLARE_OBJECT_CLASS_VARS 41 | DECLARE_OBJECT_METHODS(struct operatingsysteminfo*) 42 | DECLARE_OPERATINGSYSTEM_METHODS(struct operatingsysteminfo*) 43 | } OperatingSystemClass; 44 | 45 | extern OperatingSystemClass *_OperatingSystemClass; 46 | extern OperatingSystemClass* OperatingSystemClass_init (OperatingSystemClass*); 47 | 48 | #define DECLARE_OPERATINGSYSTEM_INSTANCE_VARS(TYPE_POINTER) 49 | 50 | typedef struct operatingsysteminfo { 51 | OperatingSystemClass *is_a; 52 | DECLARE_OBJECT_INSTANCE_VARS(struct operatingsysteminfo*) 53 | DECLARE_OPERATINGSYSTEM_INSTANCE_VARS(struct operatingsysteminfo*) 54 | } OperatingSystem; 55 | 56 | extern OperatingSystem* OperatingSystem_init (OperatingSystem* object); 57 | extern void OperatingSystem_destroy (Any* object); 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /scripts/build_libcpuid.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | BUILD_PATH="$(mktemp --directory --tmpdir libcpuid-build.XXXXXX)" 6 | BUILD_TYPE="Debug" 7 | CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX:-/usr}" 8 | 9 | display_help() { 10 | echo "Usage: $(basename "$0") [-t BUILD_TYPE]" 11 | echo -e "\nOptional arguments:" 12 | echo " -t BUILD_TYPE CMake build type (Debug (default), Release, RelWithDebInfo or MinSizeRel)" 13 | } 14 | 15 | while getopts "t:i:h" opt; do 16 | case "$opt" in 17 | t) BUILD_TYPE="$OPTARG";; 18 | h) display_help; exit 0;; 19 | *) display_help; exit 1;; 20 | esac 21 | done 22 | 23 | if [[ -f "/etc/os-release" ]]; then 24 | source "/etc/os-release" 25 | elif [[ -f "/usr/lib/os-release" ]]; then 26 | source /usr/lib/os-release 27 | else 28 | echo "os-release file is not present." 29 | exit 1 30 | fi 31 | echo "Install packages for $ID" 32 | case "$ID" in 33 | arch|archarm) 34 | sudo pacman -S --noconfirm \ 35 | base-devel \ 36 | cmake \ 37 | git \ 38 | ninja 39 | ;; 40 | 41 | debian) 42 | sudo apt-get install -y -qq \ 43 | build-essential \ 44 | cmake \ 45 | ninja-build \ 46 | git 47 | ;; 48 | 49 | fedora) 50 | sudo dnf group install -y development-tools 51 | sudo dnf install -y \ 52 | cmake \ 53 | ninja-build \ 54 | git 55 | ;; 56 | 57 | freebsd) 58 | CMAKE_INSTALL_PREFIX="/usr/local" 59 | sudo pkg install -y \ 60 | cmake \ 61 | ninja \ 62 | git 63 | # workaround for libcpuid 64 | ln -s /usr/local/lib/pkgconfig/libcpuid.pc /usr/local/libdata/pkgconfig/libcpuid.pc 65 | ;; 66 | 67 | opensuse-leap) 68 | sudo zypper install -y -t pattern devel_basis 69 | sudo zypper install -y \ 70 | cmake \ 71 | ninja \ 72 | git 73 | ;; 74 | 75 | ubuntu) 76 | sudo apt-get install -y -qq \ 77 | gcc \ 78 | cmake \ 79 | ninja-build \ 80 | git 81 | ;; 82 | 83 | *) 84 | echo "ID '$ID' is not supported by $0." 85 | exit 1 86 | esac 87 | 88 | echo "Clone libcpuid Git repository to $BUILD_PATH" 89 | git clone https://github.com/anrieff/libcpuid.git "$BUILD_PATH" 90 | cd "$BUILD_PATH" 91 | 92 | echo "Run CMake ($BUILD_TYPE)" 93 | cmake -B build \ 94 | -GNinja \ 95 | -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ 96 | -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \ 97 | -DBUILD_SHARED_LIBS=OFF 98 | 99 | echo "Build libcpuid" 100 | cmake --build build 101 | 102 | echo "Install libcpuid to system" 103 | sudo cmake --install build 104 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/MutableData.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | MutableData, an object-oriented C mutable byte array class. 3 | Copyright (C) 2021-2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_MUTABLEDATA_H 22 | #define _OOC_MUTABLEDATA_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | #include "Data.h" 29 | 30 | struct mutabledata; 31 | 32 | #define DECLARE_MUTABLEDATA_METHODS(TYPE_POINTER) \ 33 | void (*appendData) (TYPE_POINTER, void*); \ 34 | void (*appendByte) (TYPE_POINTER, uint8_t); \ 35 | void (*appendBytes) (TYPE_POINTER, uint8_t* bytes, size_t length); \ 36 | void (*truncateAt) (TYPE_POINTER, size_t); 37 | 38 | typedef struct mutabledataclass { 39 | DECLARE_OBJECT_CLASS_VARS 40 | DECLARE_OBJECT_METHODS(struct mutabledata*) 41 | DECLARE_DATA_METHODS(struct mutabledata*) 42 | DECLARE_MUTABLEDATA_METHODS(struct mutabledata*) 43 | } MutableDataClass; 44 | 45 | extern MutableDataClass *_MutableDataClass; 46 | extern MutableDataClass* MutableDataClass_init (MutableDataClass*); 47 | 48 | #define DECLARE_MUTABLEDATA_INSTANCE_VARS(TYPE_POINTER) \ 49 | size_t allocatedSize; 50 | 51 | typedef struct mutabledata { 52 | MutableDataClass *is_a; 53 | DECLARE_OBJECT_INSTANCE_VARS(struct mutabledata*) 54 | DECLARE_DATA_INSTANCE_VARS(struct mutabledata*) 55 | DECLARE_MUTABLEDATA_INSTANCE_VARS(struct mutabledata*) 56 | } MutableData; 57 | 58 | extern MutableData* MutableData_init (MutableData* object); 59 | extern void MutableData_destroy (Any *); 60 | extern MutableData* MutableData_withBytes (const uint8_t *bytes, size_t length); 61 | extern MutableData* MutableData_withCString (const char *string); 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Array.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Array, an object-oriented C array class. 3 | Copyright (C) 2019, 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_ARRAY_H 22 | #define _OOC_ARRAY_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | 29 | #define DECLARE_ARRAY_INSTANCE_VARS(FOO) \ 30 | size_t total;\ 31 | size_t size;\ 32 | Object **array; 33 | 34 | #define DECLARE_ARRAY_METHODS(TYPE_POINTER) \ 35 | size_t (*count) (TYPE_POINTER); \ 36 | Any* (*at) (TYPE_POINTER, long); \ 37 | Any* (*first) (TYPE_POINTER); \ 38 | Any* (*last) (TYPE_POINTER); \ 39 | bool (*contains) (TYPE_POINTER, Any *object); 40 | 41 | struct array; 42 | 43 | typedef struct arrayclass { 44 | DECLARE_OBJECT_CLASS_VARS 45 | DECLARE_OBJECT_METHODS(struct array*) 46 | DECLARE_ARRAY_METHODS(struct array*) 47 | } ArrayClass; 48 | 49 | extern ArrayClass *_ArrayClass; 50 | 51 | typedef struct array { 52 | ArrayClass *is_a; 53 | DECLARE_OBJECT_INSTANCE_VARS(struct array*) 54 | DECLARE_ARRAY_INSTANCE_VARS(struct array*) 55 | } Array; 56 | 57 | extern ArrayClass* ArrayClass_init (ArrayClass*); 58 | Array *Array_new (void); 59 | Array *Array_init (Array *self); 60 | void Array_destroy (Any *self); 61 | Array* Array_withObject (Any *object); 62 | Array* Array_withArray (Any *arrayToCopy); 63 | 64 | // These have to be listed here so that MutableArray can inherit them. 65 | size_t Array_count (Array *); 66 | void Array_print (Array *, FILE*); 67 | Any* Array_at (Array *, long); 68 | bool Array_contains (Array *self, Any* object); 69 | Any* Array_first (Array *); 70 | Any* Array_last (Array *); 71 | bool Array_equals (Array *self, Any* other); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Dictionary.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Dictionary, an object-oriented C immutable dictionary class. 3 | Copyright (C) 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_DICTIONARY_H 22 | #define _OOC_DICTIONARY_H 23 | 24 | #include "Object.h" 25 | #include "String.h" 26 | 27 | typedef struct dictionary_list_item { 28 | String *key; 29 | Object *value; 30 | struct dictionary_list_item *next; 31 | } DictionaryListItem; 32 | 33 | typedef enum { 34 | DictionarySizeSmall = 0, // small number of buckets 35 | DictionarySizeMedium = 1, // medium number of buckets 36 | DictionarySizeLarge = 2, // large number of buckets 37 | } DictionarySize; 38 | 39 | #define DECLARE_DICTIONARY_METHODS(TYPE_POINTER) \ 40 | Object *(*object) (TYPE_POINTER, String* /* key */); \ 41 | Array *(*keys) (TYPE_POINTER); \ 42 | unsigned (*count) (TYPE_POINTER); 43 | 44 | struct dictionary; 45 | 46 | typedef struct dictionaryclass { 47 | DECLARE_OBJECT_CLASS_VARS 48 | DECLARE_OBJECT_METHODS(struct dictionary*) 49 | DECLARE_DICTIONARY_METHODS(struct dictionary*) 50 | } DictionaryClass; 51 | 52 | extern DictionaryClass *_DictionaryClass; 53 | extern DictionaryClass* DictionaryClass_init (DictionaryClass*); 54 | 55 | #define DECLARE_DICTIONARY_INSTANCE_VARS(TYPE_POINTER) \ 56 | unsigned nBuckets; \ 57 | DictionaryListItem **buckets; 58 | 59 | typedef struct dictionary { 60 | DictionaryClass *is_a; 61 | DECLARE_OBJECT_INSTANCE_VARS(struct dictionary*) 62 | DECLARE_DICTIONARY_INSTANCE_VARS(struct dictionary*) 63 | } Dictionary; 64 | 65 | extern Dictionary* Dictionary_init (Dictionary*); 66 | extern Dictionary* Dictionary_newWith (String*, Object*); // TODO Need variadic variant. 67 | extern void Dictionary_destroy (Any *); 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(data 2 | LANGUAGES NONE 3 | ) 4 | 5 | 6 | add_subdirectory(completions) 7 | 8 | # Files needed by GTK GUI 9 | if(WITH_GTK) 10 | include(GSettings) 11 | 12 | # Set config 13 | file(MAKE_DIRECTORY ${CMAKE_DATA_OUTPUT_DIRECTORY}) 14 | if(GETTEXT_FOUND) 15 | set(TMP_DESKTOP_FILE_FILENAME "${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x.desktop.in") 16 | set(OUTPUT_DESKTOP_FILE_FILENAME "${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x.desktop") 17 | add_custom_command( 18 | OUTPUT "${OUTPUT_DESKTOP_FILE_FILENAME}" 19 | DEPENDS "${TMP_DESKTOP_FILE_FILENAME}" 20 | COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} 21 | --desktop 22 | --template="${TMP_DESKTOP_FILE_FILENAME}" 23 | -d "${CMAKE_SOURCE_DIR}/po" 24 | --output-file="${OUTPUT_DESKTOP_FILE_FILENAME}" 25 | ) 26 | add_custom_target ( 27 | gendesktop ALL DEPENDS 28 | "${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x.desktop" 29 | ) 30 | else() 31 | set(TMP_DESKTOP_FILE_FILENAME "${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x.desktop") 32 | endif(GETTEXT_FOUND) 33 | configure_file(io.github.thetumultuousunicornofdarkness.cpu-x.desktop.in ${TMP_DESKTOP_FILE_FILENAME}) 34 | configure_file(io.github.thetumultuousunicornofdarkness.cpu-x-daemon.policy.in ${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x-daemon.policy) 35 | 36 | # Install UIs 37 | install(FILES 38 | cpu-x-gtk-3.12.ui 39 | cpu-x-gtk-3.12.css 40 | cpu-x-gtk-3.12-dark.css 41 | cpu-x-gtk-3.20.css 42 | cpu-x-gtk-3.20-dark.css 43 | DESTINATION ${CPU_X_DATA_DIRECTORY}/ 44 | ) 45 | 46 | # AppData metainfo file 47 | install(FILES 48 | io.github.thetumultuousunicornofdarkness.cpu-x.appdata.xml 49 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo/ 50 | ) 51 | 52 | # Install launcher 53 | install(FILES 54 | ${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x.desktop 55 | DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications/ 56 | ) 57 | 58 | # Install policy rule 59 | pkg_get_variable(POLKIT_ACTION_DIR polkit-gobject-1 actiondir) 60 | if(POLKIT_ACTION_DIR STREQUAL "") 61 | set(POLKIT_ACTION_DIR "${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/actions/") 62 | endif(POLKIT_ACTION_DIR STREQUAL "") 63 | install(FILES 64 | ${CMAKE_DATA_OUTPUT_DIRECTORY}/io.github.thetumultuousunicornofdarkness.cpu-x-daemon.policy 65 | DESTINATION ${POLKIT_ACTION_DIR} 66 | ) 67 | 68 | # Install schema file 69 | add_schema("io.github.thetumultuousunicornofdarkness.cpu-x.gschema.xml") 70 | 71 | add_subdirectory(icons) 72 | add_subdirectory(logos) 73 | endif(WITH_GTK) 74 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Object.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Object, an object-oriented C base object class. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_OBJECT_H 22 | #define _OOC_OBJECT_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "ObjectOriented.h" 30 | 31 | struct object; 32 | 33 | #ifdef __clang__ 34 | #if __has_extension(blocks) 35 | // Future support for blocks 36 | #endif 37 | #endif 38 | 39 | extern uint64_t g_totalObjectAllocations; 40 | extern uint64_t g_totalObjectDeallocations; 41 | 42 | #define DECLARE_OBJECT_INSTANCE_VARS(TYPE_POINTER) \ 43 | unsigned magic : 31; \ 44 | unsigned temporary : 1; \ 45 | int32_t retainCount; 46 | 47 | #define DECLARE_OBJECT_METHODS(TYPE_POINTER) \ 48 | void *(*class) (TYPE_POINTER); \ 49 | const char *(*className) (TYPE_POINTER); \ 50 | void (*destroy) (Any*); \ 51 | unsigned (*hash) (TYPE_POINTER); \ 52 | void (*describe) (TYPE_POINTER, FILE*); \ 53 | bool (*equals) (TYPE_POINTER, Any*); \ 54 | void (*print) (TYPE_POINTER, FILE*); \ 55 | int (*compare) (TYPE_POINTER, Any*); \ 56 | long (*message) (TYPE_POINTER, long message, Any *sender, long, long); 57 | 58 | #define DECLARE_OBJECT_CLASS_VARS DECLARE_EMPTY_CLASS_VARS 59 | 60 | typedef struct object_class { 61 | DECLARE_OBJECT_CLASS_VARS 62 | DECLARE_OBJECT_METHODS(struct object*) 63 | } ObjectClass; 64 | 65 | extern ObjectClass *_ObjectClass; 66 | extern ObjectClass* ObjectClass_init (ObjectClass*); 67 | 68 | typedef struct object { 69 | ObjectClass *is_a; 70 | DECLARE_OBJECT_INSTANCE_VARS(struct object*) 71 | } Object; 72 | 73 | extern Object* Object_init (Object *object); 74 | extern void Object_destroy (Any *object); 75 | extern void Object_print (Object* self, FILE *file); 76 | extern bool Object_equals (Object *self, Any *other); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /vagrant/bootstrap_common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PROVIDER="$1" 4 | source /etc/os-release 5 | 6 | if [[ "$ID" == "ubuntu" ]]; then 7 | export DEBIAN_FRONTEND=noninteractive 8 | sed -i 's/1/0/g' /etc/apt/apt.conf.d/20auto-upgrades 9 | apt-get update -y 10 | apt-get upgrade -y 11 | apt-get install -y --no-install-recommends ubuntu-desktop unity-lens-applications unity-lens-files fonts-inconsolata gdm3 gnome-terminal firefox dbus-x11 console-data 12 | case "$PROVIDER" in 13 | virtualbox) apt-get install -y --no-install-recommends virtualbox-guest-utils virtualbox-guest-x11;; 14 | libvirt) apt-get install -y --no-install-recommends qemu-guest-agent spice-vdagent; systemctl enable qemu-guest-agent;; 15 | esac 16 | 17 | echo "/usr/sbin/gdm3" > /etc/X11/default-display-manager 18 | systemctl enable --now gdm3.service 19 | DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure gdm3 20 | echo "set shared/default-x-display-manager gdm3" | debconf-communicate 21 | 22 | GDM_CONFIG_DIR="/etc/gdm3" 23 | GDM_DEFAULT_SESSION="Ubuntu" 24 | elif [[ "$ID" == "fedora" ]]; then 25 | dnf update -y 26 | dnf -y group install GNOME --allowerasing 27 | dnf install -y levien-inconsolata-fonts firefox xdg-user-dirs dbus-x11 polkit-gnome gnome-tweak-tool 28 | case "$PROVIDER" in 29 | virtualbox) dnf install -y virtualbox-guest-additions;; 30 | libvirt) dnf install -y qemu-guest-agent spice-vdagent; systemctl enable qemu-guest-agent;; 31 | esac 32 | 33 | usermod -a -G wheel vagrant 34 | GDM_CONFIG_DIR="/etc/gdm" 35 | GDM_DEFAULT_SESSION="GNOME" 36 | else 37 | echo "$ID not supported." > /dev/stderr 38 | exit 1 39 | fi 40 | 41 | # System settings 42 | localectl set-keymap "${HOST_LANG//[_.]*/}" 43 | if ! grep -q "127.0.0.1 $(hostname)" /etc/hosts; then 44 | echo "127.0.0.1 $(hostname)" >> /etc/hosts 45 | fi 46 | 47 | # Autologin to GDM 48 | mkdir -pv "$GDM_CONFIG_DIR" 49 | cat > "$GDM_CONFIG_DIR/custom.conf" << EOF 50 | [daemon] 51 | AutomaticLogin=vagrant 52 | AutomaticLoginEnable=True 53 | DefaultSession=$GDM_DEFAULT_SESSION 54 | EOF 55 | systemctl set-default graphical.target 56 | systemctl restart gdm 57 | 58 | # Vagrant user 59 | passwd --delete vagrant 60 | su - vagrant -c "xdg-user-dirs-update --force" 61 | su - vagrant -c "dbus-launch gsettings set org.gnome.desktop.input-sources sources '[]'" 62 | su - vagrant -c "dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false" 63 | su - vagrant -c "dbus-launch gsettings set org.gnome.desktop.session idle-delay 0" 64 | su - vagrant -c "dbus-launch gsettings set org.gnome.desktop.lockdown disable-lock-screen true" 65 | su - vagrant -c "dbus-launch gsettings set org.gnome.desktop.interface monospace-font-name 'Inconsolata Regular 12'" 66 | su - vagrant -c "echo yes > /home/vagrant/.config/gnome-initial-setup-done" 67 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Keycodes.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * This file is part of FrugalWidgets, which is a user interface library 3 | * that supports multiple platforms and animation. 4 | * 5 | * (C) 2004-2019 Zack T Smith, 1@zsmith.co. All rights reserved. 6 | *=======================================================================*/ 7 | 8 | #ifndef _FW_KEYCODES 9 | #define _FW_KEYCODES 10 | 11 | enum { 12 | kKeycode_0='0', 13 | kKeycode_1, 14 | kKeycode_2, 15 | kKeycode_3, 16 | kKeycode_4, 17 | kKeycode_5, 18 | kKeycode_6, 19 | kKeycode_7, 20 | kKeycode_8, 21 | kKeycode_9, 22 | kKeycode_BackSpace = 8, 23 | kKeycode_Escape=27, 24 | kKeycode_Return=10, 25 | kKeycode_A='A', 26 | kKeycode_B, 27 | kKeycode_C, 28 | kKeycode_D, 29 | kKeycode_E, 30 | kKeycode_F, 31 | kKeycode_G, 32 | kKeycode_H, 33 | kKeycode_I, 34 | kKeycode_J, 35 | kKeycode_K, 36 | kKeycode_L, 37 | kKeycode_M, 38 | kKeycode_N, 39 | kKeycode_O, 40 | kKeycode_P, 41 | kKeycode_Q, 42 | kKeycode_R, 43 | kKeycode_S, 44 | kKeycode_T, 45 | kKeycode_U, 46 | kKeycode_V, 47 | kKeycode_W, 48 | kKeycode_X, 49 | kKeycode_Y, 50 | kKeycode_Z, 51 | kKeycode_a = 'a', 52 | kKeycode_b, 53 | kKeycode_c, 54 | kKeycode_d, 55 | kKeycode_e, 56 | kKeycode_f, 57 | kKeycode_g, 58 | kKeycode_h, 59 | kKeycode_i, 60 | kKeycode_j, 61 | kKeycode_k, 62 | kKeycode_l, 63 | kKeycode_m, 64 | kKeycode_n, 65 | kKeycode_o, 66 | kKeycode_p, 67 | kKeycode_q, 68 | kKeycode_r, 69 | kKeycode_s, 70 | kKeycode_t, 71 | kKeycode_u, 72 | kKeycode_v, 73 | kKeycode_w, 74 | kKeycode_x, 75 | kKeycode_y, 76 | kKeycode_z, 77 | kKeycode_slash = '/', 78 | kKeycode_period = '.', 79 | kKeycode_minus = '-', 80 | kKeycode_grave = '`', 81 | kKeycode_equal = '=', 82 | kKeycode_backslash = '\\', 83 | kKeycode_comma = ',', 84 | kKeycode_Tilde = '~', 85 | kKeycode_Delete = 127, 86 | 87 | kKeycode_Shift_L = 2000, 88 | kKeycode_Shift_R, 89 | kKeycode_Control_L, 90 | kKeycode_Control_R, 91 | kKeycode_Down, 92 | kKeycode_Left, 93 | kKeycode_Right, 94 | kKeycode_Tab, 95 | kKeycode_Up, 96 | kKeycode_Alt_L, 97 | kKeycode_Meta_L, 98 | kKeycode_Alt_R, 99 | kKeycode_Meta_R, 100 | kKeycode_PageUp, 101 | kKeycode_PageDown, 102 | kKeycode_Home, 103 | kKeycode_Insert, 104 | kKeycode_End, 105 | kKeycode_F1, 106 | kKeycode_F2, 107 | kKeycode_F3, 108 | kKeycode_F4, 109 | kKeycode_F5, 110 | kKeycode_F6, 111 | kKeycode_F7, 112 | kKeycode_F8, 113 | kKeycode_F9, 114 | kKeycode_F10, 115 | kKeycode_F11, 116 | kKeycode_F12, 117 | kKeycode_ScrollLock, 118 | kKeycode_NumLock, 119 | kKeycode_CapsLock, 120 | kKeycode_PrintScreen, 121 | }; 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/MutableArray.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | MutableArray, an object-oriented C mutable array class. 3 | Copyright (C) 2019, 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_MUTABLEARRAY_H 22 | #define _OOC_MUTABLEARRAY_H 23 | 24 | #include "Object.h" 25 | #include "Array.h" 26 | 27 | #define DECLARE_MUTABLE_ARRAY_INSTANCE_VARS(TYPE_POINTER) /* Nothing additional required */ 28 | 29 | #define DECLARE_MUTABLE_ARRAY_METHODS(TYPE_POINTER) \ 30 | void (*append) (TYPE_POINTER, Any *object); \ 31 | void (*prepend) (TYPE_POINTER, Any *object); \ 32 | void (*insertAt) (TYPE_POINTER, Any*, unsigned index); \ 33 | void (*remove) (TYPE_POINTER, Any*); \ 34 | void (*removeAt) (TYPE_POINTER, unsigned index); \ 35 | void (*removeFirst) (TYPE_POINTER); \ 36 | void (*removeLast) (TYPE_POINTER); \ 37 | void (*removeAll) (TYPE_POINTER); \ 38 | void (*reverse) (TYPE_POINTER); \ 39 | void (*quicksort) (TYPE_POINTER); \ 40 | void (*randomize) (TYPE_POINTER); 41 | 42 | struct mutablearray; 43 | 44 | typedef struct mutablearrayclass { 45 | DECLARE_OBJECT_CLASS_VARS 46 | DECLARE_OBJECT_METHODS(struct mutablearray*) 47 | DECLARE_ARRAY_METHODS(struct mutablearray*) 48 | DECLARE_MUTABLE_ARRAY_METHODS(struct mutablearray*) 49 | } MutableArrayClass; 50 | 51 | extern MutableArrayClass *_MutableArrayClass; 52 | extern MutableArrayClass* MutableArrayClass_init (MutableArrayClass*); 53 | 54 | typedef struct mutablearray { 55 | MutableArrayClass *is_a; 56 | DECLARE_OBJECT_INSTANCE_VARS(struct mutablearray*) 57 | DECLARE_ARRAY_INSTANCE_VARS(struct mutablearray*) 58 | DECLARE_MUTABLE_ARRAY_INSTANCE_VARS(struct mutablearray*) 59 | } MutableArray; 60 | 61 | extern MutableArray *MutableArray_new (); 62 | extern void MutableArray_destroy (Any *); 63 | extern MutableArray *MutableArray_init (MutableArray* self); 64 | extern MutableArray* MutableArray_withObject (Any *object); 65 | extern MutableArray* MutableArray_withArray (MutableArray *arrayToCopy); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Data.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Data, an object-oriented C immutable byte array Data class. 3 | Copyright (C) 2021-2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_DATA_H 22 | #define _OOC_DATA_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | 29 | #define DECLARE_DATA_METHODS(TYPE_POINTER) \ 30 | uint8_t *(*bytes) (TYPE_POINTER); \ 31 | size_t (*length) (TYPE_POINTER); \ 32 | uint8_t (*byteAt) (TYPE_POINTER, size_t); \ 33 | char *(*asCString) (TYPE_POINTER); /* Caller frees the string */ \ 34 | unsigned long (*sum) (TYPE_POINTER); \ 35 | bool (*writeToFilePath) (TYPE_POINTER, const char *path); 36 | 37 | struct dataobject; 38 | 39 | typedef struct dataobjectclass { 40 | DECLARE_OBJECT_CLASS_VARS 41 | DECLARE_OBJECT_METHODS(struct dataobject*) 42 | DECLARE_DATA_METHODS(struct dataobject*) 43 | } DataClass; 44 | 45 | extern DataClass *_DataClass; 46 | extern DataClass* DataClass_init (DataClass*); 47 | 48 | #define DECLARE_DATA_INSTANCE_VARS(TYPE_POINTER) \ 49 | size_t nBytes; \ 50 | uint8_t *bytes; \ 51 | bool isMemoryMappedFile; 52 | 53 | typedef struct dataobject { 54 | DataClass *is_a; 55 | DECLARE_OBJECT_INSTANCE_VARS(struct dataobject*) 56 | DECLARE_DATA_INSTANCE_VARS(struct dataobject*) 57 | } Data; 58 | 59 | extern Data* Data_init (Data* object); 60 | extern Data* Data_initWithData (Data* self, void *other); 61 | extern Data* Data_initFromFilePath (Data* self, const char *path); 62 | extern Data* Data_initWithUTF8String (Data* self, const char *); 63 | extern Data* Data_withData (Any *other); 64 | extern Data* Data_withBytes (uint8_t *bytes, size_t length); 65 | extern void Data_destroy (Any *); 66 | 67 | // Inherited by mutable data 68 | extern void Data_describe (Data *, FILE *); 69 | extern void Data_print (Data* self, FILE *); 70 | extern bool Data_equals (Data* self, void *other); 71 | extern size_t Data_length (Data *self); 72 | extern uint8_t *Data_bytes (Data *self); 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(po 2 | LANGUAGES NONE 3 | ) 4 | 5 | 6 | ### INTERNATIONALIZATION TARGETS 7 | 8 | # PO files 9 | set(pot_file ${CMAKE_PROJECT_NAME}.pot) 10 | file(GLOB 11 | po_files 12 | *.po 13 | ) 14 | 15 | if(GETTEXT_FOUND) 16 | set(GETTEXT_FOUND ON PARENT_SCOPE) 17 | include(gettext_create_translations) 18 | file(GLOB_RECURSE CPP_FILES 19 | RELATIVE "${CMAKE_SOURCE_DIR}/src" 20 | "${CMAKE_SOURCE_DIR}/src/*.c" 21 | "${CMAKE_SOURCE_DIR}/src/*.cpp" 22 | "${CMAKE_SOURCE_DIR}/src/*.h" 23 | "${CMAKE_SOURCE_DIR}/src/*.hpp" 24 | ) 25 | add_custom_target(genpot 26 | COMMAND xgettext 27 | --language=C++ 28 | --keyword=_ --keyword=N_ --indent 29 | --add-comments=TRANSLATORS: 30 | --package-name=${CMAKE_PROJECT_NAME} 31 | --package-version=${PROJECT_VERSION} 32 | --default-domain=${CMAKE_PROJECT_NAME} 33 | --msgid-bugs-address=https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/issues 34 | --copyright-holder=TheTumultuousUnicornOfDarkness 35 | --output-dir=${CMAKE_CURRENT_BINARY_DIR} 36 | --output=source_c.pot 37 | --directory="${CMAKE_SOURCE_DIR}/src" 38 | --from-code="utf-8" 39 | ${CPP_FILES} 40 | COMMAND xgettext 41 | --language=Glade 42 | --keyword=translatable --indent 43 | --add-comments 44 | --package-name=${CMAKE_PROJECT_NAME} 45 | --package-version=${PROJECT_VERSION} 46 | --default-domain=${CMAKE_PROJECT_NAME} 47 | --msgid-bugs-address=https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/issues 48 | --copyright-holder=TheTumultuousUnicornOfDarkness 49 | --output-dir=${CMAKE_CURRENT_BINARY_DIR} 50 | --output=source_ui.pot 51 | --directory="${CMAKE_SOURCE_DIR}/data" 52 | --from-code="utf-8" 53 | "cpu-x-gtk-3.12.ui" 54 | COMMAND xgettext 55 | --language=Desktop 56 | --keyword --keyword=Comment --keyword=Keywords --indent 57 | --package-name=${CMAKE_PROJECT_NAME} 58 | --package-version=${PROJECT_VERSION} 59 | --default-domain=${CMAKE_PROJECT_NAME} 60 | --msgid-bugs-address=https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/issues 61 | --copyright-holder=TheTumultuousUnicornOfDarkness 62 | --output-dir=${CMAKE_CURRENT_BINARY_DIR} 63 | --output=source_desktop.pot 64 | --directory="${CMAKE_SOURCE_DIR}/data" 65 | --from-code="utf-8" 66 | "io.github.thetumultuousunicornofdarkness.cpu-x.desktop.in" 67 | COMMAND msgcat --indent --directory=${CMAKE_CURRENT_BINARY_DIR} source_c.pot source_ui.pot source_desktop.pot --output-file="${CMAKE_CURRENT_SOURCE_DIR}/${pot_file}" 68 | COMMAND sed --in-place "s/SOME DESCRIPTIVE TITLE./CPU-X translations template/" "${CMAKE_CURRENT_SOURCE_DIR}/${pot_file}" 69 | COMMAND sed --in-place "s/\\(C\\) YEAR/© 2014-2025/" "${CMAKE_CURRENT_SOURCE_DIR}/${pot_file}" 70 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src 71 | ) 72 | GETTEXT_CONVERT_TRANSLATIONS(${pot_file} ALL ${po_files}) 73 | else(GETTEXT_FOUND) 74 | set(GETTEXT_FOUND OFF PARENT_SCOPE) 75 | endif(GETTEXT_FOUND) 76 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/CPU.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | CPU, an object-oriented C CPU information class. 3 | Copyright (C) 2009-2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_CPU_H 22 | #define _OOC_CPU_H 23 | 24 | #include "String.h" 25 | #include "MutableArray.h" 26 | 27 | #define DECLARE_CPU_METHODS(TYPE_POINTER) \ 28 | String* (*family) (TYPE_POINTER); \ 29 | String* (*make) (TYPE_POINTER); \ 30 | String* (*model) (TYPE_POINTER); \ 31 | MutableArray* (*features) (TYPE_POINTER); \ 32 | unsigned (*registerSize) (TYPE_POINTER); \ 33 | String* (*instructionSet) (TYPE_POINTER); \ 34 | unsigned (*nCores) (TYPE_POINTER); \ 35 | bool (*hasVectorUnit) (TYPE_POINTER); \ 36 | unsigned (*levelNCacheSize) (TYPE_POINTER, unsigned, unsigned, bool); \ 37 | float (*maximumSpeed) (TYPE_POINTER, unsigned); /* GHz */ \ 38 | float (*minimumSpeed) (TYPE_POINTER, unsigned); /* GHz */ \ 39 | float (*currentSpeed) (TYPE_POINTER, unsigned); /* GHz */ \ 40 | bool (*has128bitVectors) (TYPE_POINTER); \ 41 | bool (*has256bitVectors) (TYPE_POINTER); \ 42 | bool (*has512bitVectors) (TYPE_POINTER); \ 43 | float (*temperature) (TYPE_POINTER, unsigned); 44 | 45 | struct cpu; 46 | 47 | typedef struct cpuclass { 48 | DECLARE_OBJECT_CLASS_VARS 49 | DECLARE_OBJECT_METHODS(struct cpu*) 50 | DECLARE_CPU_METHODS(struct cpu*) 51 | } CPUClass; 52 | 53 | extern CPUClass *_CPUClass; 54 | extern CPUClass* CPUClass_init (CPUClass*); 55 | 56 | #define DECLARE_CPU_INSTANCE_VARS(TYPE_POINTER) \ 57 | MutableArray *features; \ 58 | unsigned nCores; \ 59 | unsigned *level1d_sizes;\ 60 | unsigned *level1i_sizes;\ 61 | unsigned *level2_sizes;\ 62 | unsigned *level3_sizes;\ 63 | bool has128bitVectors;\ 64 | bool has128bitCacheBypass;\ 65 | bool has256bitVectors;\ 66 | bool has512bitVectors;\ 67 | bool is_intel; 68 | 69 | typedef struct cpu { 70 | CPUClass *is_a; 71 | DECLARE_OBJECT_INSTANCE_VARS(struct cpu*) 72 | DECLARE_CPU_INSTANCE_VARS(struct cpu*) 73 | } CPU; 74 | 75 | extern CPU* CPU_init (CPU* object); 76 | extern void CPU_destroy (Any* object); 77 | 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/DateTime.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | DateTime, an object-oriented C date and time class. 3 | This file is part of OOC. 4 | 5 | Copyright (C) 2019 by Zack T Smith. 6 | 7 | Object-Oriented C is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU Lesser General Public License as published 9 | by the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | Object-Oriented C is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public License 18 | along with this software. If not, see . 19 | 20 | The author may be reached at 1@zsmith.co. 21 | *===========================================================================*/ 22 | 23 | #ifndef _DATETIME 24 | #define _DATETIME 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "Object.h" 31 | 32 | #define DECLARE_DATETIME_INSTANCE_VARS(FOO) \ 33 | unsigned int year; \ 34 | unsigned int month; \ 35 | unsigned int day; \ 36 | unsigned int hour; \ 37 | unsigned int minute; \ 38 | unsigned int seconds; \ 39 | unsigned int dayOfWeek; 40 | 41 | struct datetime; 42 | 43 | #define DECLARE_DATETIME_METHODS(TYPE_POINTER) \ 44 | TYPE_POINTER (*previousDay) (TYPE_POINTER); \ 45 | TYPE_POINTER (*nextDay )(TYPE_POINTER); \ 46 | const char *(*dateString) (TYPE_POINTER, char); \ 47 | const char *(*timeString) (TYPE_POINTER, char); 48 | 49 | typedef struct datetimeclass { 50 | DECLARE_OBJECT_CLASS_VARS 51 | DECLARE_OBJECT_METHODS(struct datetime*) 52 | DECLARE_DATETIME_METHODS(struct datetime*) 53 | } DateTimeClass; 54 | 55 | typedef struct datetime { 56 | DateTimeClass *is_a; 57 | DECLARE_OBJECT_INSTANCE_VARS(struct datetime*) 58 | DECLARE_DATETIME_INSTANCE_VARS(struct datetime*) 59 | } DateTime; 60 | 61 | DateTime *DateTime_now (); 62 | 63 | extern DateTimeClass *_DateTimeClass; 64 | extern DateTimeClass* DateTimeClass_init (DateTimeClass*); 65 | 66 | extern DateTime *DateTime_new (); 67 | extern void DateTime_destroy (Any *); 68 | extern DateTime *DateTime_init (DateTime *self); 69 | extern const char *DateTime_dateString (DateTime *, char); 70 | extern DateTime *DateTime_previousDay (DateTime *); 71 | extern DateTime *DateTime_nextDay (DateTime *); 72 | 73 | // Class methods 74 | extern uint64_t DateTime_getMicrosecondTime (); 75 | extern uint64_t DateTime_getMillisecondTime (); 76 | extern void DateTime_getDate (int *year, int *month, int *day); 77 | extern const char *DateTime_getTodayString (char); 78 | extern int DateTime_getWeekDayNumber (); 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/core/bandwidth/libbandwidth.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE core/bandwidth/libbandwidth.h 22 | */ 23 | 24 | #ifndef _LIBBANDWIDTH_H_ 25 | #define _LIBBANDWIDTH_H_ 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #define BANDWIDTH_MAX_CACHE_LEVEL 4 34 | #define TEST_NAME_BUFFER_LEN 64 35 | 36 | enum EnTests 37 | { 38 | // Sequential reads 39 | SEQ_WS_R, 40 | SEQ_128_R, 41 | SEQ_256_R, 42 | SEQ_512_R, 43 | // Sequential nontemporal reads 44 | SEQ_WS_NT_R, 45 | SEQ_128_NT_R, 46 | SEQ_256_NT_R, 47 | SEQ_512_NT_R, 48 | // Sequential writes 49 | SEQ_WS_W, 50 | SEQ_128_W, 51 | SEQ_256_W, 52 | SEQ_512_W, 53 | // Sequential nontemporal writes 54 | SEQ_WS_NT_W, 55 | SEQ_128_NT_W, 56 | SEQ_256_NT_W, 57 | SEQ_512_NT_W, 58 | // Random reads 59 | RAND_WS_R, 60 | RAND_128_R, 61 | RAND_256_R, 62 | // Random nontemporal reads 63 | RAND_128_NT_R, 64 | RAND_256_NT_R, 65 | // Random writes 66 | RAND_WS_W, 67 | RAND_128_W, 68 | RAND_256_W, 69 | // Random nontemporal writes 70 | RAND_128_NT_W, 71 | RAND_256_NT_W, 72 | // Sequential copy 73 | SEQ_WS_C, 74 | SEQ_128_C, 75 | SEQ_256_C, 76 | SEQ_512_C, 77 | // Sentinel value 78 | BANDWIDTH_LAST_TEST 79 | }; 80 | 81 | struct Tests 82 | { 83 | enum EnTests test; 84 | char *name; 85 | bool support_instr; 86 | long (*func_ptr) (void*, unsigned long, int, bool); 87 | int testing_mode; 88 | bool random; 89 | }; 90 | 91 | struct BandwidthData 92 | { 93 | uint8_t selected_test; 94 | uint32_t cache_size[BANDWIDTH_MAX_CACHE_LEVEL]; 95 | uint32_t cache_speed[BANDWIDTH_MAX_CACHE_LEVEL]; 96 | bool *test_supported; 97 | char **test_name; 98 | pthread_mutex_t mutex; 99 | }; 100 | 101 | 102 | int bandwidth_main(int argc, char *const argv[]); 103 | int bandwidth_cpux(struct BandwidthData *bwd); 104 | 105 | 106 | #ifdef __cplusplus 107 | } /* extern "C" */ 108 | #endif 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux build 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | workflow_dispatch: 11 | 12 | env: 13 | BUILD_TYPE: Debug 14 | 15 | jobs: 16 | linux-build: 17 | name: ${{ matrix.os.image }} ${{ matrix.os.arch }} (Build) 18 | runs-on: ${{ matrix.os.label }} 19 | strategy: 20 | matrix: 21 | os: 22 | # x86_64 (https://github.com/actions/runner-images/tree/main/images/ubuntu) 23 | - { arch: x86_64, label: ubuntu-24.04, image: archlinux:base-devel } 24 | - { arch: x86_64, label: ubuntu-24.04, image: debian:11 } 25 | - { arch: x86_64, label: ubuntu-24.04, image: debian:12 } 26 | - { arch: x86_64, label: ubuntu-24.04, image: fedora:40 } 27 | - { arch: x86_64, label: ubuntu-24.04, image: fedora:41 } 28 | - { arch: x86_64, label: ubuntu-24.04, image: opensuse/leap:15.6 } 29 | - { arch: x86_64, label: ubuntu-24.04, image: ubuntu:22.04 } 30 | - { arch: x86_64, label: ubuntu-24.04, image: ubuntu:24.04 } 31 | - { arch: x86_64, label: ubuntu-24.04, image: ubuntu:25.04 } 32 | # ARM64 (https://github.com/actions/partner-runner-images) 33 | - { arch: aarch64, label: ubuntu-24.04-arm, image: debian:11 } 34 | - { arch: aarch64, label: ubuntu-24.04-arm, image: debian:12 } 35 | - { arch: aarch64, label: ubuntu-24.04-arm, image: fedora:40 } 36 | - { arch: aarch64, label: ubuntu-24.04-arm, image: fedora:41 } 37 | - { arch: aarch64, label: ubuntu-24.04-arm, image: opensuse/leap:15.6 } 38 | - { arch: aarch64, label: ubuntu-24.04-arm, image: ubuntu:22.04 } 39 | - { arch: aarch64, label: ubuntu-24.04-arm, image: ubuntu:24.04 } 40 | - { arch: aarch64, label: ubuntu-24.04-arm, image: ubuntu:25.04 } 41 | 42 | container: ${{ matrix.os.image }} 43 | 44 | steps: 45 | - name: Install prerequisites 46 | run: | 47 | if command -v pacman; then 48 | pacman -Syu --noconfirm sudo 49 | elif command -v dnf; then 50 | dnf update -y 51 | dnf install -y sudo 52 | elif command -v zypper; then 53 | zypper update -y 54 | zypper install -y sudo tar gzip 55 | elif command -v apt-get; then 56 | apt-get update -y -qq 57 | apt-get install -y -qq sudo 58 | fi 59 | 60 | - uses: actions/checkout@v5 61 | 62 | - name: Build libcpuid 63 | run: ./scripts/build_libcpuid.sh -t "$BUILD_TYPE" 64 | 65 | - name: Build CPU-X 66 | run: ./scripts/build_cpu_x.sh -s "$GITHUB_WORKSPACE" -t "$BUILD_TYPE" 67 | 68 | - name: Run tests 69 | run: ninja -C build test 70 | 71 | - name: Run CPU-X 72 | run: | 73 | error=0 74 | sudo CPUX_BCLK=100 cpu-x --issue-fmt || error=1 75 | cat /tmp/cpu-x.log 76 | cat /tmp/cpu-x-daemon.log 77 | exit $error 78 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/MutableString.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | MutableString, an object-oriented C string manipulation class. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_MUTABLESTRING_H 22 | #define _OOC_MUTABLESTRING_H 23 | 24 | #include 25 | #include 26 | 27 | #include "Object.h" 28 | #include "String.h" 29 | 30 | #define DECLARE_MUTABLESTRING_METHODS(TYPE_POINTER) \ 31 | void (*setCString) (TYPE_POINTER, const char*); \ 32 | void (*setWide) (TYPE_POINTER, const wchar_t*); \ 33 | void (*setString) (TYPE_POINTER, String*); \ 34 | void (*appendCString) (TYPE_POINTER, const char *); \ 35 | void (*appendWide) (TYPE_POINTER, const wchar_t *string); \ 36 | void (*appendString) (TYPE_POINTER, String*); \ 37 | void (*appendCharacter) (TYPE_POINTER, wchar_t); \ 38 | void (*insertCharacterAt) (TYPE_POINTER, wchar_t, unsigned index); \ 39 | void (*truncateAt) (TYPE_POINTER, int); \ 40 | void (*appendFormat) (TYPE_POINTER, const char* fmt, ...); 41 | 42 | struct mutablestring; 43 | 44 | typedef struct mutablestringclass { 45 | DECLARE_OBJECT_CLASS_VARS 46 | DECLARE_OBJECT_METHODS(struct mutablestring*) 47 | DECLARE_STRING_METHODS(struct mutablestring*) 48 | DECLARE_MUTABLESTRING_METHODS(struct mutablestring*) 49 | } MutableStringClass; 50 | 51 | extern MutableStringClass *_MutableStringClass; 52 | extern MutableStringClass* MutableStringClass_init (MutableStringClass*); 53 | 54 | #define DECLARE_MUTABLESTRING_INSTANCE_VARS(TYPE_POINTER) \ 55 | int _allocatedSize; 56 | 57 | typedef struct mutablestring { 58 | MutableStringClass *is_a; 59 | DECLARE_OBJECT_INSTANCE_VARS(struct mutablestring*) 60 | DECLARE_STRING_INSTANCE_VARS(struct mutablestring*) 61 | DECLARE_MUTABLESTRING_INSTANCE_VARS(struct mutablestring*) 62 | } MutableString; 63 | 64 | extern MutableString* MutableString_init (MutableString* object); 65 | extern MutableString* MutableString_withCString (const char*); 66 | extern MutableString* MutableString_initWithCString (MutableString* self, const char *str); 67 | extern void MutableString_destroy (Any *); 68 | 69 | #define _MutableString(STR) MutableString_withCString(STR) 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Display.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Display, an object-oriented C OpenGL display class. 3 | Copyright (C) 2019, 2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | // This code is derived from my FrugalWidgets project. 22 | 23 | #ifndef _OOC_DISPLAY_H 24 | #define _OOC_DISPLAY_H 25 | 26 | #include "Object.h" 27 | #include "GraphicsTypes.h" 28 | #include "Log.h" 29 | 30 | #define kDisplayShiftFlag (1) 31 | #define kDisplayAltFlag (2) 32 | #define kDisplayControlFlag (4) 33 | 34 | #define DECLARE_DISPLAY_METHODS(TYPE_POINTER) \ 35 | unsigned (*width) (TYPE_POINTER); \ 36 | unsigned (*height) (TYPE_POINTER); \ 37 | const char *(*name) (TYPE_POINTER); \ 38 | unsigned (*flags) (TYPE_POINTER); \ 39 | void (*setFlags) (TYPE_POINTER, unsigned); \ 40 | void (*addWindow) (TYPE_POINTER, Any*); \ 41 | bool (*canAddWindows) (TYPE_POINTER); \ 42 | Any* (*lookupWindowByID) (TYPE_POINTER, long); \ 43 | unsigned (*brightness) (TYPE_POINTER); \ 44 | void (*mainLoop) (TYPE_POINTER); 45 | 46 | struct display; 47 | 48 | typedef struct displayclass { 49 | DECLARE_OBJECT_CLASS_VARS 50 | DECLARE_OBJECT_METHODS(struct display*) 51 | DECLARE_DISPLAY_METHODS(struct display*) 52 | } DisplayClass; 53 | 54 | extern DisplayClass *_DisplayClass; 55 | extern DisplayClass* DisplayClass_init (DisplayClass*); 56 | 57 | #define MAX_DISPLAYS (4) 58 | #define MAX_WINDOWS_PER_DISPLAY (32) 59 | 60 | #define DECLARE_DISPLAY_INSTANCE_VARS(TYPE_POINTER) \ 61 | unsigned short width, height; \ 62 | unsigned char depth; \ 63 | unsigned char flags; \ 64 | unsigned char nWindows; \ 65 | Any *windows[MAX_WINDOWS_PER_DISPLAY]; 66 | 67 | typedef struct display { 68 | DisplayClass *is_a; 69 | DECLARE_OBJECT_INSTANCE_VARS(struct display*) 70 | DECLARE_DISPLAY_INSTANCE_VARS(struct display*) 71 | } Display; 72 | 73 | extern Display* Display_init (Display*); 74 | extern void Display_destroy (Any *); 75 | 76 | #define CHECK_GL_ERROR(NAME) {\ 77 | GLint err = glGetError(); \ 78 | if (err) { \ 79 | char temp [32]; \ 80 | snprintf (temp, sizeof(temp)-1, "GL error %d", err); \ 81 | Log_error (NAME, temp); \ 82 | }} 83 | 84 | #endif 85 | 86 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Image.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Image, an object-oriented C image manipulation class. 3 | Copyright (C) 2009-2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_IMAGE_H 22 | #define _OOC_IMAGE_H 23 | 24 | #include 25 | 26 | #include "Object.h" 27 | #include "String.h" 28 | #include "GraphicsTypes.h" 29 | #include "Font.h" 30 | 31 | #define JPEG_AVAILABLE 32 | 33 | #define MINIFONT_HEIGHT (8) 34 | 35 | #define DECLARE_IMAGE_METHODS(TYPE_POINTER) \ 36 | RGB (*pixelAt) (TYPE_POINTER, int, int); \ 37 | bool (*writeBMP) (TYPE_POINTER, const char *path); \ 38 | bool (*readTIFF) (TYPE_POINTER, const char *path); \ 39 | bool (*writeTIFF) (TYPE_POINTER, const char *path); \ 40 | Size (*size) (TYPE_POINTER); \ 41 | uint8_t *(*pixels) (TYPE_POINTER); \ 42 | uint8_t *(*pixelRowAddress) (TYPE_POINTER, int y); \ 43 | unsigned (*width) (TYPE_POINTER); \ 44 | unsigned (*height) (TYPE_POINTER); \ 45 | TYPE_POINTER (*shrink) (TYPE_POINTER, unsigned, unsigned); 46 | 47 | struct image; 48 | 49 | typedef struct imageclass { 50 | DECLARE_OBJECT_CLASS_VARS 51 | DECLARE_OBJECT_METHODS(struct image*) 52 | DECLARE_IMAGE_METHODS(struct image*) 53 | } ImageClass; 54 | 55 | extern ImageClass *_ImageClass; 56 | 57 | #define DECLARE_IMAGE_INSTANCE_VARS(TYPE_POINTER) \ 58 | const char *path; \ 59 | uint16_t width, height; \ 60 | uint16_t pixelFormat; \ 61 | RGB *pixels; 62 | 63 | typedef struct image { 64 | ImageClass *is_a; 65 | DECLARE_OBJECT_INSTANCE_VARS(struct image*) 66 | DECLARE_IMAGE_INSTANCE_VARS(struct image*) 67 | } Image; 68 | 69 | Image *Image_init (Image* self); 70 | void Image_destroy (Any* self); 71 | Image *Image_initWithSize (Image* self, int width, int height); 72 | Image *Image_withSize (int width, int height); 73 | ImageClass *ImageClass_init (ImageClass*); 74 | 75 | Image *Image_fromFile (const char *path); 76 | 77 | // Inherited by MutableImage 78 | void Image_print (Image *self, FILE*); 79 | RGB Image_pixelAt (Image *self, int x, int y); 80 | bool Image_writeBMP (Image* self, const char *path); 81 | Size Image_size (Image* self); 82 | bool Image_equals (Image *self, void *other); 83 | 84 | #include "Image_shrink.h" 85 | 86 | #endif 87 | 88 | -------------------------------------------------------------------------------- /scripts/bump_cpu_x_version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/wiki/release-a-version 4 | 5 | set -euo pipefail 6 | 7 | CPUX_DIR="$(git rev-parse --show-toplevel)" 8 | TMP_CHANGELOG="$(mktemp --tmpdir cpu-x-XXXXXX)" 9 | TMP_APPDATA="$(mktemp --tmpdir cpu-x-XXXXXX)" 10 | DATE="$(date --iso-8601)" 11 | GIT_CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" 12 | GIT_DEFAULT_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')" 13 | PREVIOUS_VERSION="$(git describe --tags --abbrev=0)" 14 | NEW_VERSION="${1:-}" 15 | 16 | 17 | if [[ -z "$NEW_VERSION" ]]; then 18 | echo -n "Enter version: " 19 | read -r NEW_VERSION 20 | fi 21 | 22 | # Prepare ChangeLog 23 | begin_changelog=false 24 | while IFS= read -r line; do 25 | if ! $begin_changelog && [[ "$line" == "---" ]]; then 26 | begin_changelog=true 27 | cat >> "$TMP_CHANGELOG" <> "$TMP_CHANGELOG" 60 | fi 61 | done < "$CPUX_DIR/ChangeLog.md" 62 | cp -f "$TMP_CHANGELOG" "$CPUX_DIR/ChangeLog.md" 63 | 64 | # Update version in AppData 65 | while IFS= read -r line; do 66 | if [[ "$line" =~ "" ]]; then 67 | cat >> "$TMP_APPDATA" < 69 | 70 | https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/blob/${GIT_DEFAULT_BRANCH}/ChangeLog.md#v${NEW_VERSION//./}---${DATE} 71 | 72 | EOF 73 | else 74 | echo "$line" >> "$TMP_APPDATA" 75 | fi 76 | done < "$CPUX_DIR/data/io.github.thetumultuousunicornofdarkness.cpu-x.appdata.xml" 77 | cp -f "$TMP_APPDATA" "$CPUX_DIR/data/io.github.thetumultuousunicornofdarkness.cpu-x.appdata.xml" 78 | 79 | # Update version in CMakeLists.txt 80 | sed -i "s|${PREVIOUS_VERSION/v/}|${NEW_VERSION}|" "$CPUX_DIR/CMakeLists.txt" 81 | 82 | # Displaying changes since last tag 83 | if [[ "$GIT_CURRENT_BRANCH" != "$GIT_DEFAULT_BRANCH" ]]; then 84 | git switch "$GIT_DEFAULT_BRANCH" 85 | fi 86 | git log --graph --decorate --oneline --color --first-parent "$GIT_DEFAULT_BRANCH" "$PREVIOUS_VERSION" | grep -Ev "Regen POT file|Update translation files|Translated using Weblate|Added translation using Weblate" | less --RAW-CONTROL-CHARS || true 87 | 88 | # Wait for confirmation 89 | while true; do 90 | read -r -p "Commit and push? " choice 91 | case "$choice" in 92 | y|Y|yes|YES) break;; 93 | n|N|no|NO) exit;; 94 | *) echo "Please answer yes or no.";; 95 | esac 96 | done 97 | 98 | # Commit, tag and push 99 | git commit "$CPUX_DIR/ChangeLog.md" "$CPUX_DIR/CMakeLists.txt" "$CPUX_DIR/data/io.github.thetumultuousunicornofdarkness.cpu-x.appdata.xml" -m "Release version $NEW_VERSION" 100 | git tag "v$NEW_VERSION" 101 | git push --atomic origin "$GIT_DEFAULT_BRANCH" "v$NEW_VERSION" 102 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/View.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | View, an object-oriented C view class. 3 | Copyright (C) 2019, 2022, 2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_VIEW_H 22 | #define _OOC_VIEW_H 23 | 24 | #include "Object.h" 25 | #include "Display.h" 26 | #include "GraphicsTypes.h" 27 | #include "MutableImage.h" 28 | 29 | typedef enum { 30 | ViewBorderTypeNone = 0, 31 | ViewBorderTypeSolid = 1, 32 | ViewBorderType3DIn = 2, 33 | ViewBorderType3DOut = 3, 34 | ViewBorderTypeRounded = 4, 35 | } ViewBorderType; 36 | #define ViewBorderType_last ViewBorderTypeRounded 37 | 38 | #define DECLARE_VIEW_INSTANCE_VARS(FOO) \ 39 | unsigned textureID; \ 40 | Rect rect; \ 41 | bool hidden; \ 42 | bool needsRedraw; \ 43 | RGBA backgroundColor; \ 44 | RGBA foregroundColor; \ 45 | MutableImage *image; \ 46 | int borderWidth; \ 47 | int cornerRadius; \ 48 | RGB borderColor; \ 49 | ViewBorderType borderType; \ 50 | 51 | #define DECLARE_VIEW_METHODS(TYPE_POINTER) \ 52 | void (*clear) (TYPE_POINTER); \ 53 | void (*defineBorder) (TYPE_POINTER, ViewBorderType, RGB, int width, int radius); \ 54 | void (*drawBorder) (TYPE_POINTER); \ 55 | RGBA (*backgroundColor) (TYPE_POINTER); \ 56 | void (*setBackgroundColor) (TYPE_POINTER, RGBA color); \ 57 | RGBA (*foregroundColor) (TYPE_POINTER); \ 58 | void (*setForegroundColor) (TYPE_POINTER, RGBA color); \ 59 | bool (*hidden) (TYPE_POINTER); \ 60 | void (*setHidden) (TYPE_POINTER, bool); \ 61 | void (*setNeedsRedraw) (TYPE_POINTER); \ 62 | void (*redraw) (TYPE_POINTER); \ 63 | void (*setRect) (TYPE_POINTER, Rect); 64 | 65 | struct view; 66 | 67 | typedef struct viewclass { 68 | DECLARE_OBJECT_CLASS_VARS 69 | DECLARE_OBJECT_METHODS(struct view*) 70 | DECLARE_VIEW_METHODS(struct view*) 71 | } ViewClass; 72 | 73 | extern ViewClass *_ViewClass; 74 | extern ViewClass* ViewClass_init (ViewClass*); 75 | 76 | typedef struct view { 77 | ViewClass *is_a; 78 | DECLARE_OBJECT_INSTANCE_VARS(struct view*) 79 | DECLARE_VIEW_INSTANCE_VARS(struct view*) 80 | } View; 81 | 82 | extern void View_destroy (Any *); 83 | extern View *View_init (View *self); 84 | extern View *View_with (Rect, RGBA); 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/StackTemplate.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | StackTemplate, an object-oriented C templated mutable array class. 3 | Copyright (C) 2022 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #if defined(StackType) && defined(ValueType) 22 | 23 | #define StackStructType EVALUATING_CONCAT(StackType,_s) 24 | #define StackClassType EVALUATING_CONCAT(StackType,Class) 25 | #define StackClassStructType EVALUATING_CONCAT(StackType,Class_s) 26 | 27 | #include 28 | 29 | #define STACK_DEFAULT_COUNT (16) 30 | 31 | #include "ObjectOriented.h" 32 | #include "Object.h" 33 | 34 | #define DECLARE_STACKTEMPLATE_INSTANCE_VARS(TYPE_POINTER) \ 35 | ValueType *array; \ 36 | size_t allocatedSize; \ 37 | size_t count; 38 | 39 | #define DECLARE_STACKTEMPLATE_METHODS(TYPE_POINTER) \ 40 | bool (*isEmpty) (TYPE_POINTER); \ 41 | void (*push) (TYPE_POINTER, ValueType); \ 42 | ValueType (*tos) (TYPE_POINTER); /* top of stack item */ \ 43 | ValueType (*pop) (TYPE_POINTER); \ 44 | void (*swap) (TYPE_POINTER); \ 45 | void (*empty) (TYPE_POINTER); 46 | 47 | struct StackStructType; 48 | 49 | typedef struct StackClassStructType { 50 | DECLARE_OBJECT_CLASS_VARS 51 | DECLARE_OBJECT_METHODS(struct StackStructType*) 52 | DECLARE_STACKTEMPLATE_METHODS(struct StackStructType*) 53 | } StackClassType; 54 | 55 | typedef struct StackStructType { 56 | StackClassType *is_a; 57 | DECLARE_OBJECT_INSTANCE_VARS(struct StackStructType*) 58 | DECLARE_STACKTEMPLATE_INSTANCE_VARS(struct StackStructType*) 59 | } StackType; 60 | 61 | extern StackClassType * EVALUATING_CONCAT(_,StackClassType) ; 62 | extern StackClassType * EVALUATING_CONCAT(StackClassType,_init) (StackClassType*) ; 63 | 64 | extern StackType * EVALUATING_CONCAT(StackType,_new) (); 65 | extern StackType * EVALUATING_CONCAT(StackType,_init) (StackType*); 66 | extern StackType * EVALUATING_CONCAT(StackType,_initWithCount) (StackType*, size_t); 67 | extern StackType * EVALUATING_CONCAT(StackType,_newWithCount) (size_t); 68 | extern void EVALUATING_CONCAT(StackType,_destroy) (Any *); 69 | 70 | // No subclassing allowed. 71 | #undef DECLARE_STACKTEMPLATE_INSTANCE_VARS 72 | #undef DECLARE_STACKTEMPLATE_METHODS 73 | #undef StackClassStructType 74 | #undef StackClassType 75 | #undef StackStructType 76 | #undef StackType 77 | #undef ValueType 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /.github/workflows/appimage_continuous.yml: -------------------------------------------------------------------------------- 1 | name: AppImage Continuous 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | workflow_dispatch: 11 | 12 | env: 13 | BUILD_TYPE: RelWithDebInfo 14 | 15 | jobs: 16 | linux-appimage-continuous-build: 17 | name: Linux ${{ matrix.os.arch }} (Continuous build) 18 | runs-on: ${{ matrix.os.label }} 19 | strategy: 20 | matrix: 21 | os: 22 | # x86_64 (https://github.com/actions/runner-images/tree/main/images/ubuntu) 23 | - { arch: x86_64, label: ubuntu-24.04 } 24 | # ARM64 (https://github.com/actions/partner-runner-images) 25 | - { arch: aarch64, label: ubuntu-24.04-arm } 26 | 27 | container: ghcr.io/pkgforge-dev/archlinux:latest 28 | 29 | steps: 30 | - name: Set environment variables 31 | run: | 32 | echo "REPO_USERNAME=${GITHUB_REPOSITORY//\//|}" >> $GITHUB_ENV 33 | echo "Repository username is '${REPO_USERNAME}'" 34 | 35 | - name: Install prerequisites 36 | run: pacman -Syu --noconfirm sudo 37 | 38 | - uses: actions/checkout@v5 39 | 40 | - name: Build libcpuid 41 | run: ./scripts/build_libcpuid.sh -t "$BUILD_TYPE" 42 | 43 | - name: Build CPU-X 44 | run: ./scripts/build_cpu_x.sh -s "$GITHUB_WORKSPACE" -t "$BUILD_TYPE" -i "$GITHUB_WORKSPACE/AppDir" 45 | 46 | - name: Create AppImage 47 | run: ./scripts/build_appimage.sh -s "$GITHUB_WORKSPACE" -a "$GITHUB_WORKSPACE/AppDir" -u "$REPO_USERNAME" 48 | 49 | - name: Upload artifacts 50 | uses: actions/upload-artifact@v4 51 | with: 52 | name: linux-${{ matrix.os.arch }} 53 | path: AppImage/CPU-X-* 54 | 55 | 56 | linux-appimage-continuous-release: 57 | name: Linux (Continuous release) 58 | needs: linux-appimage-continuous-build 59 | runs-on: ubuntu-latest 60 | if: github.ref == 'refs/heads/master' 61 | 62 | steps: 63 | - uses: actions/checkout@v5 64 | 65 | - name: Download all artifacts 66 | uses: actions/download-artifact@v5 67 | with: 68 | path: AppImage/ 69 | merge-multiple: true 70 | 71 | - name: Display structure of downloaded files 72 | run: ls -lhR AppImage/ 73 | 74 | - name: Delete previous continuous release 75 | run: gh release delete continuous --cleanup-tag 76 | env: 77 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 78 | 79 | - name: Create continuous release 80 | uses: ncipollo/release-action@v1 81 | with: 82 | allowUpdates: true 83 | artifacts: "AppImage/CPU-X-*.AppImage*" 84 | body: | 85 | :heavy_check_mark:CPU-X AppImage built from latest commit ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})). See [known issues](https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/wiki/appimage). 86 | commit: ${{ github.sha }} 87 | draft: false 88 | name: Continuous build 89 | prerelease: true 90 | removeArtifacts: true 91 | replacesArtifacts: true 92 | skipIfReleaseExists: false 93 | tag: continuous 94 | token: "${{ secrets.GITHUB_TOKEN }}" 95 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/String.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | String, an object-oriented C string class. 3 | Copyright (C) 2009-2019, 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_STRING_H 22 | #define _OOC_STRING_H 23 | 24 | #include 25 | 26 | #include "Array.h" 27 | 28 | #define DECLARE_STRING_METHODS(TYPE_POINTER) \ 29 | unsigned long (*length) (TYPE_POINTER); \ 30 | wchar_t (*at) (TYPE_POINTER, int); \ 31 | wchar_t* (*characters) (TYPE_POINTER); \ 32 | bool (*hasSuffix) (TYPE_POINTER, Any*); \ 33 | bool (*hasPrefix) (TYPE_POINTER, Any*); \ 34 | Array* (*explode) (TYPE_POINTER, Any *); \ 35 | unsigned (*totalLines) (TYPE_POINTER); \ 36 | const char* (*asUTF8) (TYPE_POINTER);\ 37 | int (*parseInt) (TYPE_POINTER); \ 38 | double (*parseDouble) (TYPE_POINTER); \ 39 | unsigned long (*parseHex) (TYPE_POINTER); \ 40 | bool (*containsCString) (TYPE_POINTER, const char *); 41 | 42 | struct string; 43 | 44 | typedef struct stringclass { 45 | DECLARE_OBJECT_CLASS_VARS 46 | DECLARE_OBJECT_METHODS(struct string*) 47 | DECLARE_STRING_METHODS(struct string*) 48 | } StringClass; 49 | 50 | extern StringClass *_StringClass; 51 | extern StringClass* StringClass_init (StringClass*); 52 | 53 | #define DECLARE_STRING_INSTANCE_VARS(TYPE_POINTER) \ 54 | wchar_t *chars; /* null terminated */ 55 | 56 | typedef struct string { 57 | StringClass *is_a; 58 | DECLARE_OBJECT_INSTANCE_VARS(struct string*) 59 | DECLARE_STRING_INSTANCE_VARS(struct string*) 60 | } String; 61 | 62 | extern String* String_init (String* object); 63 | extern void String_destroy (Any* object); 64 | extern String* String_withCString (const char*); 65 | extern String* String_initWithCString (String* self, const char *str); 66 | extern String* String_initWithWide (String* self, const wchar_t *string); 67 | extern String* String_withWide (const wchar_t *string); 68 | extern String* String_initWithWideStringAndLength (String* self, const wchar_t *string, size_t length); 69 | 70 | // Inherited by MutableString 71 | extern unsigned long String_length (String* self); 72 | extern void String_describe (String* self, FILE *file); 73 | extern void String_print (String *self, FILE* file); 74 | extern wchar_t String_at (String *self, int); 75 | extern bool String_equals (String *self, void *other); 76 | 77 | // Convenience instantiator macro 78 | #define _String(VALUE) String_withCString(VALUE) 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Hardware.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Hardware, an object-oriented C hardware information class. 3 | Copyright (C) 2009-2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_HARDWARE_H 22 | #define _OOC_HARDWARE_H 23 | 24 | #include "String.h" 25 | #include "MutableArray.h" 26 | 27 | #define DECLARE_HARDWARE_METHODS(TYPE_POINTER) \ 28 | unsigned (*totalRAM) (TYPE_POINTER); \ 29 | String* (*systemMake) (TYPE_POINTER); \ 30 | String* (*systemModel) (TYPE_POINTER); \ 31 | float (*temperature) (TYPE_POINTER, unsigned zone); 32 | 33 | struct hardwareinfo; 34 | 35 | typedef struct hardwareinfoclass { 36 | DECLARE_OBJECT_CLASS_VARS 37 | DECLARE_OBJECT_METHODS(struct hardwareinfo*) 38 | DECLARE_HARDWARE_METHODS(struct hardwareinfo*) 39 | } HardwareClass; 40 | 41 | extern HardwareClass *_HardwareClass; 42 | extern HardwareClass* HardwareClass_init (HardwareClass*); 43 | 44 | #define DECLARE_HARDWARE_INSTANCE_VARS(TYPE_POINTER) 45 | 46 | typedef struct hardwareinfo { 47 | HardwareClass *is_a; 48 | DECLARE_OBJECT_INSTANCE_VARS(struct hardwareinfo*) 49 | DECLARE_HARDWARE_INSTANCE_VARS(struct hardwareinfo*) 50 | } Hardware; 51 | 52 | extern Hardware* Hardware_init (Hardware* object); 53 | extern void Hardware_destroy (Any* object); 54 | 55 | #ifdef __APPLE__ 56 | // For reading the CPU/GPU/ambient temperatures. 57 | struct smc_version { 58 | char major; 59 | char minor; 60 | char build; 61 | char reserved[1]; 62 | uint16_t release; 63 | }; 64 | struct smc_plimits { 65 | uint16_t version; 66 | uint16_t length; 67 | uint32_t cpu_plimit; 68 | uint32_t gpu_plimit; 69 | uint32_t mem_plimit; 70 | }; 71 | struct smc_keyinfo { 72 | uint32_t data_size; 73 | uint32_t data_type; 74 | uint8_t data_attributes; 75 | }; 76 | typedef char smc_bytes[32]; 77 | struct smc_keydata { 78 | uint32_t key; 79 | struct smc_version version; 80 | struct smc_plimits plimits; 81 | struct smc_keyinfo keyinfo; 82 | uint8_t result; 83 | uint8_t status; 84 | uint8_t data8; 85 | uint32_t data32; 86 | smc_bytes bytes; 87 | }; 88 | #define KERNEL_INDEX_SMC 2 89 | #define SMC_CPU_TEMPERATURE "TC0P" 90 | #define SMC_GPU_TEMPERATURE "TG0P" 91 | #define SMC_AMBIENT_TEMPERATURE "TA0V" 92 | #define SMC_DATA_TYPE_SP78 "sp78" 93 | enum { 94 | kSMCCommandReadKeyInfo = 9, 95 | kSMCCommandReadBytes = 5, 96 | }; 97 | #endif 98 | #endif 99 | 100 | -------------------------------------------------------------------------------- /src/core/dmidecode/dmioutput.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic output functions 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2020 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | #include 24 | #include "dmioutput.h" 25 | 26 | void pr_comment(const char *format, ...) 27 | { 28 | va_list args; 29 | 30 | printf("# "); 31 | va_start(args, format); 32 | vprintf(format, args); 33 | va_end(args); 34 | printf("\n"); 35 | } 36 | 37 | void pr_info(const char *format, ...) 38 | { 39 | va_list args; 40 | 41 | va_start(args, format); 42 | vprintf(format, args); 43 | va_end(args); 44 | printf("\n"); 45 | } 46 | 47 | void pr_handle(const struct dmi_header *h) 48 | { 49 | printf("Handle 0x%04X, DMI type %d, %d bytes\n", 50 | h->handle, h->type, h->length); 51 | } 52 | 53 | void pr_handle_name(const char *format, ...) 54 | { 55 | va_list args; 56 | 57 | va_start(args, format); 58 | vprintf(format, args); 59 | va_end(args); 60 | printf("\n"); 61 | } 62 | 63 | void pr_attr(const char *name, const char *format, ...) 64 | { 65 | va_list args; 66 | 67 | printf("\t%s: ", name); 68 | 69 | va_start(args, format); 70 | vprintf(format, args); 71 | va_end(args); 72 | printf("\n"); 73 | } 74 | 75 | void pr_subattr(const char *name, const char *format, ...) 76 | { 77 | va_list args; 78 | 79 | printf("\t\t%s: ", name); 80 | 81 | va_start(args, format); 82 | vprintf(format, args); 83 | va_end(args); 84 | printf("\n"); 85 | } 86 | 87 | void pr_list_start(const char *name, const char *format, ...) 88 | { 89 | va_list args; 90 | 91 | printf("\t%s:", name); 92 | 93 | /* format is optional, skip value if not provided */ 94 | if (format) 95 | { 96 | printf(" "); 97 | va_start(args, format); 98 | vprintf(format, args); 99 | va_end(args); 100 | } 101 | printf("\n"); 102 | 103 | } 104 | 105 | void pr_list_item(const char *format, ...) 106 | { 107 | va_list args; 108 | 109 | printf("\t\t"); 110 | 111 | va_start(args, format); 112 | vprintf(format, args); 113 | va_end(args); 114 | printf("\n"); 115 | } 116 | 117 | void pr_list_end(void) 118 | { 119 | /* a no-op for text output */ 120 | } 121 | 122 | void pr_sep(void) 123 | { 124 | printf("\n"); 125 | } 126 | 127 | void pr_struct_err(const char *format, ...) 128 | { 129 | va_list args; 130 | 131 | printf("\t"); 132 | 133 | va_start(args, format); 134 | vprintf(format, args); 135 | va_end(args); 136 | printf("\n"); 137 | } 138 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/utility-x86.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _UTILITY_x86_H 3 | #define _UTILITY_x86_H 4 | 5 | //---------------------------------------- 6 | // utility-x86*.asm routines and constants 7 | // 8 | extern unsigned get_cpuid_cache_info (uint32_t *, unsigned); 9 | 10 | extern void get_cpuid_family (char *family_return); // for 32bit 11 | extern unsigned get_cpuid_family1 (); // for 64-bit 12 | extern unsigned get_cpuid_family2 (); // for 64-bit 13 | extern unsigned get_cpuid_family3 (); // for 64-bit 14 | 15 | extern void get_cpuid_model (char *model_return); // returns 48 bytes 16 | 17 | extern unsigned get_cpuid1_ecx (); 18 | extern unsigned get_cpuid1_edx (); 19 | extern unsigned get_cpuid7_ebx (); 20 | extern unsigned get_cpuid7_ecx (); 21 | extern unsigned get_cpuid7_edx (); 22 | extern unsigned get_cpuid8_ecx (); 23 | extern unsigned get_cpuid_80000001_ecx (); 24 | extern unsigned get_cpuid_80000001_edx (); 25 | 26 | #define CPUID80000001_ECX_SSE4A (1<<6) 27 | #define CPUID80000001_ECX_LZCNT (1<<5) 28 | #define CPUID80000001_ECX_PREFETCHW (1<<8) 29 | #define CPUID80000001_EDX_INTEL64 (1<<29) // "Long Mode" on AMD. 30 | #define CPUID80000001_EDX_NX (1<<20) 31 | #define CPUID80000001_EDX_MMXEXT (1<<22) 32 | 33 | #define CPUID1_EDX_CMOV (1<<15) 34 | #define CPUID1_EDX_ACPI (1<<22) 35 | #define CPUID1_EDX_MMX (1<<23) 36 | #define CPUID1_EDX_SSE (1<<25) 37 | #define CPUID1_EDX_SSE2 (1<<26) 38 | #define CPUID1_EDX_HTT (1<<28) 39 | #define CPUID1_EDX_TM (1<<29) 40 | 41 | #define CPUID1_ECX_SSE3 (1) 42 | #define CPUID1_ECX_TM2 (1<<8) 43 | #define CPUID1_ECX_SSSE3 (1<<9) 44 | #define CPUID1_ECX_SSE41 (1<<19) 45 | #define CPUID1_ECX_SSE42 (1<<20) 46 | #define CPUID1_ECX_POPCNT (1<<23) 47 | #define CPUID1_ECX_AES (1<<25) // Encryption. 48 | #define CPUID1_ECX_AVX (1<<28) // 256-bit YMM registers. 49 | #define CPUID1_ECX_F16C (1<<29) 50 | #define CPUID1_ECX_HYPER_GUEST (1<<31) 51 | 52 | #define CPUID7_EBX_SGX (1<<2) 53 | #define CPUID7_EBX_BMI1 (1<<3) 54 | #define CPUID7_EBX_HLE (1<<4) 55 | #define CPUID7_EBX_AVX2 (1<<5) 56 | #define CPUID7_EBX_BMI2 (1<<8) 57 | #define CPUID7_EBX_MPX (1<<14) 58 | #define CPUID7_EBX_AVX512_F (1<<16) 59 | #define CPUID7_EBX_AVX512_DQ (1<<17) 60 | #define CPUID7_EBX_RDSEED (1<<18) 61 | #define CPUID7_EBX_ADX (1<<19) 62 | #define CPUID7_EBX_AVX512_IFMA (1<<21) 63 | #define CPUID7_EBX_AVX512_PF (1<<26) 64 | #define CPUID7_EBX_AVX512_ER (1<<27) 65 | #define CPUID7_EBX_AVX512_CD (1<<28) 66 | #define CPUID7_EBX_SHA (1<<29) 67 | #define CPUID7_EBX_AVX512_BW (1<<30) 68 | #define CPUID7_EBX_AVX512_VL (1<<31) 69 | 70 | #define CPUID7_ECX_AVX512_VBMI (1<<1) 71 | #define CPUID7_ECX_AVX512_VBMI2 (1<<6) 72 | #define CPUID7_ECX_CET (1<<7) 73 | #define CPUID7_ECX_VAES (1<<9) 74 | #define CPUID7_ECX_AVX512_VNNI (1<<11) 75 | #define CPUID7_ECX_AVX512_BITALG (1<<12) 76 | #define CPUID7_ECX_AVX512_VPOPCNTDQ (1<<14) 77 | #define CPUID7_ECX_MOVDIRI (1<<27) 78 | #define CPUID7_ECX_MOVDIR64B (1<<28) 79 | 80 | #define CPUID7_ECX1_EAX_SHA512 (1) 81 | #define CPUID7_ECX1_EAX_AMX_FP16 (1<<21) 82 | 83 | #define CPUID7_EDX_AVX512_4VNNIW (1<<2) 84 | #define CPUID7_EDX_AVX512_4FMAPS (1<<3) 85 | #define CPUID7_EDX_AVX512_VP2INTERSECT (1<<8) 86 | #define CPUID7_EDX_HYBRID (1<<15) 87 | #define CPUID7_EDX_AMX_BF16 (1<<22) 88 | #define CPUID7_EDX_AMX_TILE (1<<24) 89 | #define CPUID7_EDX_AMX_INT8 (1<<25) 90 | #define CPUID7_EDX_AVX512_FP16 (1<<23) 91 | 92 | #endif 93 | 94 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Model3D.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Model3D, an object-oriented C mutable 3D model class. 3 | Copyright (C) 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_MODEL3D_H 22 | #define _OOC_MODEL3D_H 23 | 24 | #include "Object.h" 25 | #include "GraphicsTypes.h" 26 | 27 | typedef struct { 28 | float x; 29 | float y; 30 | float z; 31 | } Vector; 32 | 33 | extern Vector Vector_crossProduct (Vector*, Vector*); 34 | extern float Vector_dotProduct (Vector*, Vector*); 35 | extern float Vector_magnitude (Vector*); 36 | extern void Vector_normalize (Vector*); 37 | extern void Vector_add (Vector*, Vector*); 38 | extern Vector Vector_new (float x, float y, float z); 39 | extern const char *Vector_toString (Vector); 40 | 41 | typedef struct triangle3d { 42 | Vector a; 43 | Vector b; 44 | Vector c; 45 | Vector normal_a; 46 | Vector normal_b; 47 | Vector normal_c; 48 | } Triangle; 49 | 50 | extern Vector Triangle_normalVector (Triangle*); 51 | 52 | struct model3d; 53 | 54 | #define DECLARE_MODEL3D_INSTANCE_VARS(TYPE_POINTER) \ 55 | Triangle *triangles; \ 56 | size_t nTriangles; \ 57 | size_t allocatedSize; \ 58 | RGBA color; 59 | 60 | #define DECLARE_MODEL3D_METHODS(TYPE_POINTER) \ 61 | void (*addTriangle) (TYPE_POINTER, Triangle*); \ 62 | void (*addModel) (TYPE_POINTER, TYPE_POINTER); \ 63 | void (*translate) (TYPE_POINTER, float x, float y, float z); \ 64 | void (*scale) (TYPE_POINTER, float s); \ 65 | void (*clear) (TYPE_POINTER); \ 66 | bool (*writeSTL) (TYPE_POINTER, const char*); \ 67 | bool (*readSTL) (TYPE_POINTER, const char*); \ 68 | void (*addCube) (TYPE_POINTER, float sideLength);\ 69 | void (*addSphere) (TYPE_POINTER, float diameter, unsigned steps);\ 70 | void (*addCylinder) (TYPE_POINTER, float height, float diameter, unsigned steps);\ 71 | void (*addCone) (TYPE_POINTER, float height, float diameter, unsigned steps); 72 | 73 | typedef struct model3dclass { 74 | DECLARE_OBJECT_CLASS_VARS 75 | DECLARE_OBJECT_METHODS(struct model3d*) 76 | DECLARE_MODEL3D_METHODS(struct model3d*) 77 | } Model3DClass; 78 | 79 | extern Model3DClass *_Model3DClass; 80 | extern Model3DClass* Model3DClass_init (Model3DClass*); 81 | 82 | typedef struct model3d { 83 | Model3DClass *is_a; 84 | DECLARE_OBJECT_INSTANCE_VARS(struct model3d*) 85 | DECLARE_MODEL3D_INSTANCE_VARS(struct model3d*) 86 | } Model3D; 87 | 88 | extern Model3D *Model3D_fromFile (const char*); 89 | extern Model3D *Model3D_init (Model3D *self); 90 | extern void Model3D_destroy (Any *); 91 | 92 | #define degrees_to_radians(DEG) (M_PI * ((float)DEG) / 180.f) 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Object.c: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Object, an object-oriented C object base class. 3 | Copyright (C) 2019, 2023 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #include 22 | #include 23 | 24 | #include "Object.h" 25 | 26 | ObjectClass *_ObjectClass = NULL; 27 | 28 | void Object_destroy (Any* self) 29 | { 30 | DEBUG_DESTROY; 31 | 32 | if (!self) { 33 | return; 34 | } 35 | verifyCorrectClassOrSubclass(self,Object); 36 | } 37 | 38 | static void 39 | Object_describe (Object* self, FILE* output) 40 | { 41 | if (!self) { 42 | return; 43 | } 44 | verifyCorrectClass(self,Object); 45 | fprintf (output ?: stdout, "%s", $(self, className)); 46 | } 47 | 48 | void Object_print (Object* self, FILE* output) 49 | { 50 | if (!self) { 51 | return; 52 | } 53 | verifyCorrectClass(self,Object); 54 | 55 | (void)output; 56 | } 57 | 58 | // This must be overridden in subclasses. 59 | unsigned Object_hash (Object *self) 60 | { 61 | return 0; 62 | } 63 | 64 | // This must be overridden in subclasses. 65 | bool Object_equals (Object *self, Any *other) 66 | { 67 | return false; 68 | } 69 | 70 | // This must be overridden in subclasses. 71 | int Object_compare (Object *self, Any *other) 72 | { 73 | return 0; 74 | } 75 | 76 | const char *Object_className (Object *self) 77 | { 78 | if (!self) { 79 | return NULL; 80 | } 81 | EmptyClass *class = (EmptyClass*)self->is_a; 82 | if (!class) 83 | return NULL; 84 | return class->_className; 85 | } 86 | 87 | void *Object_class (Object *self) 88 | { 89 | if (!self) { 90 | return NULL; 91 | } 92 | return self->is_a; 93 | } 94 | 95 | long Object_message (Object *self, long message, Any *sender, long first, long second) 96 | { 97 | return 0; 98 | } 99 | 100 | ObjectClass* ObjectClass_init (ObjectClass *class) 101 | { 102 | SET_METHOD_POINTER(Object,class); 103 | SET_METHOD_POINTER(Object,className); 104 | SET_METHOD_POINTER(Object,describe); 105 | SET_METHOD_POINTER(Object,destroy); 106 | SET_METHOD_POINTER(Object,equals); 107 | SET_METHOD_POINTER(Object,print); 108 | SET_METHOD_POINTER(Object,message); 109 | SET_METHOD_POINTER(Object,hash); 110 | SET_METHOD_POINTER(Object,compare); 111 | 112 | VALIDATE_CLASS_STRUCT(class); 113 | return class; 114 | } 115 | 116 | Object* Object_init (Object *object) 117 | { 118 | ENSURE_CLASS_READY(Object); 119 | 120 | if (object == NULL) { 121 | return NULL; 122 | } 123 | 124 | object->magic = OBJECT_MAGIC_NUMBER; 125 | object->retainCount = 0; 126 | object->is_a = _ObjectClass; 127 | 128 | return object; 129 | } 130 | 131 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/RULES.txt: -------------------------------------------------------------------------------- 1 | 2 | Rules that underpin OOC 3 | 4 | Names 5 | ----- 6 | 7 | * The object pointer is the first parameter of every method function, and it is called "self" in order to differentiate it from C++, which uses "this". 8 | * When the type of a parameter can be any class, use the "Any*" type, and then validate that pointer's type. 9 | 10 | Important methods 11 | ----------------- 12 | 13 | * Every class must have a globally-accessible class init method e.g. ObjectClass_init, which does the following 14 | 1. It initializes the class struct (vtable); 15 | 2. It makes sure all method pointers are present; 16 | 3. It locks the class struct's memory so that it can't be modified. 17 | 18 | * Every class must have a globally-accessible instance init method e.g. Object_init, which does the following: 19 | 1. Calls the superclass's init method to initialize inherited instance variables; 20 | 2. Sets the is_a pointer; 21 | 3. Initializes its own instance variables. 22 | 23 | * Every class must have a globally-accessible destroy method, either its own or Object_destroy, which does: 24 | 1. Releases any resources that it has retained. 25 | 2. Subclasses should call superclass's destructors. 26 | 27 | * Because each destructor can potentially be called directly by a subclass, it must take an Any* parameter and validate the class of self. 28 | 29 | * Always set released pointers to NULL, to avoid use-after-free situations. 30 | 31 | Init methods 32 | ------------ 33 | 34 | * The init method must always begin by ensuring that the class struct has been created and initialized, by making a call to ENSURE_CLASS_READY(Classname). 35 | * The init method should not assume that self is non-NULL, because the allocator may return NULL if the malloc call fails. 36 | * The init method should always return self. 37 | * The init methods are guaranteed to receive a zero-filled piece of memory for the object. 38 | 39 | How to implement methods 40 | ------------------------ 41 | 42 | * It is always best to immediately check whether 43 | A) self != NULL; 44 | B) the self pointer is the correct type (i.e. correct is_a pointer); 45 | C) object parameters that shoulnd't be NULL aren't NULL. 46 | D) object parameters are the correct type; 47 | E) required resources are present. 48 | While these checks may be not be strictly necessary in every single case, they usually are, so don't waste time pondering it, lest you make a mistake. 49 | * If an object parameter can be one of multiple types (e.g. String, MutableString), use an Any* parameter type. This way, the callers do not need to cast the pointer everywhere. 50 | * In cases where you know all of the above will be true, a non-method function or even an inline might be a better choice. 51 | 52 | Memory management 53 | ----------------- 54 | 55 | * Each object must be retained and released, to keep track of how many owners the object has. 56 | * Thus each object has a retainCount instance variable that is incremented and decremented respectively. 57 | * When an object is created, its retain count is zero, indicating it is not owned. 58 | * When a nonzero retain count is decremented to zero, the object is destroyed and the pointer that was released is set to NULL. 59 | * When an object's memory is allocated, all of its bytes are first set to zero, to set its instance variables to a known state. 60 | * When an object is destroyed and deallocated, all of its bytes are first set to zero. 61 | * In the object destructors, you should always set released pointers to NULL for the sake of clarity and to avoid use-after-free situations. 62 | 63 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Controller.c: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Controller, an object-oriented C user interface controller class. 3 | Copyright (C) 2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #include "Controller.h" 22 | 23 | #include 24 | 25 | ControllerClass *_ControllerClass = NULL; 26 | 27 | void Controller_destroy (Any *self_) 28 | { 29 | DEBUG_DESTROY; 30 | if (!self_) { 31 | return; 32 | } 33 | verifyCorrectClassOrSubclass(self_,Controller); 34 | } 35 | 36 | static void Controller_print (Controller* self, FILE *outputFile) 37 | { 38 | if (!self) { 39 | return; 40 | } 41 | verifyCorrectClass(self,Controller); 42 | 43 | if (!outputFile) { 44 | outputFile = stdout; 45 | } 46 | } 47 | 48 | static void Controller_describe (Controller* self, FILE *outputFile) 49 | { 50 | if (!self) { 51 | return; 52 | } 53 | verifyCorrectClass(self,Controller); 54 | 55 | if (!outputFile) { 56 | outputFile = stdout; 57 | } 58 | 59 | fprintf (outputFile, "%s", $(self, className)); 60 | } 61 | 62 | static bool Controller_construct (Controller* self) 63 | { 64 | return false; 65 | } 66 | 67 | static void Controller_layout (Controller* self) 68 | { 69 | } 70 | 71 | static bool Controller_update (Controller* self) 72 | { 73 | return false; 74 | } 75 | 76 | static void Controller_dismantle (Controller* self) 77 | { 78 | } 79 | 80 | void Controller_setWindow (Controller* self, Any* window) 81 | { 82 | if (!self) { 83 | return; 84 | } 85 | verifyCorrectClassOrSubclass(self,Controller); 86 | verifyCorrectClassOrSubclass(window,Window); 87 | self->window = window; // Don't retain. 88 | } 89 | 90 | static Window *Controller_window (Controller* self) 91 | { 92 | if (!self) { 93 | return NULL; 94 | } 95 | verifyCorrectClassOrSubclass(self,Controller); 96 | return self->window; 97 | } 98 | 99 | ControllerClass* ControllerClass_init (ControllerClass *class) 100 | { 101 | SET_SUPERCLASS(Object); 102 | 103 | SET_OVERRIDDEN_METHOD_POINTER(Controller,describe); 104 | SET_OVERRIDDEN_METHOD_POINTER(Controller,print); 105 | 106 | SET_METHOD_POINTER(Controller,construct); 107 | SET_METHOD_POINTER(Controller,update); 108 | SET_METHOD_POINTER(Controller,layout); 109 | SET_METHOD_POINTER(Controller,dismantle); 110 | SET_METHOD_POINTER(Controller,setWindow); 111 | SET_METHOD_POINTER(Controller,window); 112 | 113 | VALIDATE_CLASS_STRUCT(class); 114 | return class; 115 | } 116 | 117 | Controller* Controller_init (Controller *self) 118 | { 119 | ENSURE_CLASS_READY(Controller); 120 | 121 | if (self) { 122 | Object_init ((Object*) self); 123 | self->is_a = _ControllerClass; 124 | } 125 | 126 | return self; 127 | } 128 | 129 | -------------------------------------------------------------------------------- /src/core/internal.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE core/internal.hpp 22 | */ 23 | 24 | #ifndef _CORE_INTERNAL_HPP_ 25 | #define _CORE_INTERNAL_HPP_ 26 | 27 | #include "data.hpp" 28 | 29 | using GpuDrv = Data::Graphics::Card::GpuDrv; 30 | 31 | 32 | /***************************** Bandwidth *****************************/ 33 | 34 | /* Compute CPU cache speed */ 35 | int call_bandwidth(Data &data); 36 | 37 | 38 | /***************************** Dmidecode *****************************/ 39 | 40 | /* Elements provided by dmidecode */ 41 | int call_dmidecode(Data &data); 42 | 43 | 44 | /***************************** Benchmarks *****************************/ 45 | 46 | /* Report score of benchmarks */ 47 | int benchmark_status(Data &data); 48 | 49 | /* Set initial values for benchmarks */ 50 | void init_benchmarks(Data &data); 51 | 52 | 53 | /***************************** Libcpuid *****************************/ 54 | 55 | /* Static elements provided by libcpuid */ 56 | int call_libcpuid_static(Data &data); 57 | 58 | /* MSRs static values provided by libcpuid */ 59 | int call_libcpuid_msr_static(Data &data); 60 | 61 | /* Dynamic elements provided by libcpuid */ 62 | int call_libcpuid_dynamic(Data &data); 63 | 64 | /* MSRs dynamic values provided by libcpuid */ 65 | int call_libcpuid_msr_dynamic(Data &data); 66 | 67 | /* If dmidecode fails to find CPU package, check in database */ 68 | int cputab_package_fallback(Data &data); 69 | 70 | 71 | /***************************** Libopencl *****************************/ 72 | 73 | /* Set the OpenCL version and Compute Unit (CU) / Workgroup Processor (WGP) / Execution Unit (EU) / Streaming Multiprocessor (SM) for a GPU */ 74 | int set_gpu_opencl_version(std::string card_vendor, struct pci_dev *pci_dev, int pfd_out); 75 | 76 | 77 | /***************************** Libopengl *****************************/ 78 | 79 | /* Set the OpenGL version for GPU */ 80 | int set_gpu_opengl_version(std::string card_vendor, int pfd_out); 81 | 82 | 83 | /***************************** Libpci *****************************/ 84 | 85 | /* Find some PCI devices, like chipset and GPU */ 86 | int find_devices(Data &data); 87 | 88 | /* Retrieve GPU temperature and clocks */ 89 | int gpu_monitoring(Data &data); 90 | 91 | 92 | /***************************** Libsystem *****************************/ 93 | 94 | /* Dynamic elements for System tab, provided by libprocps/libstatgrab */ 95 | int system_dynamic(Data &data); 96 | 97 | 98 | /***************************** Libvulkan *****************************/ 99 | 100 | /* Set the Vulkan version for GPU */ 101 | int set_gpu_vulkan_version(std::string card_vendor, struct pci_dev *dev, int pfd_out); 102 | 103 | 104 | #endif /* _CORE_INTERNAL_HPP_ */ 105 | -------------------------------------------------------------------------------- /data/io.github.thetumultuousunicornofdarkness.cpu-x.gschema.xml: -------------------------------------------------------------------------------- 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 | 'celsius' 28 | Temperature unit 29 | 30 | Set temperature unit 31 | 32 | 33 | 34 | 1 35 | 36 | Refresh time 37 | 38 | Set custom time between two refreshes 39 | 40 | 41 | 42 | 'auto' 43 | Theme 44 | 45 | Change GUI theme color scheme 46 | 47 | 48 | 49 | 'cpu' 50 | Default tab 51 | 52 | Set default tab 53 | 54 | 55 | 56 | 0 57 | 58 | Default core type 59 | 60 | Select core type to monitor 61 | 62 | 63 | 64 | 0 65 | 66 | Default CPU core 67 | 68 | Select CPU core to monitor 69 | 70 | 71 | 72 | 0 73 | 74 | Default cache test 75 | 76 | Set custom bandwidth test for CPU caches speed 77 | 78 | 79 | 80 | 0 81 | 82 | Default active memory stick 83 | 84 | Select memory stick to display 85 | 86 | 87 | 88 | 0 89 | 90 | Default active graphic card 91 | 92 | Select graphic card to monitor 93 | 94 | 95 | 96 | false 97 | Print CPUID values in decimal 98 | 99 | Avoid to print CPUID values in hexadecimal 100 | 101 | 102 | 103 | false 104 | Always start daemon 105 | 106 | Start and connect to daemon 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/daemon/daemon.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright © 2014-2025 The Tumultuous Unicorn Of Darkness 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | ****************************************************************************/ 18 | 19 | /* 20 | * PROJECT CPU-X 21 | * FILE daemon/daemon.h 22 | */ 23 | 24 | #ifndef _DAEMON_DAEMON_H_ 25 | #define _DAEMON_DAEMON_H_ 26 | 27 | #define DAEMON_UP (data.socket_fd >= 0) 28 | 29 | #ifndef MAXSTR 30 | # define MAXSTR 80 /* Max string */ 31 | #endif 32 | 33 | #define SEND_DATA(pfd, pdata, size) \ 34 | if(write(*pfd, pdata, size) == size) \ 35 | { \ 36 | MSG_DEBUG("daemon: writing %luB", size); \ 37 | } \ 38 | else \ 39 | { \ 40 | MSG_ERRNO("%s", "daemon: write error"); \ 41 | close(*pfd); \ 42 | *pfd = -1; \ 43 | return 1; \ 44 | } 45 | #define RECEIVE_DATA(pfd, pdata, size) \ 46 | if(read(*pfd, pdata, size) == size) \ 47 | { \ 48 | MSG_DEBUG("daemon: reading %luB", size); \ 49 | } \ 50 | else \ 51 | { \ 52 | MSG_ERRNO("%s", "daemon: read error"); \ 53 | close(*pfd); \ 54 | *pfd = -1; \ 55 | return 1; \ 56 | } 57 | 58 | typedef enum 59 | { 60 | LIBCPUID_MSR_DEBUG, 61 | LIBCPUID_MSR_STATIC, 62 | LIBCPUID_MSR_DYNAMIC, 63 | DMIDECODE, 64 | ACCESS_DEV_PCI, 65 | ACCESS_SYS_DEBUG, 66 | LOAD_MODULE, 67 | } DaemonCommand; 68 | 69 | typedef struct 70 | { 71 | int min_mult, max_mult, bclk; 72 | } MsrStaticData; 73 | 74 | typedef struct 75 | { 76 | int voltage, temp; 77 | } MsrDynamicData; 78 | 79 | typedef struct 80 | { 81 | char brand[MAXSTR], version[MAXSTR], date[MAXSTR], romsize[MAXSTR]; 82 | } DmidecodeBiosData; 83 | 84 | typedef struct 85 | { 86 | char manufacturer[MAXSTR], model[MAXSTR], revision[MAXSTR]; 87 | } DmidecodeMBData; 88 | 89 | typedef struct 90 | { 91 | double bus_freq; 92 | char cpu_package[MAXSTR]; 93 | } DmidecodeCPUData; 94 | 95 | typedef struct 96 | { 97 | char manufacturer[MAXSTR]; 98 | char part_number[MAXSTR]; 99 | char type[MAXSTR]; 100 | char type_detail[MAXSTR]; 101 | char device_locator[MAXSTR]; 102 | char bank_locator[MAXSTR]; 103 | char size[MAXSTR]; 104 | char rank[MAXSTR]; 105 | char speed_maximum[MAXSTR]; 106 | char speed_configured[MAXSTR]; 107 | char voltage_minimum[MAXSTR]; 108 | char voltage_maximum[MAXSTR]; 109 | char voltage_configured[MAXSTR]; 110 | } DmidecodeMemoryData; 111 | 112 | typedef struct 113 | { 114 | int ret; 115 | uint8_t stick_count; 116 | DmidecodeBiosData bios; 117 | DmidecodeMBData mb; 118 | DmidecodeCPUData processor; 119 | DmidecodeMemoryData *memory; 120 | } DmidecodeData; 121 | 122 | 123 | #endif /* _DAEMON_DAEMON_H_ */ 124 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Font.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Font, an object-oriented C font base class. 3 | Copyright (C) 2019 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_FONT_H 22 | #define _OOC_FONT_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "Object.h" 29 | #include "String.h" 30 | #include "MutableString.h" 31 | 32 | #define MAXFONTNAMELEN (64) 33 | #define MAXCHARS 256 34 | #define MAXCHARCODE (MAXCHARS-1) 35 | 36 | #define kDefaultIntercharacterSpace (2) 37 | 38 | typedef enum { 39 | RowUnitByte = 0, 40 | RowUnitWord = 1, 41 | RowUnitDword = 2, 42 | } RowUnit; 43 | 44 | #define kMaxFontNameSize (32) 45 | 46 | #define DECLARE_FONT_INSTANCE_VARS(FOO) \ 47 | short dpi; \ 48 | short ascent; \ 49 | short descent; \ 50 | short height; \ 51 | float pointSize; \ 52 | char name[kMaxFontNameSize]; \ 53 | char family[kMaxFontNameSize]; \ 54 | char fullName[kMaxFontNameSize]; \ 55 | wchar_t firstCharacter; \ 56 | wchar_t lastCharacter; \ 57 | wchar_t totalCharacters; \ 58 | short spaceWidth; \ 59 | char fixedWidth; \ 60 | bool isMonochrome; \ 61 | bool isFixedWidth; \ 62 | bool italic; \ 63 | bool bold; \ 64 | unsigned short weight; \ 65 | unsigned char bytesPerRow[MAXCHARS]; \ 66 | unsigned short widths[MAXCHARS]; \ 67 | unsigned short bitsHigh[MAXCHARS]; \ 68 | unsigned short bitsWide[MAXCHARS]; /* 8, 16, 32, or 64 */ \ 69 | short descents[MAXCHARS]; \ 70 | short xoffsets[MAXCHARS]; \ 71 | uint8_t *bitmaps[MAXCHARS]; \ 72 | uint8_t *bitmapBuffer; \ 73 | short underlinePosition; \ 74 | short underlineThickness; \ 75 | char rowUnit; 76 | 77 | #define DECLARE_FONT_METHODS(TYPE_POINTER) \ 78 | float (*pointSize) (TYPE_POINTER); \ 79 | short (*ascent) (TYPE_POINTER); \ 80 | short (*descent) (TYPE_POINTER); \ 81 | short (*spaceWidth) (TYPE_POINTER); \ 82 | short (*height) (TYPE_POINTER); \ 83 | wchar_t (*firstCharacter) (TYPE_POINTER); \ 84 | wchar_t (*lastCharacter) (TYPE_POINTER); \ 85 | long (*totalCharacters) (TYPE_POINTER);\ 86 | void* (*bitmapForCharacter) (TYPE_POINTER, wchar_t characterCode, unsigned* width, unsigned* bytesPerRow, unsigned* bitsWide, unsigned* bitsHigh, int* xoffset, int* descent); \ 87 | void (*sizeOfString) (TYPE_POINTER, String *, int* w, int* a, int* d); \ 88 | void (*sizeOfWideString) (TYPE_POINTER, wchar_t *, unsigned length, int* w, int* a, int* d); \ 89 | int (*stringWidth) (TYPE_POINTER, Any *string); 90 | 91 | struct font; 92 | 93 | typedef struct fontclass { 94 | DECLARE_OBJECT_CLASS_VARS 95 | DECLARE_OBJECT_METHODS(struct font*) 96 | DECLARE_FONT_METHODS(struct font*) 97 | } FontClass; 98 | 99 | extern FontClass *_FontClass; 100 | 101 | typedef struct font { 102 | FontClass *is_a; 103 | DECLARE_OBJECT_INSTANCE_VARS(struct font*) 104 | DECLARE_FONT_INSTANCE_VARS(struct font*) 105 | } Font; 106 | 107 | Font *Font_new (void); 108 | Font *Font_init (Font *self); 109 | void Font_destroy (Any *self); 110 | Font* Font_with (const char* name, int size, bool bold, bool italic); 111 | 112 | // Used by subclasses. 113 | FontClass* FontClass_init (FontClass*); 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /src/core/bandwidth/OOC/Window.h: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | Window, an object-oriented C OpenGL window class. 3 | Copyright (C) 2019, 2022, 2024 by Zack T Smith. 4 | 5 | Object-Oriented C is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | Object-Oriented C is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this software. If not, see . 17 | 18 | The author may be reached at 1@zsmith.co. 19 | *===========================================================================*/ 20 | 21 | #ifndef _OOC_WINDOW_H 22 | #define _OOC_WINDOW_H 23 | 24 | #include "Object.h" 25 | #include "Display.h" 26 | #include "MutableArray.h" 27 | #include "GraphicsTypes.h" 28 | #include "Model3D.h" 29 | 30 | #define INVALID_WINDOW_ID (-1) 31 | #define INVALID_TEXTURE_ID (0) 32 | #define MAX_LIGHTS (8) 33 | 34 | typedef struct { 35 | const char *text; 36 | short x, y; 37 | } OverlayedText; 38 | 39 | #define DECLARE_WINDOW_INSTANCE_VARS(TYPE_POINTER) \ 40 | Display *display; \ 41 | long identifier; \ 42 | RGBA backgroundColor; \ 43 | unsigned short width, height; \ 44 | short x, y; \ 45 | char *title; \ 46 | bool needsRedraw; \ 47 | bool pointerInside; \ 48 | short pointerX, pointerY; \ 49 | Vector cameraVector; \ 50 | Vector focusVector; \ 51 | Vector upVector; \ 52 | bool useLight[MAX_LIGHTS]; \ 53 | Vector lightPositions[MAX_LIGHTS]; \ 54 | RGBA lightAmbientColors[MAX_LIGHTS]; \ 55 | RGBA lightDiffuseColors[MAX_LIGHTS]; \ 56 | RGBA lightSpecularColors[MAX_LIGHTS]; \ 57 | MutableArray *modelsArray; /* Model3D objects */ \ 58 | MutableArray *viewsArray; /* View objects */ \ 59 | Any *controller; \ 60 | const char *topLeftMessage; 61 | 62 | #define DECLARE_WINDOW_METHODS(TYPE_POINTER) \ 63 | long (*identifier) (TYPE_POINTER); \ 64 | void (*setIdentifier) (TYPE_POINTER, long); \ 65 | void (*resize) (TYPE_POINTER, unsigned width, unsigned height); \ 66 | void (*move) (TYPE_POINTER, int x, int y); \ 67 | unsigned (*width) (TYPE_POINTER); \ 68 | unsigned (*height) (TYPE_POINTER); \ 69 | Rect (*redraw) (TYPE_POINTER); \ 70 | /* 3D Model Stuff */ \ 71 | void (*addModel3D) (TYPE_POINTER, Model3D*); \ 72 | void (*moveCamera) (TYPE_POINTER, Vector); \ 73 | void (*setLightEnabled) (TYPE_POINTER, unsigned which, bool); \ 74 | void (*setLightColors) (TYPE_POINTER, unsigned which, RGBA diffuseAmbient, RGBA specular, RGBA emissive); \ 75 | void (*setLightPosition) (TYPE_POINTER, unsigned which, Vector posn); \ 76 | /* View Stuff */ \ 77 | void (*addView) (TYPE_POINTER, Any*); \ 78 | void (*setController) (TYPE_POINTER, Any*); \ 79 | void (*setTopLeftMessage) (TYPE_POINTER, const char *); 80 | 81 | struct window; 82 | 83 | typedef struct windowclass { 84 | DECLARE_OBJECT_CLASS_VARS 85 | DECLARE_OBJECT_METHODS(struct window*) 86 | DECLARE_WINDOW_METHODS(struct window*) 87 | } WindowClass; 88 | 89 | extern WindowClass *_WindowClass; 90 | extern WindowClass* WindowClass_init (WindowClass*); 91 | 92 | typedef struct window { 93 | WindowClass *is_a; 94 | DECLARE_OBJECT_INSTANCE_VARS(struct window*) 95 | DECLARE_WINDOW_INSTANCE_VARS(struct window*) 96 | } Window; 97 | 98 | extern Window *Window_initWith (Window*, Display *, const char*, unsigned width, unsigned height, int x, int y); 99 | extern Window *Window_newWith (Display *, const char*, unsigned width, unsigned height, int x, int y); 100 | extern Window *Window_init (Window *self); 101 | extern void Window_destroy (Any *); 102 | extern void Window_describe (Window*, FILE*); 103 | extern void Window_print (Window*, FILE*); 104 | 105 | #endif 106 | --------------------------------------------------------------------------------