Skip to content

Commit 106b985

Browse files
committed
Below:
* Added profile support in Undervolt Go and Undervolt Go Pro. Now Save, Load and Apply profiles. * main.go - Separated out the code for applying flags into a separate function. This helps with streamlining code for profiles. * Added VSCode settings.json file to the project. * Updated README
1 parent e44141c commit 106b985

File tree

6 files changed

+652
-281
lines changed

6 files changed

+652
-281
lines changed

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"editor.insertSpaces": true,
3+
"editor.tabSize": 2,
4+
"editor.detectIndentation": false,
5+
"[go]": {
6+
"editor.insertSpaces": true,
7+
"editor.tabSize": 2,
8+
"editor.detectIndentation": false,
9+
"editor.formatOnSave": false
10+
}
11+
}

README.md

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,26 +114,53 @@ To install **Undervolt Go** on your system, follow these steps:
114114
5. All commands can be found in the help menu:
115115

116116
```
117-
Usage:
118-
undervolt-go [flags]
119-
120-
Flags:
121-
--analogio float analogio offset (mV) (default NaN)
122-
--cache float cache offset (mV) (default NaN)
123-
--core float core offset (mV) (default NaN)
124-
--force allow setting positive offsets
125-
--gpu float gpu offset (mV) (default NaN)
126-
-h, --help help for undervolt-go
127-
--lock-power-limit lock the power limit
128-
--p1 strings P1 Power Limit (W) and Time Window (s), e.g., --p1=35,10
129-
--p2 strings P2 Power Limit (W) and Time Window (s), e.g., --p2=45,5
130-
--read read existing values
131-
--temp int set temperature target on AC (°C) (default -1)
132-
--temp-bat int set temperature target on battery (°C) (default -1)
133-
--turbo int set Intel Turbo (1 disabled, 0 enabled) (default -1)
134-
--uncore float uncore offset (mV) (default NaN)
135-
--verbose print debug info
136-
-v, --version version for undervolt-go
117+
sudo undervolt-go --help
118+
119+
Undervolt Go
120+
121+
A no-dependency utility to undervolt Intel CPUs on Linux systems with voltage offsets, perform power limit adjustments, set temperature limits, and more. It also features a user-friendly graphical version which lets you monitor temperatures and fan speeds with the help of 'sensors' package.
122+
123+
Please use with extreme caution. It has the potential to damage your computer if used incorrectly.
124+
125+
Usage:
126+
`undervolt-go [flags]`
127+
`undervolt-go [command]`
128+
129+
Available Commands:
130+
completion Generate the autocompletion script for the specified shell
131+
help Help about any command
132+
profile Manage saved profiles
133+
Usage:
134+
`undervolt-go profile [command]`
135+
136+
Available Sub-commands:
137+
apply Apply given profile
138+
Usage:
139+
`undervolt-go profile apply [auto|ac|battery] [flags]`
140+
list List available profiles
141+
save Save current flags as a profile
142+
Usage:
143+
`undervolt-go profile save [ac|battery] [flags]`
144+
145+
Flags:
146+
--analogio float AnalogIO offset (mV) (default NaN)
147+
--cache float Cache offset (mV) (default NaN)
148+
--core float Core offset (mV) (default NaN)
149+
--force Allow setting positive offsets
150+
--gpu float GPU offset (mV) (default NaN)
151+
-h, --help help for undervolt-go
152+
--lock-power-limit Lock the power limit
153+
--p1 strings P1 Power Limit (W) and Time Window (s), e.g., --p1=35,10
154+
--p2 strings P2 Power Limit (W) and Time Window (s), e.g., --p2=45,5
155+
--read Read existing values
156+
--temp int Set temperature target on AC (°C) (default -1)
157+
--temp-bat int Set temperature target on battery (°C) (default -1)
158+
--turbo int Set Intel Turbo (1 disabled, 0 enabled) (default -1)
159+
--uncore float Uncore offset (mV) (default NaN)
160+
--verbose Print debug information
161+
-v, --version version for undervolt-go
162+
163+
Use "undervolt-go [command] --help" for more information about a command.
137164
```
138165

139166
## Features
@@ -143,6 +170,8 @@ To install **Undervolt Go** on your system, follow these steps:
143170
- **Temperature Target Override:** Set a custom temperature target for CPU throttling, on AC or battery power.
144171
- **Power Limit Configuration:** Adjust the CPU's power limits to control performance and power consumption.
145172
- **Intel Turbo Adjustment:** Enable or disable Intel Turbo for optimal performance.
173+
- **Profile Management:** Save and apply profiles for quick configuration changes.
174+
- **Auto Profile Switching:** Automatically switch to the appropriate profile based on AC or battery power. (Coming soon)
146175
- **Temperature Monitoring:** Monitor and display the current temperature of the CPU.
147176
- **Fan Monitoring:** Monitor and display the current fan speed of the CPU.
148177

