LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices


Reply
  Search this Thread
Old 12-29-2018, 01:50 PM   #1
sudo1
LQ Newbie
 
Registered: Dec 2018
Posts: 13

Rep: Reputation: Disabled
Cool How do I turn off my CPU Frequency Scaling?


I am hoping to find help in turning off my CPU Frequency Scaling, as it is interfering with my recording studio sessions. I have only been using linux mint for a month, but I do know a couple codes for the terminal. If anyone could help me with the terminal codes to turn off my CPU Frequency Scaling and any help/advice is very welcome.
THANKS EVERYONE, PROBLEM IS SOLVED NOW

Last edited by sudo1; 01-07-2019 at 11:13 PM. Reason: Closing this thread now....
 
Old 12-29-2018, 02:11 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
I do have a two scripts/methiods to scale the CPU keeping it at a temp the user wants. but you seem to want pedel to the metal?

CPU Frequency Scaling, it is used to stop burn out of CPU, it is automatied by ( someone correct me if I am wrong) the CPU, and system board (MB) , and OS control this. If the CPU over heats the CPU is made to scale down so the CPU can cool down so the CPU will not burn up.

So I do not think one can "turn it off" and just run the CPU at full blast until it blows up due to poor cooling. That is why they added scaling to the CPUs.

try turning up your A/C or putting it somewhere cooler, or cleaning out your vents, fans etc.. to help the air flow.

If you use scaling to control your cpu speeds then you should get a steady continuous pace out of it.

what are your temps on your CPU getting to, to cause it to implement scaling?

Last edited by BW-userx; 12-29-2018 at 02:27 PM.
 
Old 01-06-2019, 06:59 AM   #3
sudo1
LQ Newbie
 
Registered: Dec 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank You so much for replying. In my recording studio, the issue is the CPU Frequency Scaling is causing latency, in my recording sessions. I guess what I am asking is how do I adjust the settings? The following is what another user had told me to do, however, I don't believe I understand the code:
"--Kernel_Frequency <frequency>

--xp propisolution.kernel_compiler_margin=<frequency percentage>

--xp param:compiler.enableAutoFrequencyScaling=0"

"sudo modprobe p4_clockmod"
now add line "p4_clockmod" to "/etc/modules" so the cpu clock starts
"sudo cpufreq-selector -f 1000000"
I tried this, but I completely was lost as I'm new to Linux.
Any assistance is greatly appreciated....
 
Old 01-06-2019, 02:24 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
I've got this script here, that I found on the net, that scales the core speeds to keep it at a temp that it was told to.

Code:
#!/bin/bash

# Usage: temp_throttle.sh max_temp
# USE CELSIUS TEMPERATURES.
# version 2.20

cat << EOF
Author: Sepero 2016 (sepero 111 @ gmx . com)
URL: http://github.com/Sepero/temp-throttle/
EOF

# Additional Links
# http://seperohacker.blogspot.com/2012/10/linux-keep-your-cpu-cool-with-frequency.html

# Additional Credits
# Wolfgang Ocker <weo AT weo1 DOT de> - Patch for unspecified cpu frequencies.

# License: GNU GPL 2.0

# Generic  function for printing an error and exiting.
err_exit () {
    echo ""
    echo "Error: $@" 1>&2
    exit 128
}

