# shellcheck    shell=sh
# Section: loadavg
# loadavg v1 v2 v3

___x_cmd_os_loadavg_(){
    x_="$(___x_cmd_os_loadavg "$@")"
}

___x_cmd_os_loadavg() {
    if [ "$#" -eq 0 ]; then
        ___x_cmd_os_loadavg___get
        return
    fi

    ___x_cmd readl "$@" <<A
$(___x_cmd_os_loadavg___get | command tr ' ' '\n')
A

}

___x_cmd_os_loadavg___get() {
    ___x_cmd_os_name_
    ___x_cmd_os_loadavg___get_fromos
}

___x_cmd_os_loadavg___get_from_osname() {
    case "$___X_CMD_OS_NAME_" in
        darwin | freebsd)       command sysctl -q -n vm.loadavg | command cut -d' ' -f2-4       ;;
        linux | win)            command cut -d' ' -f1-3 </proc/loadavg                  ;; # win is cygwin
        openbsd)                command sysctl -q -n vm.loadavg | command cut -d' ' -f1-3       ;;
    esac
}
## EndSection