diff options
Diffstat (limited to 'abs/core/tweaker/bin/twk_RAM.pl')
-rwxr-xr-x | abs/core/tweaker/bin/twk_RAM.pl | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/abs/core/tweaker/bin/twk_RAM.pl b/abs/core/tweaker/bin/twk_RAM.pl deleted file mode 100755 index 2eea598..0000000 --- a/abs/core/tweaker/bin/twk_RAM.pl +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright 2007-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv. -# -# 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 <http://www.gnu.org/licenses/>. - -use Switch; -use Tweaker::Script; -package Tweaker::Script; - -set_known_options( 'low', 'medium', 'high' ); - -# ??? Need to make this update a class variable so it only ever needs to run once. -sub determine_RAM_size() { - my $result = execute_shell_command("cat /proc/meminfo | grep MemTotal"); - if ($result =~ m/.*MemTotal:\s*(\d+) .*/) { - return $1; - } - return 0; -} - -# Try to implement the given option. -sub implement_option { - my($option) = @_; - - $dbconnectionstring = get_mythtv_connection_string(); - - if (connect_to_db("DBI:mysql:$dbconnectionstring")) { - # MythTV's GUI allows setting this value in multiples of 4700kB. - # We will arbitrarily set the HDRingbufferSize to the value that is closest to - # 3.3% of the total RAM. - my $RAM_size = determine_RAM_size(); - my $ringbuffer_size = int($RAM_size * 0.033 / 4700) * 4700; - change_or_make_setting('HDRingbufferSize', $ringbuffer_size) || exit -1; - - # change any existing mplayer cache setting to one based on available RAM size - # We will arbitrarily set the cache size to 1/16 of available RAM - my $cachesize = int($RAM_size / 16); - execute_shell_command("if [[ `grep -e cache.*=.*\$ /etc/mplayer/mplayer.conf` ]]; then sed -i 's/cache.*=.*/cache=$cachesize/g' /etc/mplayer/mplayer.conf; else echo 'cache=$cachesize' >> /etc/mplayer/mplayer.conf; fi") || exit -1; - - # If there's enough RAM, make mtd run by default. - # ??? unimplemented - } else { - exit -1; - } - disconnect_from_db(); -} - -# Poll the system to see what recommendationlevel the given option has on the system. -sub poll_options { - my($option) = @_; - my $fudge_factor = .985; - my $low_RAM = int($fudge_factor * 512*1024); # ~512MB - my $medium_RAM = int($fudge_factor * 1024*1024); # ~1GB - my $high_RAM = int($fudge_factor * 2048*1024); # ~2GB - - threshold_test($option, determine_RAM_size(), "RAM", $low_RAM, $medium_RAM, $high_RAM); -} - -# Unimplemented in 0.7 -sub check_option { - help; -} - -# Unimplemented in 0.7 -sub count_iterations { - help; -} - -process_parameters; |