summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Feldman <vizvayu@gmail.com>2012-04-10 22:12:30 -0300
committerCristian Feldman <vizvayu@gmail.com>2012-04-10 22:12:30 -0300
commit53c210dd6451f1bb82347e37c89652f7818122aa (patch)
treec18f488e587f6aed14cb65ac30cf0f9614be99ce
parent2fe06a3228848a9714a0488a4468d895f20b7a63 (diff)
downloadpfsense-53c210dd6451f1bb82347e37c89652f7818122aa.zip
pfsense-53c210dd6451f1bb82347e37c89652f7818122aa.tar.gz
Added mode selection options for PowerD.
-rw-r--r--conf.default/config.xml1
-rw-r--r--etc/inc/system.inc10
-rw-r--r--usr/local/www/system_advanced_misc.php30
3 files changed, 31 insertions, 10 deletions
diff --git a/conf.default/config.xml b/conf.default/config.xml
index b5cdb7d..714e0f6 100644
--- a/conf.default/config.xml
+++ b/conf.default/config.xml
@@ -188,6 +188,7 @@
<disablesegmentationoffloading/>
<disablelargereceiveoffloading/>
<ipv6allow/>
+ <powerd_mode>hadp</powerd_mode>
</system>
<interfaces>
<wan>
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index e9f7781..145df52 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -42,13 +42,15 @@ function activate_powerd() {
global $config, $g;
if ($g['platform'] == 'jail')
return;
+ if(is_process_running("powerd"))
+ exec("/usr/bin/killall powerd");
if(isset($config['system']['powerd_enable'])) {
if ($g["platform"] == "nanobsd")
exec("/sbin/kldload cpufreq");
- exec("/usr/sbin/powerd -b adp -a adp");
- } else {
- if(is_process_running("powerd"))
- exec("/usr/bin/killall powerd");
+ $mode = "hadp";
+ if (!empty($config['system']['powerd_mode']))
+ $mode = $config['system']['powerd_mode'];
+ mwexec("/usr/sbin/powerd -b $mode -a $mode");
}
}
diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php
index 2e08eb7..45c956a 100644
--- a/usr/local/www/system_advanced_misc.php
+++ b/usr/local/www/system_advanced_misc.php
@@ -68,6 +68,11 @@ $pconfig['glxsb_enable'] = isset($config['system']['glxsb_enable']);
$pconfig['schedule_states'] = isset($config['system']['schedule_states']);
$pconfig['kill_states'] = isset($config['system']['kill_states']);
+if (!empty($config['system']['powerd_mode']))
+ $pconfig['powerd_mode'] = $config['system']['powerd_mode'];
+else
+ $pconfig['powerd_mode'] = "hadp";
+
if ($_POST) {
unset($input_errors);
@@ -154,6 +159,8 @@ if ($_POST) {
else
unset($config['system']['powerd_enable']);
+ $config['system']['powerd_mode'] = $_POST['powerd_mode'];
+
if($_POST['glxsb_enable'] == "yes")
$config['system']['glxsb_enable'] = true;
else
@@ -323,17 +330,28 @@ function maxmss_checked(obj) {
<td width="78%" class="vtable">
<input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?php if ($pconfig['powerd_enable']) echo "checked"; ?> />
<strong><?=gettext("Use PowerD"); ?></strong><br/>
- <br />
+ <br/>
+ <?=gettext("Mode"); ?>&nbsp;:&nbsp;
+ <select name="powerd_mode" id="powerd_mode">
+ <option value="hadp"<?php if($pconfig['powerd_mode']=="hadp") echo " selected"; ?>><?=gettext("Hiadaptive");?></option>
+ <option value="adp"<?php if($pconfig['powerd_mode']=="adp") echo " selected"; ?>><?=gettext("Adaptive");?></option>
+ <option value="min"<?php if($pconfig['powerd_mode']=="min") echo " selected"; ?>><?=gettext("Minimum");?></option>
+ <option value="max"<?php if($pconfig['powerd_mode']=="max") echo " selected"; ?>><?=gettext("Maximum");?></option>
+ </select>
+ <br/><br/>
<?=gettext("The powerd utility monitors the system state and sets various power control " .
- "options accordingly. It offers three modes (maximum, minimum, and " .
- "adaptive) that can be individually selected while on AC power or batteries. " .
- "The modes maximum, minimum, and adaptive may be abbreviated max, " .
- "min, adp. Maximum mode chooses the highest performance values. Minimum " .
+ "options accordingly. It offers four modes (maximum, minimum, adaptive " .
+ "and hiadaptive) that can be individually selected while on AC power or batteries. " .
+ "The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, " .
+ "min, adp, hadp. Maximum mode chooses the highest performance values. Minimum " .
"mode selects the lowest performance values to get the most power savings. " .
"Adaptive mode attempts to strike a balance by degrading performance when " .
"the system appears idle and increasing it when the system is busy. It " .
"offers a good balance between a small performance loss for greatly " .
- "increased power savings. The default mode for {$g['product_name']} is adaptive."); ?>
+ "increased power savings. Hiadaptive mode is alike adaptive mode, but " .
+ "tuned for systems where performance and interactivity are more important" .
+ "than power consumption. It rises frequency faster, drops slower and" .
+ "keeps twice lower CPU load."); ?>
</td>
</tr>
<tr>
OpenPOWER on IntegriCloud