refactor(linux-gpu): add note and remove debug logs
This commit is contained in:
@@ -139,29 +139,25 @@ pub fn getGpuInfo(allocator: std.mem.Allocator) !std.ArrayList(GpuInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parseGpuName(allocator: std.mem.Allocator, name: []u8) ![]u8 {
|
fn parseGpuName(allocator: std.mem.Allocator, name: []u8) ![]u8 {
|
||||||
|
// NOTE: for references: https://github.com/pciutils/pciutils/blob/master/pci.ids
|
||||||
|
|
||||||
if (std.mem.startsWith(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]")) {
|
if (std.mem.startsWith(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]")) {
|
||||||
const size = std.mem.replacementSize(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]", "AMD");
|
const size = std.mem.replacementSize(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]", "AMD");
|
||||||
const parsed_gpu_name = try allocator.alloc(u8, size);
|
const parsed_gpu_name = try allocator.alloc(u8, size);
|
||||||
_ = std.mem.replace(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]", "AMD", parsed_gpu_name);
|
_ = std.mem.replace(u8, name, "Advanced Micro Devices, Inc. [AMD/ATI]", "AMD", parsed_gpu_name);
|
||||||
|
|
||||||
std.log.info("gpu amd: {s}\n", .{parsed_gpu_name});
|
|
||||||
|
|
||||||
return parsed_gpu_name;
|
return parsed_gpu_name;
|
||||||
} else if (std.mem.startsWith(u8, name, "Intel Corporation")) {
|
} else if (std.mem.startsWith(u8, name, "Intel Corporation")) {
|
||||||
const size = std.mem.replacementSize(u8, name, "Intel Corporation", "Intel");
|
const size = std.mem.replacementSize(u8, name, "Intel Corporation", "Intel");
|
||||||
const parsed_gpu_name = try allocator.alloc(u8, size);
|
const parsed_gpu_name = try allocator.alloc(u8, size);
|
||||||
_ = std.mem.replace(u8, name, "Intel Corporation", "Intel", parsed_gpu_name);
|
_ = std.mem.replace(u8, name, "Intel Corporation", "Intel", parsed_gpu_name);
|
||||||
|
|
||||||
std.log.info("gpu intel: {s}\n", .{parsed_gpu_name});
|
|
||||||
|
|
||||||
return parsed_gpu_name;
|
return parsed_gpu_name;
|
||||||
} else if (std.mem.startsWith(u8, name, "NVIDIA Corporation")) {
|
} else if (std.mem.startsWith(u8, name, "NVIDIA Corporation")) {
|
||||||
const size = std.mem.replacementSize(u8, name, "NVIDIA Corporation", "NVIDIA");
|
const size = std.mem.replacementSize(u8, name, "NVIDIA Corporation", "NVIDIA");
|
||||||
const parsed_gpu_name = try allocator.alloc(u8, size);
|
const parsed_gpu_name = try allocator.alloc(u8, size);
|
||||||
_ = std.mem.replace(u8, name, "NVIDIA Corporation", "NVIDIA", parsed_gpu_name);
|
_ = std.mem.replace(u8, name, "NVIDIA Corporation", "NVIDIA", parsed_gpu_name);
|
||||||
|
|
||||||
std.log.info("gpu nvidia: {s}\n", .{parsed_gpu_name});
|
|
||||||
|
|
||||||
return parsed_gpu_name;
|
return parsed_gpu_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user