cpu_information.sh
542 Bytes
gather_cpu_info() {
[ -z "${NCPUS}" ] || return
has_class "GNU" && {
export NCPUS=$(${NPROC})
}
has_class "Linux" && {
eval $(${LSCPU} | ${AWK} -F: '
{ sub(/^ */,"",$2) }
/Byte Order/ {
sub(/ /,"_",$2);
print "export BYTE_ORDER=\"" $2 "\";"
}
/CPU op-mode/ {
sub(/,/,"",$2);
print "export OP_MODES=\"" $2 "\";"
}
/CPU(s):/ { print "export NCPUS=" $2 ";" }
/Virtualization/ { print "export CPU_VIRT=\"" $2 "\";" }')
}
set_class ${NCPUS}cpus ${CPU_VIRT} ${BYTE_ORDER} ${OP_MODES}
}
# vim: set ts=4 sw=4: