File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -1132,7 +1132,7 @@ elseif(Haiku)
11321132 src/detection/chassis/chassis_windows.c
11331133 src/detection/cpu/cpu_haiku.c
11341134 src/detection/cpucache/cpucache_shared.c
1135- src/detection/cpuusage/cpuusage_nosupport .c
1135+ src/detection/cpuusage/cpuusage_haiku .c
11361136 src/detection/cursor/cursor_nosupport.c
11371137 src/detection/bluetooth/bluetooth_nosupport.c
11381138 src/detection/bluetoothradio/bluetoothradio_nosupport.c
Original file line number Diff line number Diff line change 1+ #include "fastfetch.h"
2+ #include "detection/cpuusage/cpuusage.h"
3+ #include "util/mallocHelper.h"
4+
5+ #include <OS.h>
6+
7+ const char * ffGetCpuUsageInfo (FFlist * cpuTimes )
8+ {
9+ system_info sysInfo ;
10+ if (get_system_info (& sysInfo ) != B_OK )
11+ return "get_system_info() failed" ;
12+
13+ FF_AUTO_FREE cpu_info * cpuInfo = malloc (sizeof (* cpuInfo ) * sysInfo .cpu_count );
14+ if (get_cpu_info (0 , sysInfo .cpu_count , cpuInfo ) != B_OK )
15+ return "get_cpu_info() failed" ;
16+
17+ uint64_t uptime = (uint64_t ) system_time ();
18+
19+ for (uint32_t i = 0 ; i < sysInfo .cpu_count ; ++ i )
20+ {
21+ FFCpuUsageInfo * info = (FFCpuUsageInfo * ) ffListAdd (cpuTimes );
22+ info -> inUseAll = (uint64_t ) cpuInfo [i ].active_time ;
23+ info -> totalAll = uptime ;
24+ }
25+
26+ return NULL ;
27+ }
You can’t perform that action at this time.
0 commit comments