[v0.11] Print available more information for iGPU
This commit is contained in:
@@ -47,7 +47,7 @@ else()
|
|||||||
link_libraries(${PCIUTILS_LIBRARIES})
|
link_libraries(${PCIUTILS_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(gpufetch ${COMMON_DIR}/main.cpp ${COMMON_DIR}/args.cpp ${COMMON_DIR}/gpu.cpp ${COMMON_DIR}/pci.cpp ${COMMON_DIR}/global.cpp ${COMMON_DIR}/printer.cpp ${COMMON_DIR}/master.cpp)
|
add_executable(gpufetch ${COMMON_DIR}/main.cpp ${COMMON_DIR}/args.cpp ${COMMON_DIR}/gpu.cpp ${COMMON_DIR}/pci.cpp ${COMMON_DIR}/global.cpp ${COMMON_DIR}/printer.cpp ${COMMON_DIR}/master.cpp ${COMMON_DIR}/uarch.cpp)
|
||||||
set(SANITY_FLAGS "-Wfloat-equal -Wshadow -Wpointer-arith")
|
set(SANITY_FLAGS "-Wfloat-equal -Wshadow -Wpointer-arith")
|
||||||
set(CMAKE_CXX_FLAGS "${SANITY_FLAGS} -Wall -Wextra -pedantic -fstack-protector-all -pedantic")
|
set(CMAKE_CXX_FLAGS "${SANITY_FLAGS} -Wall -Wextra -pedantic -fstack-protector-all -pedantic")
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,12 @@ bool print_gpufetch_intel(struct gpu_info* gpu, STYLE s, struct color** cs, stru
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
char* gpu_name = get_str_gpu_name(gpu);
|
char* gpu_name = get_str_gpu_name(gpu);
|
||||||
|
char* uarch = get_str_uarch(gpu->arch);
|
||||||
|
char* manufacturing_process = get_str_process(gpu->arch);
|
||||||
|
|
||||||
setAttribute(art, ATTRIBUTE_NAME, gpu_name);
|
setAttribute(art, ATTRIBUTE_NAME, gpu_name);
|
||||||
|
setAttribute(art, ATTRIBUTE_UARCH, uarch);
|
||||||
|
setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process);
|
||||||
|
|
||||||
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
||||||
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||||
|
|||||||
28
src/common/uarch.cpp
Normal file
28
src/common/uarch.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "global.hpp"
|
||||||
|
#include "uarch.hpp"
|
||||||
|
|
||||||
|
char* get_str_process(struct uarch* arch) {
|
||||||
|
char* str = (char *) emalloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
|
||||||
|
int32_t process = arch->process;
|
||||||
|
|
||||||
|
if(process == UNK) {
|
||||||
|
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
|
||||||
|
}
|
||||||
|
else if(process > 100) {
|
||||||
|
sprintf(str, "%.2fum", (double)process/100);
|
||||||
|
}
|
||||||
|
else if(process > 0){
|
||||||
|
sprintf(str, "%dnm", process);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
|
||||||
|
printBug("Found invalid process: '%d'", process);
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
#ifndef __COMMON_UARCH__
|
#ifndef __COMMON_UARCH__
|
||||||
#define __COMMON_UARCH__
|
#define __COMMON_UARCH__
|
||||||
|
|
||||||
|
// Data not available
|
||||||
|
#define NA -1
|
||||||
|
|
||||||
|
// Unknown manufacturing process
|
||||||
|
#define UNK -1
|
||||||
|
|
||||||
typedef uint32_t GPUCHIP;
|
typedef uint32_t GPUCHIP;
|
||||||
typedef uint32_t MICROARCH;
|
typedef uint32_t MICROARCH;
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,6 @@
|
|||||||
// Any clock multiplier
|
// Any clock multiplier
|
||||||
#define CM_ANY -1
|
#define CM_ANY -1
|
||||||
|
|
||||||
// Data not available
|
|
||||||
#define NA -1
|
|
||||||
|
|
||||||
// Unknown manufacturing process
|
|
||||||
#define UNK -1
|
|
||||||
|
|
||||||
// MICROARCH values
|
// MICROARCH values
|
||||||
enum {
|
enum {
|
||||||
UARCH_UNKNOWN,
|
UARCH_UNKNOWN,
|
||||||
@@ -332,27 +326,6 @@ char* get_str_cc(struct uarch* arch) {
|
|||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_str_process(struct uarch* arch) {
|
|
||||||
char* str = (char *) emalloc(sizeof(char) * (strlen(STRING_UNKNOWN)+1));
|
|
||||||
int32_t process = arch->process;
|
|
||||||
|
|
||||||
if(process == UNK) {
|
|
||||||
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
|
|
||||||
}
|
|
||||||
else if(process > 100) {
|
|
||||||
sprintf(str, "%.2fum", (double)process/100);
|
|
||||||
}
|
|
||||||
else if(process > 0){
|
|
||||||
sprintf(str, "%dnm", process);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
snprintf(str, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
|
|
||||||
printBug("Found invalid process: '%d'", process);
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* get_str_chip(struct uarch* arch) {
|
char* get_str_chip(struct uarch* arch) {
|
||||||
return arch->chip_str;
|
return arch->chip_str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "../common/uarch.hpp"
|
#include "../common/uarch.hpp"
|
||||||
#include "../common/global.hpp"
|
#include "../common/global.hpp"
|
||||||
@@ -60,6 +61,10 @@ void map_chip_to_uarch(struct uarch* arch) {
|
|||||||
CHECK_UARCH_END
|
CHECK_UARCH_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* get_str_uarch(struct uarch* arch) {
|
||||||
|
return uarch_str[arch->uarch];
|
||||||
|
}
|
||||||
|
|
||||||
struct uarch* get_uarch_from_pci(struct pci* pci) {
|
struct uarch* get_uarch_from_pci(struct pci* pci) {
|
||||||
struct uarch* arch = (struct uarch*) emalloc(sizeof(struct uarch));
|
struct uarch* arch = (struct uarch*) emalloc(sizeof(struct uarch));
|
||||||
|
|
||||||
@@ -71,5 +76,7 @@ struct uarch* get_uarch_from_pci(struct pci* pci) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* get_name_from_uarch(struct uarch* arch) {
|
char* get_name_from_uarch(struct uarch* arch) {
|
||||||
return arch->chip_str;
|
char* name = (char *) emalloc(sizeof(char) * (strlen(arch->chip_str) + 6 + 1));
|
||||||
|
sprintf(name, "Intel %s", arch->chip_str);
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ struct uarch;
|
|||||||
|
|
||||||
struct uarch* get_uarch_from_pci(struct pci* pci);
|
struct uarch* get_uarch_from_pci(struct pci* pci);
|
||||||
char* get_name_from_uarch(struct uarch* arch);
|
char* get_name_from_uarch(struct uarch* arch);
|
||||||
|
const char* get_str_uarch(struct uarch* arch);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user