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

Commit 71a1e360 authored by Anthony King's avatar Anthony King Committed by Gerrit Code Review
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 c3cc5ec6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2331,7 +2331,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
}
@@ -2588,10 +2588,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))
@@ -2616,6 +2616,11 @@ function make()
    return $ret
}

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



if [ "x$SHELL" != "x/bin/bash" ]; then