@@ -174,7 +203,9 @@ To install **Undervolt Go** on your system, follow these steps:
174203
175204
## Configuration
176205
177-
**Undervolt Go** does not use a configuration file. All settings are applied via command-line arguments. To maintain settings across reboots, you can either consider creating a startup script that runs your preferred `undervolt-go` command, or add the preferred `undervolt-go` command in `.profile` file. You may need to edit the `sudoers` file to allow running `undervolt-go` as sudo without requiring password.
206+
You can save configuration using the `profile save [ac/battery] --flags` command. Saved profiles are automatically applied based on AC or battery power.
207+
208+
To maintain settings across reboots, you can either consider creating a startup script that runs your preferred `undervolt-go` command, or add the preferred `undervolt-go` command in `.profile` file. You may need to edit the `sudoers` file to allow running `undervolt-go` as sudo without requiring password.
178209
179210
To edit `sudoers` file,
180211
1. Type in terminal `sudo visudo`.

go.mod

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ go 1.24.1
44

55
require (
66
fyne.io/fyne/v2 v2.5.5
7-
github.com/klauspost/cpuid/v2 v2.2.10
87
github.com/spf13/cobra v1.9.1
8+
github.com/spf13/viper v1.8.1
99
)
1010

1111
require (
@@ -23,22 +23,32 @@ require (
2323
github.com/go-text/typesetting v0.2.0 // indirect
2424
github.com/godbus/dbus/v5 v5.1.0 // indirect
2525
github.com/gopherjs/gopherjs v1.17.2 // indirect
26+
github.com/hashicorp/hcl v1.0.0 // indirect
2627
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2728
github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 // indirect
2829
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect
30+
github.com/magiconair/properties v1.8.5 // indirect
31+
github.com/mitchellh/mapstructure v1.4.1 // indirect
2932
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
3033
github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect
34+
github.com/pelletier/go-toml v1.9.3 // indirect
3135
github.com/pmezard/go-difflib v1.0.0 // indirect
3236
github.com/rymdport/portal v0.3.0 // indirect
37+
github.com/spf13/afero v1.6.0 // indirect
38+
github.com/spf13/cast v1.3.1 // indirect
39+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
3340
github.com/spf13/pflag v1.0.6 // indirect
3441
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
3542
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
3643
github.com/stretchr/testify v1.8.4 // indirect
44+
github.com/subosito/gotenv v1.2.0 // indirect
3745
github.com/yuin/goldmark v1.7.1 // indirect
3846
golang.org/x/image v0.18.0 // indirect
3947
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
4048
golang.org/x/net v0.25.0 // indirect
4149
golang.org/x/sys v0.30.0 // indirect
4250
golang.org/x/text v0.16.0 // indirect
51+
gopkg.in/ini.v1 v1.62.0 // indirect
52+
gopkg.in/yaml.v2 v2.4.0 // indirect
4353
gopkg.in/yaml.v3 v3.0.1 // indirect
4454
)

go.sum

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
190190
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
191191
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
192192
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
193+
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
193194
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
194195
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
195196
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
@@ -207,16 +208,16 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
207208
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
208209
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e h1:LvL4XsI70QxOGHed6yhQtAU34Kx3Qq2wwBzGFKY8zKk=
209210
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
211+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
210212
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
211213
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
212214
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
213-
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
214-
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
215215
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
216216
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
217217
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
218218
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
219219
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
220+
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
220221
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
221222
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
222223
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
@@ -228,6 +229,7 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
228229
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
229230
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
230231
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
232+
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
231233
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
232234
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
233235
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@@ -241,6 +243,7 @@ github.com/nicksnyder/go-i18n/v2 v2.4.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7g
241243
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
242244
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
243245
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
246+
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
244247
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
245248
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
246249
github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA=
@@ -262,17 +265,23 @@ github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxr
262265
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
263266
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
264267
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
268+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
265269
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
270+
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
266271
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
272+
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
267273
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
274+
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
268275
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
269276
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
270277
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
271278
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
279+
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
272280
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
273281
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
274282
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
275283
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
284+
github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44=
276285
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
277286
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE=
278287
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q=
@@ -288,6 +297,7 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
288297
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
289298
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
290299
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
300+
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
291301
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
292302
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
293303
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -646,6 +656,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
646656
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
647657
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
648658
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
659+
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
649660
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
650661
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
651662
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 commit comments

Comments
 (0)