refactor(linux-gpu): add note and remove debug logs

This commit is contained in:
utox39
2025-07-17 15:34:21 +02:00
parent f73b1be023
commit ec0e3ffd18

View File

@@ -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;
} }