Skip to content

Commit

Permalink
fix: cache data for gpu information (#1959)
Browse files Browse the repository at this point in the history
* fix: wrap vulkan gpu function

* fix: init

* fix: cpu usage

* fix: build windows

* fix: buld macos

---------

Co-authored-by: vansangpfiev <[email protected]>
  • Loading branch information
vansangpfiev and sangjanai authored Feb 12, 2025
1 parent 4eba4ee commit eb28d51
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 164 deletions.
9 changes: 9 additions & 0 deletions engine/utils/hardware/cpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ inline CPU GetCPUInfo() {
return CPU{};
auto cpu = res[0];
cortex::cpuid::CpuInfo inst;

#if defined(__linux__)
float usage = 0;
for (auto const& c : res) {
usage += c.currentUtilisation();
}
usage = usage / res.size() * 100;
#else
float usage = GetCPUUsage();
#endif
// float usage = 0;
return CPU{.cores = cpu.numPhysicalCores(),
.arch = std::string(GetArch()),
Expand Down
Loading

0 comments on commit eb28d51

Please sign in to comment.