From eba42175d28945bd08ace251bf2768fbf45cf958 Mon Sep 17 00:00:00 2001 From: Quentin Decaunes Date: Sat, 6 Apr 2019 00:40:09 +0200 Subject: [PATCH] See #9 Added hpet options. --- index.html | 11 +++++++++++ js/app.js | 3 ++- js/methods.js | 40 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 4671d2e..586b687 100644 --- a/index.html +++ b/index.html @@ -104,6 +104,17 @@

Minimize to tray:

+

HPET:

+

+ High Precision Event Timer: Allow application to get time with precision below microseconds, but is slower than most other other timer facilities.
+ Try running benchmark with and without to see if you get any difference.
+ If it doesn't make any difference, it's recommanded to let it enable.
+ You must reboot to apply changes. +

+

+ + +

Re-apply ryzenadj periodically:

Ryzen Controller will re-apply ryzenadj every X seconds. Set to 0 to disable.

diff --git a/js/app.js b/js/app.js index 86842ba..56fc776 100644 --- a/js/app.js +++ b/js/app.js @@ -10,8 +10,9 @@ ready(function(){ reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically')); displayOptionDescription(); if (require('os').platform() === 'win32') { - recreateShortcut(); + recreateShortcut(); } + handlePlatformSpecificDisplay(); updatePresetList(); checkForNewRelease(); document.isStarting = false; diff --git a/js/methods.js b/js/methods.js index f9c7d92..c23b724 100644 --- a/js/methods.js +++ b/js/methods.js @@ -75,8 +75,8 @@ function checkForAdminRights() { ); } } else { - var exec = require('child_process').exec; - exec('NET SESSION', function(err,so,se) { + const child = require('child_process').execFile; + child('NET SESSION', function(err,so,se) { if (se.length !== 0) { notification('warning', `Warning: you should launch this app as administrator, ` @@ -482,3 +482,39 @@ function checkForNewRelease() { request.send(); } + +/** + * Will change the BCD entry value for userplatformclock. + * + * @param {string} value BCD entry value for userplatformclock: "true" or "false". + */ +function toggleHpet(value) { + value = value === "true" ? "true" : "false"; + const BcdeditExecutablePath = "C:\\Windows\\system32\\bcdedit.exe"; + const parameters = [ + "/set", + "useplatformclock", + value, + ]; + + const child = require('child_process').execFile; + child(BcdeditExecutablePath, parameters, function(err, data) { + var output = data.toString(); + if (err) { + notification('danger', err + '
' + output); + } + else if (output) { + notification('success', 'Bcdedit output:
' + output); + saveLatestUsedSettings(); + } + }); +} + +function handlePlatformSpecificDisplay() { + var windows_only_elements = document.getElementsByClassName('windows-only'); + if (require('os').platform() !== 'win32') { + for (const item of windows_only_elements) { + item.setAttribute('hidden', 'true'); + } + } +}