[Micromax A110] andiroxu:
How to change CPU governors and I/O schedulers

Guys. I created a cputuner script for all devices and not just for MMX. The code is given below. Just copy it in the file and name it cputuner. Run the script using SM. The settings will stick in every reboot.

#!/system/bin/sh
# CPU Tuner
# by andiroxu [MENTION=934623]xda 2[/MENTION]013

# Copyright (C) andiroxu
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program.
# If not, see

busybox clear
busybox mount -o rw,remount rootfs /
busybox mount -o rw,remount /system

if [ ! -d "/sqlite_stmt_journals" ]; then
mkdir /sqlite_stmt_journals
chown 0.0 /sqlite_stmt_journals
chmod 777 /sqlite_stmt_journals
fi

busybox rm -f /system/etc/init.d/01cputuner
busybox touch /system/etc/init.d/01cputuner
busybox chmod -f 777 /system/etc/init.d/01cputuner
busybox chown -f 0.0 /system/etc/init.d/01cputuner

busybox echo ""
busybox echo "============================"
busybox echo "= Please select a governor ="
busybox echo "============================"
busybox echo ""
busybox sleep 1
SERIAL_NO=1
AVAIL_GOVS=(`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`)
for GOVS in ${AVAIL_GOVS[@]}; do
busybox echo "$SERIAL_NO) $GOVS"
SERIAL_NO=$(($SERIAL_NO+1))
done
SERIAL_NO=$(($SERIAL_NO-1))
busybox echo ""
busybox echo -n "Select which governor you would like to use: [ 1 - $SERIAL_NO ]: "
read CHOICE
INDEX=$(($CHOICE-1))
SELECTED_GOV=${AVAIL_GOVS[${INDEX}]}
busybox echo ""
busybox echo "You selected '$SELECTED_GOV' governor..."
busybox sleep 1
for c in `ls -d /sys/devices/system/cpu/cpu?`; do
if [ -e ${c}/cpufreq/scaling_governor ]; then
busybox chmod -f 644 ${c}/cpufreq/*
busybox echo "${SELECTED_GOV}" >> ${c}/cpufreq/scaling_governor 2>/dev/null
fi 2>/dev/null
done 2>/dev/null

# Making all cores active
for c in `ls -d /sys/devices/system/cpu/cpu?`; do
if [ -e ${c}/online ]; then
busybox chmod -f 644 ${c}/online 2>/dev/null
fi 2>/dev/null

if [ -e ${c}/online ]; then
busybox echo "1" >> ${c}/online 2>/dev/null
fi 2>/dev/null
done 2>/dev/null

busybox echo ""
busybox echo "============================="
busybox echo "= Please select a scheduler ="
busybox echo "============================="
busybox echo ""
busybox sleep 1

SERIAL_NO=1
COUNT=`cat /sys/block/mmcblk0/queue/scheduler | wc -w`
busybox chmod -f 644 /sys/block/mmcblk0/queue/*
while [ $SERIAL_NO -le $COUNT ]; do
busybox echo "$SERIAL_NO) `cat /sys/block/mmcblk0/queue/scheduler | awk '{print $'$SERIAL_NO'}' | cut -d '[' -f 2 | cut -d ']' -f 1 `"
SERIAL_NO=$(($SERIAL_NO+1))
done
busybox echo ""
SERIAL_NO=$(($SERIAL_NO-1))
busybox echo -n "Select which scheduler you would like to use: [ 1 - $SERIAL_NO ]: "
read CHOICE
INDEX=$(($CHOICE))
SELECTED_SCHEDULER=`cat /sys/block/mmcblk0/queue/scheduler | awk '{print $'$INDEX'}' | cut -d '[' -f 2 | cut -d ']' -f 1 `
busybox echo ""
busybox echo "You selected '$SELECTED_SCHEDULER' scheduler..."
busybox sleep 1

m=/sys/block/dm-*
emmc=/sys/block/mmc*
loop=/sys/block/loop*
ram=/sys/block/ram*
zram=/sys/block/zram*
stl=/sys/block/stl*
bml=/sys/block/bml*
mtd=/sys/block/mtd*

for a in $dm $stl $bml $mtd $emmc $loop $ram $zram; do
if [ -e ${a}/queue ]; then
busybox chmod -f 644 ${a}/queue/*
busybox echo "${SELECTED_SCHEDULER}" >> ${a}/queue/scheduler
fi
done

busybox echo ""
busybox echo "============================="
busybox echo "= Please select a max freq ="
busybox echo "============================="
busybox echo ""
busybox sleep 1

SERIAL_NO=1
TRANS_RANGE=(`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | awk '{print $1}'`)
for AVAIL_FREQ in ${TRANS_RANGE[@]}; do
busybox echo "$SERIAL_NO) $AVAIL_FREQ KHz"
SERIAL_NO=$(($SERIAL_NO+1))
done
SERIAL_NO=$(($SERIAL_NO-1))
busybox echo ""
busybox echo -n "Select which max freq you would like to use: [ 1 - $SERIAL_NO ]: "
read CHOICE
INDEX=$(($CHOICE-1))
SELECTED_MAX_FREQ=${TRANS_RANGE[${INDEX}]}
busybox echo ""
busybox echo "You selected '$SELECTED_MAX_FREQ' max freq..."
busybox sleep 1

# Setting max frequency on active cores
for c in `ls -d /sys/devices/system/cpu/cpu?`; do
if [ -e ${c}/cpufreq ]; then
busybox chmod -f 644 ${c}/cpufreq/scaling_max_freq
fi

if [ -e ${c}/cpufreq ]; then
busybox echo "${SELECTED_MAX_FREQ}" >> ${c}/cpufreq/scaling_max_freq
fi
done

busybox echo ""
busybox echo "============================="
busybox echo "= Please select a min freq ="
busybox echo "============================="
busybox echo ""
busybox sleep 1

SERIAL_NO=1
TRANS_RANGE=(`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | awk '{print $1}'`)
for AVAIL_FREQ in ${TRANS_RANGE[@]}; do
busybox echo "$SERIAL_NO) $AVAIL_FREQ KHz"
SERIAL_NO=$(($SERIAL_NO+1))
done
SERIAL_NO=$(($SERIAL_NO-1))
busybox echo ""
busybox echo -n "Select which min freq you would like to use: [ 1 - $SERIAL_NO ]: "
read CHOICE
INDEX=$(($CHOICE-1))
SELECTED_MIN_FREQ=${TRANS_RANGE[${INDEX}]}
busybox echo ""
busybox echo "You selected '$SELECTED_MIN_FREQ' min freq..."
busybox sleep 1

# Setting min frequency on active cores
for c in `ls -d /sys/devices/system/cpu/cpu?`; do
if [ -e ${c}/cpufreq ]; then
busybox chmod -f 644 ${c}/cpufreq/scaling_min_freq
fi

if [ -e ${c}/cpufreq ]; then
busybox echo "${SELECTED_MIN_FREQ}" >> ${c}/cpufreq/scaling_min_freq
fi
done

busybox sleep 1
busybox echo ""
busybox echo "CPU Tuning has been done!!!"
busybox echo "These values will be stick on boot."
busybox echo ""
busybox echo "THANK YOU!!!"
busybox echo ""
busybox sleep 1

cat >> /system/etc/init.d/01cputuner \${c}/cpufreq/scaling_governor
fi
done

# Making all cores online
for c in \`ls -d /sys/devices/system/cpu/cpu?\`; do
if [ -e \${c}/online ]; then
busybox chmod -f 644 \${c}/online 2>/dev/null
fi 2>/dev/null

if [ -e \${c}/online ]; then
busybox echo "1" >> \${c}/online 2>/dev/null
fi 2>/dev/null
done 2>/dev/null

# Changing to the selected I/O Scheduler
m=/sys/block/dm-*
emmc=/sys/block/mmc*
loop=/sys/block/loop*
ram=/sys/block/ram*
zram=/sys/block/zram*
stl=/sys/block/stl*
bml=/sys/block/bml*
mtd=/sys/block/mtd*

for a in \$dm \$stl \$bml \$mtd \$emmc \$loop \$ram \$zram; do
if [ -e \${a}/queue ]; then
busybox chmod -f 644 \${a}/queue/*
busybox echo "${SELECTED_SCHEDULER}" >> \${a}/queue/scheduler
fi
done

# Changing max frequecy on all cores
for c in \`ls -d /sys/devices/system/cpu/cpu?\`; do
if [ -e \${c}/cpufreq ]; then
busybox chmod -f 644 \${c}/cpufreq/scaling_max_freq
fi

if [ -e \${c}/cpufreq ]; then
busybox echo "${SELECTED_MAX_FREQ}" >> \${c}/cpufreq/scaling_max_freq
fi
done

# Changing min frequecy on all cores
for c in \`ls -d /sys/devices/system/cpu/cpu?\`; do
if [ -e \${c}/cpufreq ]; then
busybox chmod -f 644 \${c}/cpufreq/scaling_min_freq
fi

if [ -e \${c}/cpufreq ]; then
busybox echo "${SELECTED_MIN_FREQ}" >> \${c}/cpufreq/scaling_min_freq
fi
done

EOF

rm -r /sqlite_stmt_journals 2>/dev/null

busybox chown 0.0 /system/etc/init.d/01cputuner
busybox chmod 777 /system/etc/init.d/01cputuner

exit 0

Note: This is 100% genuine work and don't try to reproduce it any way or no one is allowed to use it their ROM with prior permission.

After all I'm a coder and real developer and love coding and this is known to many of you:cool: