Warn on non-high perf power profile on Windows

Patch by jmckenzie; reviewed by pthompson for CASSANDRA-9648
This commit is contained in:
Joshua McKenzie 2015-07-23 11:11:39 -04:00
parent 11ac938878
commit 53b64a406b
1 changed files with 20 additions and 0 deletions

View File

@ -337,6 +337,26 @@ Function SetCassandraEnvironment
# Add sigar env - see Cassandra-7838
$env:JVM_OPTS = "$env:JVM_OPTS -Djava.library.path=$env:CASSANDRA_HOME\lib\sigar-bin"
# Confirm we're on high performance power plan, warn if not
# Change to $true to suppress this warning
$suppressPowerWarning = $false
if (!$suppressPowerWarning)
{
$currentProfile = powercfg /GETACTIVESCHEME
if (!$currentProfile.Contains("High performance"))
{
echo "*---------------------------------------------------------------------*"
echo "*---------------------------------------------------------------------*"
echo ""
echo " WARNING! Detected a power profile other than High Performance."
echo " Performance of this node will suffer."
echo " Modify conf\cassandra.env.ps1 to suppress this warning."
echo ""
echo "*---------------------------------------------------------------------*"
echo "*---------------------------------------------------------------------*"
}
}
# add the jamm javaagent
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))