mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
[v1.03][PPC] Implement hypervisor detection in PowerPC
This commit is contained in:
@@ -36,6 +36,7 @@ enum {
|
||||
HV_VENDOR_VMWARE,
|
||||
HV_VENDOR_XEN,
|
||||
HV_VENDOR_PARALLELS,
|
||||
HV_VENDOR_PHYP,
|
||||
HV_VENDOR_INVALID
|
||||
};
|
||||
|
||||
|
||||
@@ -681,6 +681,9 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
setAttribute(art, ATTRIBUTE_NAME, cpu_name);
|
||||
}
|
||||
setAttribute(art, ATTRIBUTE_UARCH, uarch);
|
||||
if(cpu->hv->present) {
|
||||
setAttribute(art, ATTRIBUTE_HYPERVISOR, cpu->hv->hv_name);
|
||||
}
|
||||
setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process);
|
||||
setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency);
|
||||
uint32_t socket_num = get_nsockets(cpu->topo);
|
||||
|
||||
@@ -374,3 +374,18 @@ int get_num_sockets_package_cpus(struct topology* topo) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Inspired in is_devtree_compatible from lscpu
|
||||
bool is_devtree_compatible(char* str) {
|
||||
int filelen;
|
||||
char* buf;
|
||||
if((buf = read_file("/proc/device-tree/compatible", &filelen)) == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char* tmp;
|
||||
if((tmp = strstr(buf, str)) == NULL) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,5 +40,6 @@ long get_l3_cache_size(uint32_t core);
|
||||
int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level);
|
||||
int get_num_sockets_package_cpus(struct topology* topo);
|
||||
int get_ncores_from_cpuinfo(void);
|
||||
bool is_devtree_compatible(char* str);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user