Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40b093fb authored by Anthony King's avatar Anthony King Committed by Adnan Begovic
Browse files

envsetup: add mk_timer

this wraps around any method call, mainly for 'make'.

mka needs this on linux, since ionice and schedtool don't
respect functions

Change-Id: If8cdd235ed9eba377dd90ab8b12e93036a377ea5
parent ccc711c7
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2092,7 +2092,7 @@ function mka() {
            make -j `sysctl hw.ncpu|cut -d" " -f2` "$@"
            ;;
        *)
            schedtool -B -n 1 -e ionice -n 1 make -j$(cat /proc/cpuinfo | grep "^processor" | wc -l) "$@"
            mk_timer schedtool -B -n 1 -e ionice -n 1 make -j$(cat /proc/cpuinfo | grep "^processor" | wc -l) "$@"
            ;;
    esac
}
@@ -2298,10 +2298,10 @@ function get_make_command()
  echo command make
}

function make()
function mk_timer()
{
    local start_time=$(date +"%s")
    $(get_make_command) "$@"
    $@
    local ret=$?
    local end_time=$(date +"%s")
    local tdiff=$(($end_time-$start_time))
@@ -2336,6 +2336,11 @@ function make()
    return $ret
}

function make()
{
    mk_timer $(get_make_command) "$@"
}

if [ "x$SHELL" != "x/bin/bash" ]; then
    case `ps -o command -p $$` in
        *bash*)