-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge EA to public #1035
Merge EA to public #1035
Changes from all commits
ac70a3c
0e188e6
6c1ddee
e91b049
b794f21
c191327
e6080f2
7d58de2
85b2bf6
35b44ed
512c7af
a09c08d
57ce44e
e7c15b8
90cf8c1
b1fe1fa
d5dc0c3
f8a56f8
025600e
182b687
395c775
458c714
c707c79
1de76ae
03bcffa
e6a354a
628c65d
c45bb07
584b92c
87656bd
723b52e
51fb31f
8cea84c
edac338
3728b53
c1dce0f
e97fe9f
85dd3f0
e7369f2
2258b39
bc4ce99
1d0990c
12e1f42
ba4d7f6
04103e3
3f4e2ce
ed72f42
ca6bbac
789f750
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -570,7 +570,10 @@ private static async void cpuWatchdog_Elapsed(object? sender, ElapsedEventArgs e | |
|
||
// only request an update if current limit is different than stored | ||
if (ReadTDP != TDP) | ||
{ | ||
processor.SetTDPLimit(type, TDP); | ||
CurrentTDP[idx] = TDP; | ||
} | ||
Comment on lines
+573
to
+576
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure thread safety when updating The code modifies the |
||
|
||
await Task.Delay(20); | ||
} | ||
|
@@ -727,28 +730,18 @@ private static void RequestTDP(PowerType type, double value, bool immediate = fa | |
|
||
// immediately apply | ||
if (immediate) | ||
{ | ||
processor.SetTDPLimit((PowerType)idx, value, immediate); | ||
CurrentTDP[idx] = value; | ||
} | ||
} | ||
|
||
private static async void RequestTDP(double[] values, bool immediate = false) | ||
{ | ||
if (processor is null || !processor.IsInitialized) | ||
return; | ||
|
||
for (int idx = (int)PowerType.Slow; idx <= (int)PowerType.Fast; idx++) | ||
{ | ||
// make sure we're not trying to run below or above specs | ||
values[idx] = Math.Min(TDPMax, Math.Max(TDPMin, values[idx])); | ||
|
||
// update value read by timer | ||
StoredTDP[idx] = values[idx]; | ||
|
||
// immediately apply | ||
if (immediate) | ||
{ | ||
processor.SetTDPLimit((PowerType)idx, values[idx], immediate); | ||
await Task.Delay(20); | ||
} | ||
RequestTDP((PowerType)idx, values[idx], immediate); | ||
await Task.Delay(20); | ||
} | ||
} | ||
|
||
|
@@ -874,18 +867,15 @@ public static void Start() | |
// initialize processor | ||
processor = Processor.GetCurrent(); | ||
|
||
if (processor.IsInitialized) | ||
if (processor is not null && processor.IsInitialized) | ||
{ | ||
processor.StatusChanged += Processor_StatusChanged; | ||
processor.Initialize(); | ||
} | ||
|
||
// deprecated | ||
/* | ||
processor.ValueChanged += Processor_ValueChanged; | ||
processor.LimitChanged += Processor_LimitChanged; | ||
processor.MiscChanged += Processor_MiscChanged; | ||
*/ | ||
else | ||
{ | ||
ProcessorStatusChanged?.Invoke(false, false); | ||
} | ||
Comment on lines
+870
to
+878
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle potential null reference in processor initialization. The method |
||
|
||
IsInitialized = true; | ||
Initialized?.Invoke(); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||||||
using System.IO; | ||||||||||
using System.Linq; | ||||||||||
using System.Runtime.InteropServices; | ||||||||||
using System.Threading; | ||||||||||
using System.Threading.Tasks; | ||||||||||
using System.Windows; | ||||||||||
using System.Windows.Automation; | ||||||||||
|
@@ -88,7 +89,8 @@ static ProcessManager() | |||||||||
|
||||||||||
private static void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) | ||||||||||
{ | ||||||||||
ForegroundCallback(); | ||||||||||
// avoid locking UI thread | ||||||||||
new Thread(() => { ForegroundCallback(); }).Start(); | ||||||||||
Comment on lines
+92
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using Using - new Thread(() => { ForegroundCallback(); }).Start();
+ Task.Run(() => { ForegroundCallback(); }); Committable suggestion
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
private static void OnWindowOpened(object sender, AutomationEventArgs automationEventArgs) | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RTSS version number is inconsistent with the defined constant.
Committable suggestion