aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/data.lua')
-rw-r--r--lib/data.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/data.lua b/lib/data.lua
index 1afc9c9..d5203a8 100644
--- a/lib/data.lua
+++ b/lib/data.lua
@@ -312,9 +312,20 @@ function M.cpu_model(cpuinfo)
local s = cpuinfo:match('model name%s*:%s*([^\n]+)')
if not s then return nil end
s = s:gsub('%(R%)', ''):gsub('%(TM%)', ''):gsub('%(tm%)', '')
+ -- The vendor word can sit behind a generation prefix ('11th Gen Intel Core
+ -- i7-1165G7'), so the prefix goes first and the vendor anchor is applied
+ -- after it rather than only at the very start.
+ s = s:gsub('^%s*%d+th Gen%s+', '')
s = s:gsub('^%s*AMD%s+', ''):gsub('^%s*Intel%s+', '')
s = s:gsub('%s+%d+%-Core Processor.*$', '')
- s = s:gsub('%s+CPU%s*@.*$', '')
+ -- The clock tail, with or without a literal 'CPU' before the '@'. A Xeon
+ -- reads 'E5-2680 v4 @ 2.40GHz' and a Tiger Lake 'i7-1165G7 @ 2.80GHz', so
+ -- requiring the CPU token leaves the clock on the card for everything but
+ -- the one form the fixture happens to carry.
+ -- The clock tail goes first, then the bare 'CPU' token wherever it sits: a
+ -- Xeon reads 'Xeon CPU E5-2680 v4 @ 2.40GHz', so the token is mid-string,
+ -- not trailing.
+ s = s:gsub('%s*@.*$', ''):gsub('%s+CPU%f[%A]', '')
s = s:gsub('%s+Processor%s*$', '')
s = s:gsub('%s+', ' '):gsub('^%s+', ''):gsub('%s+$', '')
if s == '' then return nil end