mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
version upgrade:
Optimized graphics driver function massively, knocked off about 60% of execution time by switching to a single read through via gawk.. In terms of dual core system, that saved literally about 1 second execution total time.
This commit is contained in:
parent
8b297bd69e
commit
93b245e1af
54
inxi
54
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.6.7
|
#### version: 1.6.8
|
||||||
#### Date: June 10 2011
|
#### Date: June 13 2011
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -3505,30 +3505,42 @@ get_graphics_driver()
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
|
|
||||||
# list is from sgfxi plus non-free drivers
|
# list is from sgfxi plus non-free drivers
|
||||||
local driver_list='apm ark ati chips cirrus cyrix fbdev fglrx glint i128 i740 intel i810 imstt mach64 mga neomagic nsc nv nvidia openchrome nouveau radeon radeonhd rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng unichrome vesa vga via voodoo vmware v4l'
|
local driver_list='apm|ark|ati|chips|cirrus|cyrix|fbdev|fglrx|glint|i128|i740|intel|i810|imstt|mach64|mga|neomagic|nsc|nv|nvidia|openchrome|nouveau|radeon|radeonhd|rendition|s3|s3virge|savage|siliconmotion|sis|sisusb|tdfx|tga|trident|tseng|unichrome|vesa|vga|via|voodoo|vmware|v4l'
|
||||||
local driver='' driver_string='' xorg_log_data='' status='' temp_array=''
|
local driver='' driver_string='' xorg_log_data='' status='' temp_array=''
|
||||||
|
|
||||||
if [[ $B_XORG_LOG == 'true' ]];then
|
if [[ $B_XORG_LOG == 'true' ]];then
|
||||||
xorg_log_data="$( cat $FILE_XORG_LOG )"
|
|
||||||
A_GRAPHIC_DRIVERS=( $(
|
A_GRAPHIC_DRIVERS=( $(
|
||||||
for driver in $driver_list
|
gawk '
|
||||||
do
|
BEGIN {
|
||||||
# note there appears to be different unload/failed syntax, so using simple conservative one
|
i=0
|
||||||
if [[ -n $( grep -s "[[:space:]]Loading.*${driver}_drv.so" <<< "$xorg_log_data" ) ]];then
|
driver=""
|
||||||
if [[ -n $( grep -si "Failed.*${driver}_drv.so" <<< "$xorg_log_data" ) ]];then
|
}
|
||||||
status='failed'
|
/[[:space:]]Loading.*('"$driver_list"')_drv.so$/ {
|
||||||
# can be Unloading driver OR Unloading /usr/lib/xorg/modules/drivers/driver_drv.so
|
driver=gensub(/.*[[:space:]]Loading.*('"$driver_list"')_drv.so/, "\\1", 1, $0 )
|
||||||
elif [[ -n $( grep -Esi "Unloading[[:space:]](${driver}|.*${driver}_drv.so)$" <<< "$xorg_log_data" ) ]];then
|
# we get all the actually loaded drivers first, we will use this to compare the
|
||||||
status='unloaded'
|
# failed/unloaded, which have not always actually been truly loaded
|
||||||
else
|
aDrivers[driver]="loaded"
|
||||||
status='loaded'
|
}
|
||||||
fi
|
/Unloading[[:space:]].*('"$driver_list"')(|_drv.so)$/ {
|
||||||
driver_string="$driver,$status"
|
driver=gensub(/(.*)Unloading[[:space:]].*('"$driver_list"')(|_drv.so)$/, "\\2", 1, $0 )
|
||||||
echo $driver_string
|
# we need to make sure that the driver has already been truly loaded, not just discussed
|
||||||
fi
|
if ( driver in aDrivers ) {
|
||||||
done
|
aDrivers[driver]="unloaded"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/Failed.*('"$driver_list"')_drv.so$/ {
|
||||||
|
driver=gensub(/(.*)Failed.*('"$driver_list"')_drv.so$/, "\\2", 1, $0 )
|
||||||
|
# we need to make sure that the driver has already been truly loaded, not just discussed
|
||||||
|
if ( driver in aDrivers ) {
|
||||||
|
aDrivers[driver]="failed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for ( var in aDrivers ) {
|
||||||
|
print var "," aDrivers[var]
|
||||||
|
}
|
||||||
|
}' < $FILE_XORG_LOG
|
||||||
) )
|
) )
|
||||||
xorg_log_data='' # dump from ram, does it matter?
|
|
||||||
fi
|
fi
|
||||||
temp_array=${A_GRAPHIC_DRIVERS[@]}
|
temp_array=${A_GRAPHIC_DRIVERS[@]}
|
||||||
log_function_data "A_GRAPHIC_DRIVERS: $temp_array"
|
log_function_data "A_GRAPHIC_DRIVERS: $temp_array"
|
||||||
|
|
Loading…
Reference in a new issue