File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed
Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -184,20 +184,33 @@ export class SystemService {
184184 encoding : "utf8" ,
185185 } ) . trim ( ) ;
186186
187- const biosModel = execSync (
188- "lscpu | grep 'BIOS Model name' | awk '{print $3}'" ,
189- { encoding : "utf8" } ,
190- ) . trim ( ) ;
187+ let cpuGHz : string | undefined ;
191188
192- const modelGHzMatch = model . match ( / ( \d + \. ? \d * ) \s * G H z / i) ;
189+ if ( ! cpuGHz ) {
190+ const modelGHzMatch = model . match ( / ( \d + \. ? \d * ) \s * G H z / i) ;
193191
194- let cpuGHz : string | undefined ;
192+ if ( modelGHzMatch ) {
193+ cpuGHz = modelGHzMatch . at ( 1 ) ;
194+ }
195+ }
195196
196- if ( modelGHzMatch ) {
197- cpuGHz = modelGHzMatch . at ( 1 ) ;
197+ if ( ! cpuGHz ) {
198+ const maxMHz = execSync ( "lscpu | grep 'CPU max MHz:'" , {
199+ encoding : "utf8" ,
200+ } ) . trim ( ) ;
201+
202+ const maxMHzMatch = maxMHz . match ( / ( \d + \. ? \d * ) \s * M H z / i) ;
203+ if ( maxMHzMatch ) {
204+ cpuGHz = maxMHzMatch . at ( 1 ) ;
205+ }
198206 }
199207
200208 if ( ! cpuGHz ) {
209+ const biosModel = execSync (
210+ "lscpu | grep 'BIOS Model name' | awk '{print $3}'" ,
211+ { encoding : "utf8" } ,
212+ ) . trim ( ) ;
213+
201214 const biosModelGHzMatch = biosModel . match ( / ( \d + \. ? \d * ) \s * G H z / i) ;
202215
203216 if ( biosModelGHzMatch ) {
You can’t perform that action at this time.
0 commit comments