mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
made cpu flag string code more readable
This commit is contained in:
parent
a18aa882a8
commit
e792d57762
46
inxi
46
inxi
|
@ -3388,42 +3388,44 @@ process_cpu_flags()
|
|||
cpu_flags=$( echo "$cpu_flags" | gawk '
|
||||
BEGIN {
|
||||
RS=" "
|
||||
ssel["sse"] = 1
|
||||
ssel["sse2"] = 2
|
||||
ssel["pni"] = 3
|
||||
ssel["sse4a"] = 4 # 4a must precede 4
|
||||
ssel["sse4"] = 5
|
||||
ssel["sse5"] = 6
|
||||
sses[1] = "sse"
|
||||
sses[2] = "sse2"
|
||||
sses[3] = "sse3"
|
||||
sses[4] = "sse4a"
|
||||
sses[5] = "sse4"
|
||||
sses[6] = "sse5"
|
||||
a_ssel["sse"] = 1
|
||||
a_ssel["sse2"] = 2
|
||||
a_ssel["pni"] = 3
|
||||
a_ssel["sse4a"] = 4 # 4a must precede 4
|
||||
a_ssel["sse4"] = 5
|
||||
a_ssel["sse5"] = 6
|
||||
a_sses[1] = "sse"
|
||||
a_sses[2] = "sse2"
|
||||
a_sses[3] = "sse3"
|
||||
a_sses[4] = "sse4a"
|
||||
a_sses[5] = "sse4"
|
||||
a_sses[6] = "sse5"
|
||||
sseCounter = 0
|
||||
flag_string = ""
|
||||
}
|
||||
/^(nx|lm|svm|vmx)$/ {
|
||||
if (s) {
|
||||
s = s " " $0
|
||||
if ( flag_string != "" ) {
|
||||
flag_string = flag_string " " $0
|
||||
}
|
||||
else {
|
||||
s = $0
|
||||
flag_string = $0
|
||||
}
|
||||
}
|
||||
/^(sse|sse2|sse4a|sse4|sse5|pni)$/ {
|
||||
if (ssel[$0] > sse) {
|
||||
sse = ssel[$0]
|
||||
if ( a_ssel[$0] > sseCounter ) {
|
||||
sseCounter = a_ssel[$0]
|
||||
}
|
||||
}
|
||||
END {
|
||||
if (sse) {
|
||||
if (s) {
|
||||
s = sses[sse] " " s
|
||||
if ( sseCounter > 0 ) {
|
||||
if ( flag_string != "" ) {
|
||||
flag_string = a_sses[sseCounter] " " flag_string
|
||||
}
|
||||
else {
|
||||
s = sses[sse]
|
||||
flag_string = a_sses[sseCounter]
|
||||
}
|
||||
}
|
||||
print s
|
||||
print flag_string
|
||||
}' )
|
||||
|
||||
#grep -oE '\<(nx|lm|sse[0-9]?|pni|svm|vmx)\>' | tr '\n' ' '))
|
||||
|
|
Loading…
Reference in a new issue