├── .idea ├── artifacts │ └── DownvoltLinuxUi_jar.xml ├── compiler.xml ├── description.html ├── encodings.xml ├── libraries │ └── MigLayout.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── DownvoltLinuxUi.iml ├── LICENSE ├── README.md ├── build └── DownvoltLinuxUi_jar_V0.1.zip ├── downvoltlinuxui.properties ├── downvoltlinuxui.xml ├── lib ├── miglayout-core-javadoc.jar ├── miglayout-core-sources.jar ├── miglayout-core.jar ├── miglayout-swing-javadoc.jar ├── miglayout-swing-sources.jar └── miglayout-swing.jar └── src ├── BusyThread.java ├── Config.java ├── CpuInfo.java ├── CpuUi.form ├── CpuUi.java ├── Faq.form ├── Faq.java ├── Interface.form ├── Interface.java ├── META-INF ├── CpuUi.form └── MANIFEST.MF ├── Main.java ├── Profile.java ├── Stresstest.java ├── UndervoltValue.java └── UpdateCpuStatus.java /.idea/artifacts/DownvoltLinuxUi_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/DownvoltLinuxUi_jar 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/description.html: -------------------------------------------------------------------------------- 1 | Simple Java application that includes a class with main() method -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/MigLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DownvoltLinuxUi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaLinuxUndervolt 2 | 3 | Before starting: 4 | >This was made for my personal usage.
5 | >It's only tested on my pc and on my os ( see specs below )
6 | >PLEASE, be carefull!
7 | 8 | ## What is it? 9 | 10 | This is a small gui created in Java for the undervolt.py scritpt written by georgewhewell [here](https://github.com/georgewhewell/undervolt) 11 | 12 | ## What can i do? 13 | 14 | You can set each value core, gpu, cache, uncore, analogio (temperature target on my pc does not work so I haven't implemented it). 15 | You can also save your profile. 16 | 17 | ## How to use 18 | 19 | If you are on a debian base system: 20 | 21 | ``` 22 | 1) Download the last build from [HERE](https://github.com/zmalrobot/JavaLinuxUndervolt/tree/master/build) 23 | 2) Unzip the file 24 | 3) If it is your first time using it launch install.sh ( see below for more info... or open it! ) 25 | 3) Wait until it finishes 26 | 4) To open the gui launch run.sh ( or just type sudo java -jar DownvoltLinuxUi.jar <-- sudo is required for the script ) 27 | 5) Have fun ;-) 28 | 29 | ``` 30 | 31 | Else 32 | 33 | ``` 34 | 1) Download the last build from [HERE](https://github.com/zmalrobot/JavaLinuxUndervolt/tree/master/build) 35 | 2) Install python3 36 | 3) Install java (It has been compiled to work on Java 11) 37 | 4) Download all the file from here: https://github.com/georgewhewell/undervolt 38 | 5) Inside the "resource" folder create a folder named "externaltools" (see the config for more info) 39 | 6) Put the downloaded file in the new folder you just created in the step above, do not rename it 40 | 7) Check if all the scripts are compatible with your system, if not change it 41 | 8) Run with sudo privileges 42 | 43 | Mabye 44 | 45 | 9) If it doesn't work change the command in the code and rebuild it... sorry I'll try to resolve this as soon as possible 46 | 47 | ``` 48 | 49 | ## How it works 50 | 51 | 1) When you click apply it runs the script inside "externaltools" folder with your params 52 | 2) Then it will create a 10 second full load on all your cpu core to test the settings of your choice 53 | 3) See FAQ inside the gui for more info! 54 | 55 | 56 | ## Future release 57 | 58 | I'm currently workin on: 59 | 60 | - Real time cpu frequency monitor 61 | - Real time cpu load monitor 62 | - Real time temperature monitor 63 | - Cpu info 64 | - Stress test / benchmark 65 | 66 | 67 | Tested on: 68 | 69 | ``` 70 | Asus fx504GE 71 | cpu: i7 8750h 72 | gpu: UHD Graphics 630 + gtx1050Ti 73 | ram: 16Gb ddr4 74 | Os: Ubuntu 19.04 + Ubuntu 18.04 75 | 76 | ``` 77 | 78 | ## Some screenshot 79 | 80 | ![Screen1](https://i.imgur.com/hKZ5hEh.png) 81 | ![Screen2](https://i.imgur.com/T0sKItC.png) 82 | ![Screen3](https://i.imgur.com/8CApzQg.png) 83 | 84 | ## Other info 85 | 86 | install.sh 87 | 88 | ``` 89 | IT WILL ONLY WORK ON UBUNTU ( or mabye some debian distro ) 90 | 91 | it will install: 92 | 93 | 1) openjdk 94 | 2) python3 95 | 96 | Then it will download the script from here: https://github.com/georgewhewell/undervolt 97 | 98 | Ah and also check if you are running an intel base system or not ;-) 99 | 100 | ``` 101 | 102 | ## Thanks to 103 | 104 | [georgewhewell](https://github.com/georgewhewell/undervolt) 105 |
106 | [Caffinc](https://caffinc.github.io/2016/03/cpu-load-generator/) 107 | 108 | 109 | -------------------------------------------------------------------------------- /build/DownvoltLinuxUi_jar_V0.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/build/DownvoltLinuxUi_jar_V0.1.zip -------------------------------------------------------------------------------- /downvoltlinuxui.properties: -------------------------------------------------------------------------------- 1 | path.variable.kotlin_bundled=/home/simone/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.6183.87/plugins/Kotlin/kotlinc 2 | path.variable.maven_repository=/home/simone/.m2/repository 3 | jdk.home.11=/usr/lib/jvm/java-11-openjdk-amd64 4 | javac2.instrumentation.includeJavaRuntime=false -------------------------------------------------------------------------------- /downvoltlinuxui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /lib/miglayout-core-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-core-javadoc.jar -------------------------------------------------------------------------------- /lib/miglayout-core-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-core-sources.jar -------------------------------------------------------------------------------- /lib/miglayout-core.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-core.jar -------------------------------------------------------------------------------- /lib/miglayout-swing-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-swing-javadoc.jar -------------------------------------------------------------------------------- /lib/miglayout-swing-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-swing-sources.jar -------------------------------------------------------------------------------- /lib/miglayout-swing.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zmalrobot/JavaLinuxUndervolt/8a9cd931158c7f34f6e473ef17966439bc387edd/lib/miglayout-swing.jar -------------------------------------------------------------------------------- /src/BusyThread.java: -------------------------------------------------------------------------------- 1 | public class BusyThread extends Thread{ 2 | private double load; 3 | private long duration; 4 | 5 | /** 6 | * Constructor which creates the thread 7 | * @param name Name of this thread 8 | * @param load Load % that this thread should generate 9 | * @param duration Duration that this thread should generate the load for 10 | */ 11 | public BusyThread(String name, double load, long duration) { 12 | super(name); 13 | this.load = load; 14 | this.duration = duration; 15 | } 16 | 17 | /** 18 | * Generates the load when run 19 | */ 20 | @Override 21 | public void run() { 22 | long startTime = System.currentTimeMillis(); 23 | try { 24 | // Loop for the given duration 25 | while (System.currentTimeMillis() - startTime < duration) { 26 | // Every 100ms, sleep for the percentage of unladen time 27 | if (System.currentTimeMillis() % 100 == 0) { 28 | Thread.sleep((long) Math.floor((1 - load) * 100)); 29 | } 30 | } 31 | } catch (InterruptedException e) { 32 | e.printStackTrace(); 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/Config.java: -------------------------------------------------------------------------------- 1 | import java.io.BufferedReader; 2 | import java.io.FileReader; 3 | import java.io.IOException; 4 | 5 | public class Config { 6 | 7 | //Read the config file 8 | 9 | private String undervolt_path; 10 | private String save_path; 11 | private String image_path; 12 | private String script_path; 13 | 14 | public Config(){ 15 | readConfigFile(); 16 | } 17 | 18 | private void readConfigFile(){ 19 | BufferedReader reader; 20 | try { 21 | reader = new BufferedReader(new FileReader("resource/config.txt")); 22 | String line = reader.readLine(); 23 | while (line != null) { 24 | // System.out.println(line); 25 | 26 | if(line.contains("undervolt_path")){ 27 | String value = getValue(line); 28 | undervolt_path = value; 29 | } 30 | 31 | if(line.contains("save_path")){ 32 | String value = getValue(line); 33 | save_path = value; 34 | } 35 | 36 | if(line.contains("image_path")){ 37 | String value = getValue(line); 38 | image_path = value; 39 | } 40 | 41 | if(line.contains("script_path")){ 42 | String value = getValue(line); 43 | script_path = value; 44 | } 45 | 46 | line = reader.readLine(); 47 | } 48 | reader.close(); 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | private String getValue(String line) { 55 | line = line.replace(" ",""); 56 | String path[] = line.split("="); 57 | 58 | return path[1]; 59 | } 60 | 61 | public String getUndervolt_path() { 62 | //System.out.println("Undervolt path: " + undervolt_path); 63 | return undervolt_path; 64 | } 65 | 66 | public String getSave_path() { 67 | //System.out.println("Save path: " + save_path); 68 | return save_path; 69 | } 70 | 71 | public String getImage_path() { 72 | // System.out.println("Image path: " + image_path); 73 | return image_path; 74 | } 75 | 76 | public String getScript_path() { 77 | //System.out.println("String path: " + script_path); 78 | return script_path; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/CpuInfo.java: -------------------------------------------------------------------------------- 1 | import java.io.BufferedReader; 2 | import java.io.IOException; 3 | import java.io.InputStreamReader; 4 | import java.util.ArrayList; 5 | 6 | public class CpuInfo { 7 | 8 | private Config configs = new Config(); 9 | private String path; 10 | //Info 11 | private ArrayList cpuInfo; 12 | 13 | //Freq 14 | private String maxFreq; 15 | private String minFreq; 16 | private String actFreq; 17 | 18 | //Temp 19 | private ArrayList tempArray; 20 | 21 | //Load 22 | private String load; 23 | 24 | public String getMaxFreq() { 25 | return maxFreq; 26 | } 27 | 28 | public String getMinFreq() { 29 | return minFreq; 30 | } 31 | 32 | public String getActFreq() { 33 | return actFreq; 34 | } 35 | 36 | public ArrayList getTemp() { 37 | return tempArray; 38 | } 39 | 40 | public String getload() { 41 | return load; 42 | } 43 | 44 | public CpuInfo(){ 45 | //Read only once 46 | path = configs.getScript_path(); 47 | cpuInfo = readCpuInfo(path); 48 | 49 | updateValue(); 50 | } 51 | 52 | public ArrayList getProcessorInfo(){ 53 | return cpuInfo; 54 | } 55 | 56 | public void updateValue(){ 57 | readCpufreq(path); 58 | readCputemp(path); 59 | readCpuload(path); 60 | } 61 | 62 | 63 | //Cpu info 64 | private ArrayList readCpuInfo(String path) { 65 | ArrayList helper = new ArrayList<>(); 66 | 67 | try { 68 | // Create process 69 | Process p = Runtime.getRuntime().exec(path+"getCpuInfo.sh"); 70 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 71 | 72 | //Read process return 73 | String ret = in.readLine(); 74 | 75 | while (ret != null){ 76 | 77 | //Console log 78 | //System.out.println("Script say : "+ret); 79 | //Create for return 80 | helper.add(ret); 81 | 82 | //Read all line 83 | ret = in.readLine(); 84 | } 85 | 86 | 87 | } catch (IOException e) { 88 | //No script 89 | e.printStackTrace(); 90 | } 91 | 92 | return helper; 93 | } 94 | 95 | 96 | //Cpu frequency 97 | private void readCpufreq(String path){ 98 | 99 | try { 100 | // Create process 101 | Process p = Runtime.getRuntime().exec(path+"actualCpuFreq.sh"); 102 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 103 | 104 | //Read process 105 | actFreq = in.readLine(); 106 | maxFreq = in.readLine(); 107 | minFreq = in.readLine(); 108 | 109 | 110 | } catch (IOException e) { 111 | //No script 112 | e.printStackTrace(); 113 | } 114 | } 115 | 116 | private String convertTemp(String temp, String label){ 117 | 118 | //Set real value 119 | if(Double.parseDouble(temp) != 0){ 120 | Double tempVal = Double.parseDouble(temp)/1000.00; 121 | temp = label+" " + tempVal.toString() + " °C"; 122 | }else{ 123 | temp = label+" " + temp + " C"; 124 | } 125 | 126 | return temp; 127 | } 128 | 129 | //Cpu temperature 130 | private void readCputemp(String path){ 131 | 132 | try { 133 | // Create process 134 | Process p = Runtime.getRuntime().exec(path+"actualCpuTemp.sh"); 135 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 136 | 137 | //Read process 138 | tempArray = new ArrayList(); 139 | int count = 0; 140 | 141 | String ret = in.readLine(); 142 | while (ret != null){ 143 | 144 | //Console log 145 | // System.out.println("Script say : "+ret); 146 | //Create for return 147 | tempArray.add(convertTemp(ret, "T"+count)); 148 | 149 | //Read all line 150 | count++; 151 | ret = in.readLine(); 152 | } 153 | 154 | } catch (IOException e) { 155 | //No script 156 | e.printStackTrace(); 157 | } 158 | } 159 | 160 | //Cpu load 161 | private void readCpuload(String path){ 162 | 163 | try { 164 | // Create process 165 | Process p = Runtime.getRuntime().exec(path+"actualCpuLoad.sh"); 166 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 167 | 168 | //Read process 169 | load = in.readLine(); 170 | 171 | 172 | } catch (IOException e) { 173 | //No script 174 | e.printStackTrace(); 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /src/CpuUi.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /src/CpuUi.java: -------------------------------------------------------------------------------- 1 | import javax.imageio.ImageIO; 2 | import javax.swing.*; 3 | import java.awt.*; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.util.ArrayList; 9 | import java.util.concurrent.ExecutionException; 10 | 11 | public class CpuUi { 12 | 13 | private Config configs = new Config(); 14 | private CpuInfo processorInfo = new CpuInfo(); 15 | 16 | private JFrame frame; 17 | private JPanel jframe; 18 | private JTextPane txtCpuInfo; 19 | private JTextPane txtCpuStatus; 20 | private JProgressBar cpuLoadBar; 21 | private JButton btnStress; 22 | 23 | public CpuUi(){ 24 | 25 | //Processor info 26 | ArrayList processor = processorInfo.getProcessorInfo(); 27 | 28 | txtCpuInfo.setText(processorInfoTable(processor)); 29 | 30 | btnStress.addActionListener(new ActionListener() { 31 | @Override 32 | public void actionPerformed(ActionEvent actionEvent) { 33 | Stresstest stress = new Stresstest(); 34 | stress.startStress(); 35 | } 36 | }); 37 | 38 | backgrloundLoop(); 39 | } 40 | 41 | private void backgrloundLoop() { 42 | UpdateCpuStatus loop = new UpdateCpuStatus(txtCpuStatus, cpuLoadBar); 43 | loop.execute(); 44 | } 45 | 46 | public String processorInfoTable(ArrayList processor){ 47 | String ret =""; 48 | ret = ret + "

Cpu info:

"; 49 | ret = ret + 50 | ""+ 51 | ""+ 52 | ""+ 53 | ""+ 54 | ""+ 55 | ""+ 56 | ""+ 57 | ""+ 58 | ""+ 59 | ""+ 60 | ""+ 61 | ""+ 62 | ""+ 63 | ""+ 64 | ""+ 65 | ""+ 66 | ""+ 67 | ""+ 68 | ""+ 69 | ""+ 70 | ""+ 71 | ""+ 72 | ""+ 73 | ""+ 74 | ""+ 75 | ""+ 76 | ""+ 77 | ""+ 78 | ""+ 79 | ""+ 80 | ""+ 81 | ""+ 82 | ""+ 83 | ""+ 84 | ""+ 85 | ""+ 86 | ""+ 87 | ""+ 88 | ""+ 89 | ""+ 90 | ""+ 91 | "
"+ processor.get(0)+""+ processor.get(1) +""+ processor.get(2) +"
"+ processor.get(3)+""+ processor.get(4) +""+ processor.get(5) +"
"+ processor.get(6)+""+ processor.get(7) +""+ processor.get(8) +"
"+ processor.get(9)+""+ processor.get(10) +""+ processor.get(11) +"
"+ processor.get(12)+""+ processor.get(13) +""+ processor.get(14) +"
"+ processor.get(15)+""+ processor.get(16) +""+ processor.get(17) +"
"+ processor.get(18)+""+ processor.get(19) +""+ processor.get(20) +"
"+ processor.get(21)+""+ processor.get(22) +""+ processor.get(23) +"
"; 92 | ret = ret + "

"+processor.get(25)+"

"; 93 | ret = ret + ""; 94 | return ret; 95 | } 96 | 97 | //ONLY FOR FIRST INSTANCE 98 | public void createUi(){ 99 | 100 | UIManager.getDefaults().put("Button.disabledText", Color.decode("#EAB23B")); 101 | frame = new JFrame("CpuInfo"); 102 | frame.setContentPane(new CpuUi().jframe); 103 | frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 104 | try { 105 | frame.setIconImage(ImageIO.read(new File(configs.getImage_path()+"icocpu.png"))); 106 | } catch (IOException e) { 107 | System.out.println("No icon found"); 108 | } 109 | frame.pack(); 110 | frame.setLocationRelativeTo(null); 111 | frame.setVisible(true); 112 | } 113 | //END INSTANZE 114 | } 115 | 116 | -------------------------------------------------------------------------------- /src/Faq.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | -------------------------------------------------------------------------------- /src/Faq.java: -------------------------------------------------------------------------------- 1 | import javax.imageio.ImageIO; 2 | import javax.swing.*; 3 | import java.awt.*; 4 | import java.io.File; 5 | import java.io.IOException; 6 | 7 | public class Faq { 8 | 9 | private Config configs = new Config(); 10 | 11 | private JPanel FaqMainPanel; 12 | private JTextPane faq; 13 | private JFrame frame; 14 | 15 | public Faq(){ 16 | faq.setText(""+ 17 | "

Faq:

" + 18 | "
    " + 19 | "
  1. Why does the cpu go to maximum when I apply the settings?
    " + 20 | "
      " + 21 | "
    1. Because a 10 second test is performed  to ensure the stability of the system
    2. " + 22 | "
    " + 23 | "
  2. " + 24 | "
  3. Why my cpu is not supported?
    " + 25 | "
      " + 26 | "
    1. Depends on the architecture and implementation of the manufacturer, for more information visit the developer page diundervolt.py (see below )
    2. " + 27 | "
    " + 28 | "
  4. " + 29 | "
  5. I have and AMD processor why does not work?
    " + 30 | "
      " + 31 | "
    1. Because the script that i'm using is for INTEL cpu only ( Script faq)
    2. " + 32 | "
    " + 33 | "
  6. " + 34 | "
" + 35 | "

Error code:

" + 36 | "
    " + 37 | "
  •  Code: 1.0 --> Class: Undervolt.java --> Method: runScript" + 38 | "
      " + 39 | "
    • Solution: Application start with no sudo permission or something is wrong with undervolt.py file
    • " + 40 | "
    " + 41 | "
  • " + 42 | "
  • Code: 2.0 --> Class: Undervolt.java --> Method: setValue" + 43 | "
      " + 44 | "
    • Solution: Error during setting voltage, pc not compatible or something is wrong with undervolt.py file
    • " + 45 | "
    " + 46 | "
  • " + 47 | "
" + 48 | "

Bug:

" + 49 | "" + 50 | "
  • Override save will create a double extension (like Profile1.txt.txt)
  • " + 51 | "
  • I'm sure i've miss some... if you find one.. or two... or more just tell me ;-)
  • " + 52 | "" + 53 | "

    Thanks to:

    " + 54 | "" + 55 | "
  • Georgewhewell and all his contributors for undervolt.py
  • " + 56 | "
  • https://github.com/georgewhewell/undervolt
  • " + 57 | "
  • Caffinc for the cpu stress class
  • " + 58 | "
  • https://caffinc.github.io/2016/03/cpu-load-generator
  • " + 59 | "" + 60 | "" 61 | ); 62 | 63 | } 64 | 65 | //ONLY FOR FIRST INSTANCE 66 | public void createUi(){ 67 | UIManager.getDefaults().put("Button.disabledText", Color.decode("#EAB23B")); 68 | frame = new JFrame("Faq and error code"); 69 | frame.setContentPane(new Faq().FaqMainPanel); 70 | frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 71 | try { 72 | frame.setIconImage(ImageIO.read(new File(configs.getImage_path()+"icofaq.png"))); 73 | } catch (IOException e) { 74 | System.out.println("No icon found"); 75 | } 76 | frame.pack(); 77 | frame.setLocationRelativeTo(null); 78 | frame.setVisible(true); 79 | } 80 | //END INSTANZE 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/Interface.form: -------------------------------------------------------------------------------- 1 | 2 |
    3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /src/Interface.java: -------------------------------------------------------------------------------- 1 | import javax.imageio.ImageIO; 2 | import javax.swing.*; 3 | import javax.swing.event.ChangeEvent; 4 | import javax.swing.event.ChangeListener; 5 | import java.awt.*; 6 | import java.awt.event.ActionEvent; 7 | import java.awt.event.ActionListener; 8 | import java.io.Console; 9 | import java.io.File; 10 | import java.io.FileWriter; 11 | import java.io.IOException; 12 | import java.net.URL; 13 | import java.util.Date; 14 | import java.util.HashMap; 15 | 16 | public class Interface { 17 | private JFrame frame; 18 | private JPanel MainPanel; 19 | private JSlider analogioSlider; 20 | private JSlider uncoreSlider; 21 | private JSlider cacheSlider; 22 | private JSlider gpuSlider; 23 | private JSlider coreSlider; 24 | private JButton applybutton; 25 | private JLabel valueCore; 26 | private JLabel valueGpu; 27 | private JLabel valueCache; 28 | private JLabel valueUncore; 29 | private JLabel valueAnalogio; 30 | private JButton faqbutton; 31 | private JButton resetbutton; 32 | private JButton buttonLoad; 33 | private JButton buttonSave; 34 | 35 | private int coreSliderValue; 36 | private int gpuSliderValue; 37 | private int cacheSliderValue; 38 | private int uncoreSliderValue; 39 | private int analogioSliderValue; 40 | 41 | private Config configs = new Config(); 42 | private Profile profile = new Profile(frame); 43 | private UndervoltValue value = new UndervoltValue(); 44 | private Stresstest stresstest = new Stresstest(); 45 | 46 | 47 | 48 | // Set the listener and the actual params 49 | public Interface(){ 50 | 51 | //LISTENER 52 | 53 | //Cpu voltage 54 | coreSlider.addChangeListener(new ChangeListener() { 55 | @Override 56 | public void stateChanged(ChangeEvent changeEvent) { 57 | //Set the value from the slider 58 | coreSliderValue = coreSlider.getValue(); 59 | 60 | //Set te label for the slider 61 | setLabel(coreSliderValue, valueCore); 62 | 63 | } 64 | }); 65 | 66 | //Gpu voltage 67 | gpuSlider.addChangeListener(new ChangeListener() { 68 | @Override 69 | public void stateChanged(ChangeEvent changeEvent) { 70 | //Set the value from the slider 71 | gpuSliderValue = gpuSlider.getValue(); 72 | 73 | //Set te label for the slider 74 | setLabel(gpuSliderValue, valueGpu); 75 | } 76 | }); 77 | 78 | //Cache voltage 79 | cacheSlider.addChangeListener(new ChangeListener() { 80 | @Override 81 | public void stateChanged(ChangeEvent changeEvent) { 82 | //Set the value from the slider 83 | cacheSliderValue = cacheSlider.getValue(); 84 | 85 | //Set te label for the slider 86 | setLabel(cacheSliderValue, valueCache); 87 | } 88 | }); 89 | 90 | //Cache uncore 91 | uncoreSlider.addChangeListener(new ChangeListener() { 92 | @Override 93 | public void stateChanged(ChangeEvent changeEvent) { 94 | //Set the value from the slider 95 | uncoreSliderValue = uncoreSlider.getValue(); 96 | 97 | //Set te label for the slider 98 | setLabel(uncoreSliderValue, valueUncore); 99 | } 100 | }); 101 | 102 | //Cache analogio 103 | analogioSlider.addChangeListener(new ChangeListener() { 104 | @Override 105 | public void stateChanged(ChangeEvent changeEvent) { 106 | //Set the value from the slider 107 | analogioSliderValue = analogioSlider.getValue(); 108 | 109 | //Set te label for the slider 110 | setLabel(analogioSliderValue, valueAnalogio); 111 | } 112 | }); 113 | 114 | //Button listener 115 | applybutton.addActionListener(new ActionListener() { 116 | @Override 117 | public void actionPerformed(ActionEvent actionEvent) { 118 | set(); 119 | } 120 | }); 121 | 122 | resetbutton.addActionListener(new ActionListener() { 123 | @Override 124 | public void actionPerformed(ActionEvent actionEvent) { 125 | reset(); 126 | } 127 | }); 128 | 129 | faqbutton.addActionListener(new ActionListener() { 130 | @Override 131 | public void actionPerformed(ActionEvent actionEvent) { 132 | Faq faq = new Faq(); 133 | faq.createUi(); 134 | } 135 | }); 136 | 137 | buttonLoad.addActionListener(new ActionListener() { 138 | @Override 139 | public void actionPerformed(ActionEvent actionEvent) { 140 | read(); 141 | } 142 | }); 143 | 144 | buttonSave.addActionListener(new ActionListener() { 145 | @Override 146 | public void actionPerformed(ActionEvent actionEvent) { 147 | save(); 148 | } 149 | }); 150 | 151 | //Set actual value when application start 152 | setUiValue(); 153 | 154 | //END LISTENER 155 | } 156 | 157 | // Ask to read the profile 158 | private void read() { 159 | HashMap prof = profile.read(); 160 | if(!prof.containsKey("errors")){ 161 | setSliderValue(prof); 162 | } 163 | } 164 | 165 | // Save the profile 166 | private void save() { 167 | profile.save(coreSliderValue, gpuSliderValue, cacheSliderValue, uncoreSliderValue, analogioSliderValue); 168 | } 169 | 170 | 171 | //Set actual slider value as undervolt 172 | private void set() { 173 | //First i disable the ui 174 | applybutton.setText("Applying change, please wait..."); 175 | setEnableUi(false); 176 | 177 | //Set value 178 | boolean correct = value.setValue(coreSliderValue, gpuSliderValue, cacheSliderValue, uncoreSliderValue, analogioSliderValue); 179 | 180 | if(correct){ 181 | //Refresh ui value 182 | setUiValue(); 183 | 184 | try { 185 | //Stress to see if it stable 186 | stresstest.setStressMaxCore(10000); 187 | stresstest.startStress(); 188 | 189 | //Wait for the stress test ending 190 | Thread.sleep(11000); 191 | 192 | } catch (InterruptedException e) { 193 | System.out.println("Stress test skipped"); 194 | } 195 | 196 | //Re enable all ui 197 | applybutton.setText("Applied!"); 198 | setEnableUi(true); 199 | 200 | }else{ 201 | generateError(2); 202 | } 203 | } 204 | 205 | // Set 0 to all value 206 | private void reset() { 207 | //First i disable the ui 208 | applybutton.setText("Applying change, please wait..."); 209 | setEnableUi(false); 210 | 211 | //Set value 212 | boolean correct = value.setValue(0, 0, 0, 0, 0); 213 | 214 | if(correct){ 215 | //Refresh ui value 216 | setUiValue(); 217 | 218 | //Re enable all ui 219 | applybutton.setText("Restored!"); 220 | setEnableUi(true); 221 | }else{ 222 | generateError(2); 223 | } 224 | } 225 | 226 | //ONLY FOR FIRST INSTANCE 227 | public void createUi(){ 228 | 229 | UIManager.getDefaults().put("Button.disabledText",Color.decode("#EAB23B")); 230 | frame = new JFrame("Undervolt"); 231 | frame.setContentPane(new Interface().MainPanel); 232 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 233 | try { 234 | frame.setIconImage(ImageIO.read(new File(configs.getImage_path()+"icoover.png"))); 235 | } catch (IOException e) { 236 | System.out.println("No icon found"); 237 | } 238 | frame.pack(); 239 | frame.setLocationRelativeTo(null); 240 | frame.setVisible(true); 241 | } 242 | //END INSTANZE 243 | 244 | //Enable and disable de ui minus faq button 245 | private void setEnableUi(boolean enable){ 246 | coreSlider.setEnabled(enable); 247 | gpuSlider.setEnabled(enable); 248 | cacheSlider.setEnabled(enable); 249 | uncoreSlider.setEnabled(enable); 250 | analogioSlider.setEnabled(enable); 251 | applybutton.setEnabled(enable); 252 | resetbutton.setEnabled(enable); 253 | } 254 | 255 | 256 | //Called after set value 257 | private void setUiValue() { 258 | //Get the data from undervolt.py 259 | HashMap valueHashmap = value.getValue(); 260 | 261 | setSliderValue(valueHashmap); 262 | } 263 | 264 | //Set the value from the hashmap to the ui 265 | private void setSliderValue( HashMap valueHashmap){ 266 | 267 | if(valueHashmap.containsKey("errors")){ 268 | //If there is something wrong with the readings 269 | generateError(valueHashmap.get("errors").intValue()); 270 | }else{ 271 | //Set actual core value 272 | coreSlider.setValue(valueHashmap.get("core").intValue()); 273 | setLabel(valueHashmap.get("core").intValue(), valueCore); 274 | 275 | //Set actual gpu value 276 | gpuSlider.setValue(valueHashmap.get("gpu").intValue()); 277 | setLabel(valueHashmap.get("gpu").intValue(), valueGpu); 278 | 279 | //Set actual cache value 280 | cacheSlider.setValue(valueHashmap.get("cache").intValue()); 281 | setLabel(valueHashmap.get("cache").intValue(), valueCache); 282 | 283 | //Set actual uncore value 284 | uncoreSlider.setValue(valueHashmap.get("uncore").intValue()); 285 | setLabel(valueHashmap.get("uncore").intValue(), valueUncore); 286 | 287 | //Set actual analogio value 288 | analogioSlider.setValue(valueHashmap.get("analogio").intValue()); 289 | setLabel(valueHashmap.get("analogio").intValue(), valueAnalogio); 290 | } 291 | 292 | } 293 | 294 | //Create the label from the value 295 | private void setLabel(int value, JLabel label){ 296 | 297 | String labeltext = Integer.toString(value) + " mV"; 298 | 299 | if(value>0){ 300 | labeltext = '+'+labeltext; 301 | } 302 | 303 | label.setText(labeltext); 304 | } 305 | 306 | //Show error 307 | public void generateError(int errorCode){ 308 | 309 | //Error reference: 310 | 311 | // Code: 1.0 --> Class: Undervolt.java --> Method: runScript 312 | // Solution: Application start with no sudo permission or something is wrong with undervolt.py file 313 | 314 | // Code: 2.0 --> Class: Undervolt.java --> Method: setValue 315 | // Solution: Error during setting voltage, pc not compatible or something is wrong with undervolt.py file 316 | 317 | setEnableUi(false); 318 | applybutton.setText("Error code: " + errorCode); 319 | } 320 | 321 | } 322 | -------------------------------------------------------------------------------- /src/META-INF/CpuUi.form: -------------------------------------------------------------------------------- 1 | 2 |
    3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 | -------------------------------------------------------------------------------- /src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: Main 3 | 4 | -------------------------------------------------------------------------------- /src/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | public static void main(String[] args) { 4 | 5 | //TODO 6 | // 1: When i save over another save it will double the file extension 7 | // 2: Clean the code 8 | // 3: Create a better installer 9 | // 4: Create a better launcher 10 | 11 | CpuInfo cpuInfo = new CpuInfo(); 12 | 13 | //Anti aliasing for the font 14 | System.setProperty("awt.useSystemAAFontSettings","on"); 15 | 16 | //Run the ui thread 17 | Thread runUi = new Thread(new Runnable() { 18 | @Override 19 | public void run() { 20 | Interface ui = new Interface(); 21 | ui.createUi(); 22 | } 23 | }); 24 | 25 | runUi.start(); 26 | 27 | /* Thread runCpuUi = new Thread(new Runnable() { 28 | @Override 29 | public void run() { 30 | CpuUi cpuUi = new CpuUi(); 31 | cpuUi.createUi(); 32 | } 33 | }); 34 | 35 | runCpuUi.start();*/ 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Profile.java: -------------------------------------------------------------------------------- 1 | import javax.imageio.ImageIO; 2 | import javax.swing.*; 3 | import java.awt.*; 4 | import java.io.*; 5 | import java.util.Date; 6 | import java.util.HashMap; 7 | 8 | public class Profile { 9 | 10 | private final JFrame frame; 11 | private Config configs = new Config(); 12 | 13 | private HashMap returnValue; 14 | 15 | //Constructor 16 | public Profile(JFrame frame){ 17 | this.frame = frame; 18 | } 19 | 20 | //Save data to file 21 | public void save(int coreSliderValue, int gpuSliderValue, int cacheSliderValue, int uncoreSliderValue, int analogioSliderValue){ 22 | JFileChooser fileChooser = new JFileChooser(new File(configs.getSave_path())){ 23 | @Override 24 | protected JDialog createDialog( Component parent ) throws HeadlessException { 25 | JDialog dialog = super.createDialog( parent ); 26 | try { 27 | dialog.setIconImage(ImageIO.read(new File(configs.getImage_path()+"icosave.png"))); 28 | } catch (IOException e) { 29 | System.out.println("No icon found"); 30 | } 31 | return dialog; 32 | } 33 | }; 34 | 35 | fileChooser.setDialogTitle("Save profile"); 36 | 37 | int userSelection = fileChooser.showSaveDialog(frame); 38 | 39 | if (userSelection == JFileChooser.APPROVE_OPTION) { 40 | 41 | try { 42 | Date today = new Date(); 43 | FileWriter fw = new FileWriter(fileChooser.getSelectedFile()+".txt"); 44 | fw.write("#Setting profile data: " + today); 45 | fw.write("\n"); 46 | fw.write("core: " + coreSliderValue+".0 mV"); 47 | fw.write("\n"); 48 | fw.write("gpu: " + gpuSliderValue+".0 mV"); 49 | fw.write("\n"); 50 | fw.write("cache: " + cacheSliderValue+".0 mV"); 51 | fw.write("\n"); 52 | fw.write("uncore: " + uncoreSliderValue+".0 mV"); 53 | fw.write("\n"); 54 | fw.write("analogio: " + analogioSliderValue+".0 mV"); 55 | fw.close(); 56 | } catch (IOException e) { 57 | e.printStackTrace(); 58 | } 59 | } 60 | } 61 | 62 | 63 | //Read data from file 64 | public HashMap read(){ 65 | 66 | returnValue = new HashMap(); 67 | 68 | JFileChooser fileChooser = new JFileChooser(new File(configs.getSave_path())){ 69 | @Override 70 | protected JDialog createDialog( Component parent ) throws HeadlessException { 71 | JDialog dialog = super.createDialog( parent ); 72 | try { 73 | dialog.setIconImage(ImageIO.read(new File(configs.getImage_path()+"icoload.png"))); 74 | } catch (IOException e) { 75 | System.out.println("No icon found"); 76 | } 77 | return dialog; 78 | } 79 | }; 80 | 81 | fileChooser.setApproveButtonText("Load"); 82 | 83 | int userSelection = fileChooser.showOpenDialog(frame); 84 | 85 | if (userSelection == JFileChooser.APPROVE_OPTION) { 86 | File file = fileChooser.getSelectedFile(); 87 | 88 | readfile(file); 89 | return returnValue; 90 | } else{ 91 | returnValue.put("errors", 0.0); 92 | return returnValue; 93 | } 94 | 95 | } 96 | 97 | //Read the selected file 98 | private void readfile(File file) { 99 | BufferedReader reader; 100 | try { 101 | reader = new BufferedReader(new FileReader(file)); 102 | 103 | //Ignore the first row (date) or it make KABOOOM!!! 104 | String line = reader.readLine(); 105 | System.out.println(line); 106 | 107 | //Now let's learn how to read ;-) 108 | line = reader.readLine(); 109 | while (line != null) { 110 | System.out.println(line); 111 | addToHasmap(line); 112 | line = reader.readLine(); 113 | } 114 | reader.close(); 115 | } catch (IOException e) { 116 | e.printStackTrace(); 117 | } 118 | } 119 | 120 | //Create the hashmap (i's a duplicate forn now form undervolt class, i'll remove soon or later) 121 | private void addToHasmap(String scrptString){ 122 | 123 | //String preparation 124 | scrptString = scrptString.replace("mV", ""); 125 | scrptString = scrptString.replace(" ", ""); 126 | String[] parts = scrptString.split(":"); 127 | String name = parts[0]; // Core 128 | String value = parts[1]; // 0.0 129 | 130 | //Add to hashmap 131 | System.out.println("Adding: " + name + " Value: " + value ); 132 | returnValue.put(name, Double.parseDouble(value)); 133 | 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/Stresstest.java: -------------------------------------------------------------------------------- 1 | public class Stresstest { 2 | /** 3 | * Starts the Load Generation 4 | * 5 | * @param args Command line arguments, ignored 6 | */ 7 | 8 | private int numCore; 9 | private int numThreadsPerCore; 10 | private double load; 11 | private long duration; 12 | 13 | public Stresstest() { 14 | numCore = 1; 15 | numThreadsPerCore = 2; 16 | load = 0.5; 17 | duration = 60; 18 | } 19 | 20 | public void setStress(int numCore, int numThreadsPerCore, double load, long duration){ 21 | this.numCore = numCore; 22 | this.numThreadsPerCore = numThreadsPerCore; 23 | this.load = load; 24 | this.duration = duration; 25 | } 26 | 27 | public void setStressMaxCore(long duration){ 28 | 29 | // get the runtime object associated with the current Java application 30 | Runtime runtime = Runtime.getRuntime(); 31 | // get the number of processors available to the Java virtual machine 32 | int numberOfProcessors = runtime.availableProcessors(); 33 | 34 | this.numCore = numberOfProcessors; 35 | this.numThreadsPerCore = numberOfProcessors; 36 | this.load = 1.0; 37 | this.duration = duration; 38 | } 39 | 40 | public void startStress(){ 41 | System.out.println("Stress: cpu: "+ numCore+ " ThreadPerCore: "+ numThreadsPerCore+ " Duration: " + duration); 42 | for (int thread = 0; thread < numCore * numThreadsPerCore; thread++) { 43 | new BusyThread("Thread" + thread, load, duration).start(); 44 | } 45 | } 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/UndervoltValue.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.util.HashMap; 3 | 4 | /***************************** 5 | * 6 | * This class is made to interface my ui with undervolt.py 7 | * 8 | * undervolt.py IS NOT MINE it's belong to georgewhewell, if you like it 9 | * tanks it to his github page: 10 | * 11 | * https://github.com/georgewhewell/undervolt 12 | * 13 | * *****************************/ 14 | 15 | public class UndervoltValue { 16 | 17 | private Config configs = new Config(); 18 | private HashMap returnValue; 19 | 20 | public UndervoltValue(){ } 21 | 22 | // Read the actual config 23 | public HashMap getValue(){ 24 | 25 | returnValue = new HashMap(); 26 | 27 | runScript("--read", true); 28 | 29 | return returnValue; 30 | } 31 | 32 | //Set the slider config 33 | public boolean setValue(int core, int gpu, int cache, int uncore, int analogio){ 34 | 35 | String undervolt = "--gpu "+gpu+" --core "+core+" --cache "+cache+" --uncore "+uncore+" --analogio "+analogio+""; 36 | 37 | System.out.println("Applying: " + undervolt); 38 | 39 | returnValue = new HashMap(); 40 | 41 | return runScript(undervolt, false); 42 | 43 | } 44 | 45 | //This run the script and read the output 46 | private boolean runScript(String param, boolean read){ 47 | 48 | //Path and script name 49 | String path = "sudo "+configs.getUndervolt_path(); 50 | String script = "undervolt.py "; 51 | 52 | try { 53 | // Create process 54 | System.out.println("Eseguo: " + path+script+param); 55 | Process p = Runtime.getRuntime().exec(path+script+param); 56 | BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 57 | 58 | //Read process return 59 | String ret = in.readLine(); 60 | 61 | //For setting error 62 | if(ret == null && !read){ 63 | return true; 64 | } 65 | if(ret != null && !read){ 66 | return false; 67 | } 68 | 69 | //Read file 70 | if(ret == null && read){ 71 | //No permission or no script 72 | System.out.println("Errore nell'eseczuione dello script"); 73 | returnValue.put("errors", 1.0); 74 | }else{ 75 | //Read all return data form the second line 76 | ret = in.readLine(); 77 | 78 | while (ret != null){ 79 | 80 | //Console log 81 | System.out.println("Script say : "+ret); 82 | 83 | //Create hasmap for return 84 | addToHasmap(ret); 85 | 86 | //Read all line 87 | ret = in.readLine(); 88 | } 89 | } 90 | 91 | } catch (IOException e) { 92 | //No script 93 | e.printStackTrace(); 94 | } 95 | return false; 96 | } 97 | 98 | 99 | //Create the hashmap that the ui use 100 | private void addToHasmap(String scrptString){ 101 | 102 | //String preparation 103 | scrptString = scrptString.replace("mV", ""); 104 | scrptString = scrptString.replace(" ", ""); 105 | String[] parts = scrptString.split(":"); 106 | String name = parts[0]; // Core 107 | String value = parts[1]; // 0.0 108 | 109 | //Add to hashmap 110 | System.out.println("Adding: " + name + " " + value ); 111 | returnValue.put(name, Double.parseDouble(value)); 112 | 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/UpdateCpuStatus.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.util.ArrayList; 3 | import java.util.List; 4 | 5 | public class UpdateCpuStatus extends SwingWorker { 6 | 7 | private CpuInfo processorInfo = new CpuInfo(); 8 | private JTextPane txtCpuStatus; 9 | private JProgressBar cpuLoadBar; 10 | 11 | public UpdateCpuStatus(JTextPane txtCpuStatus, JProgressBar cpuLoadBar){ 12 | this.txtCpuStatus = txtCpuStatus; 13 | this.cpuLoadBar = cpuLoadBar; 14 | publish(1); 15 | } 16 | 17 | @Override 18 | protected Void doInBackground() throws Exception { 19 | 20 | while(true){ 21 | publish(1); 22 | Thread.sleep(1000); 23 | } 24 | } 25 | 26 | @Override 27 | protected void process(List chunk) { 28 | updateStatus(); 29 | } 30 | 31 | public void updateStatus(){ 32 | processorInfo.updateValue(); 33 | 34 | ArrayList temps = processorInfo.getTemp(); 35 | 36 | //Cpu Freq and temperature 37 | String cpuStatus = "" + 38 | "

    Cpu frequency:

    " + 39 | ""+ 40 | ""+ 41 | ""+ 42 | ""+ 43 | ""+ 44 | ""+ 45 | "
    "+ processorInfo.getActFreq() +""+ processorInfo.getMinFreq() +""+ processorInfo.getMaxFreq() +"
    "+ 46 | "

    Cpu temperature:

    " + 47 | ""+ 48 | ""; 49 | 50 | for (String temp : temps) { 51 | cpuStatus = cpuStatus + ""; 52 | } 53 | 54 | cpuStatus = cpuStatus + 55 | ""+ 56 | "
    "+temp +"
    "+ 57 | ""; 58 | 59 | txtCpuStatus.setText(cpuStatus); 60 | 61 | //Cpu load 62 | cpuLoadBar.setValue(Integer.parseInt(processorInfo.getload())); 63 | } 64 | } 65 | --------------------------------------------------------------------------------