if [ $# -ne 1 ]; then
    # If temperature wasn't given, then print a message and exit.
    echo "Please supply a maximum desired temperature in Celsius." 1>&2
    echo "For example:  ${0} 60" 1>&2
    exit 2
else
    #Set the first argument as the maximum desired temperature.
    MAX_TEMP=$1
fi


### START Initialize Global variables.

# The frequency will increase when low temperature is reached.
LOW_TEMP=$((MAX_TEMP - 5))

CORES=$(nproc) # Get number of CPU cores.
echo -e "Number of CPU cores detected: $CORES\n"
CORES=$((CORES - 1)) # Subtract 1 from $CORES for easier counting later.

# Temperatures internally are calculated to the thousandth.
MAX_TEMP=${MAX_TEMP}000
LOW_TEMP=${LOW_TEMP}000

FREQ_FILE="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies"
FREQ_MIN="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
FREQ_MAX="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"

# Store available cpu frequencies in a space separated string FREQ_LIST.
if [ -f $FREQ_FILE ]; then
    # If $FREQ_FILE exists, get frequencies from it.
    FREQ_LIST=$(cat $FREQ_FILE) || err_exit "Could not read available cpu frequencies from file $FREQ_FILE"
elif [ -f $FREQ_MIN -a -f $FREQ_MAX ]; then
    # Else if $FREQ_MIN and $FREQ_MAX exist, generate a list of frequencies between them.
    FREQ_LIST=$(seq $(cat $FREQ_MAX) -100000 $(cat $FREQ_MIN)) || err_exit "Could not compute available cpu frequencies"
else
    err_exit "Could not determine available cpu frequencies"
fi

FREQ_LIST_LEN=$(echo $FREQ_LIST | wc -w)

# CURRENT_FREQ will save the index of the currently used frequency in FREQ_LIST.
CURRENT_FREQ=2

# This is a list of possible locations to read the current system temperature.
TEMPERATURE_FILES="
/sys/class/thermal/thermal_zone0/temp
/sys/class/thermal/thermal_zone1/temp
/sys/class/thermal/thermal_zone2/temp
/sys/class/hwmon/hwmon0/temp1_input
/sys/class/hwmon/hwmon1/temp1_input
/sys/class/hwmon/hwmon2/temp1_input
/sys/class/hwmon/hwmon0/device/temp1_input
/sys/class/hwmon/hwmon1/device/temp1_input
/sys/class/hwmon/hwmon2/device/temp1_input
null
"

# Store the first temperature location that exists in the variable TEMP_FILE.
# The location stored in $TEMP_FILE will be used for temperature readings.
for file in $TEMPERATURE_FILES; do
    TEMP_FILE=$file
    [ -f $TEMP_FILE ] && break
done

[ $TEMP_FILE == "null" ] && err_exit "The location for temperature reading was not found."


### END Initialize Global variables.


### START define script functions.

# Set the maximum frequency for all cpu cores.
set_freq () {
    # From the string FREQ_LIST, we choose the item at index CURRENT_FREQ.
    FREQ_TO_SET=$(echo $FREQ_LIST | cut -d " " -f $CURRENT_FREQ)
    echo $FREQ_TO_SET
    for i in $(seq 0 $CORES); do
        # Try to set core frequency by writing to /sys/devices.
        { sudo echo $FREQ_TO_SET 2> /dev/null > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq; } ||
        # Else, try to set core frequency using command cpufreq-set.
        { sudo cpufreq-set -c $i --max $FREQ_TO_SET > /dev/null; } ||
        # Else, return error message.
        { err_exit "Failed to set frequency CPU core$i. Run script as Root user. Some systems may require to install the package cpufrequtils."; }
    done
}

# Will reduce the frequency of cpus if possible.
throttle () {
    if [ $CURRENT_FREQ -lt $FREQ_LIST_LEN ]; then
        CURRENT_FREQ=$((CURRENT_FREQ + 1))
        echo -n "throttle "
        set_freq $CURRENT_FREQ
    fi
}

# Will increase the frequency of cpus if possible.
unthrottle () {
    if [ $CURRENT_FREQ -ne 1 ]; then
        CURRENT_FREQ=$((CURRENT_FREQ - 1))
        echo -n "unthrottle "
        set_freq $CURRENT_FREQ
    fi
}

get_temp () {
    # Get the system temperature.

    TEMP=$(cat $TEMP_FILE)
}

### END define script functions.

echo "Initialize to max CPU frequency"
unthrottle


# Main loop
while true; do
    get_temp # Gets the current temperature and set it to the variable TEMP.
    if   [ $TEMP -gt $MAX_TEMP ]; then # Throttle if too hot.
        throttle
    elif [ $TEMP -le $LOW_TEMP ]; then # Unthrottle if cool.
        unthrottle
    fi
    sleep 3 # The amount of time between checking temperatures.
done
usage
Code:
./scriptName Max_temp
if you look at the code you can see how this is being done, so use it as is, or modify it, the thing to really check is the location of your cpu files that get edited. It is not a standard path naming scheme.
Code:
FREQ_FILE="/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies"
start with that then work your way backwards to see if the path matches, if it already doesn't. You'll see it in the script.
 
1 members found this post helpful.
Old 01-07-2019, 04:18 AM   #5
sudo1
LQ Newbie
 
Registered: Dec 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you so very much! I can't tell you how much I appreciate this! I will work on this today!
 
Old 01-07-2019, 05:04 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,483

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Depending on your hardware this may also be a BIOS function.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to turn off cpu frequency scaling completely for Intel cpus? Lockywolf Slackware 5 12-03-2018 04:37 PM
Set Clock Frequency on a Frequency Scaling Disabled Kernel mobin.seven Linux - Kernel 3 02-18-2017 10:33 PM
cpu frequency scaling with Pentium(R) Dual-Core CPU E5200 @ 2.50GHz tramni1980 Slackware 5 08-16-2009 08:29 AM
cpu frequency scaling....anyone? alaios Linux - General 3 06-07-2005 10:51 AM
CPU frequency scaling on Pentium M Khang Linux - Laptop and Netbook 2 03-23-2005 06:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint

All times are GMT -5. The time now is 06:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration