Add labels to graphs, Add EnableGraphMaxScale/EnableGraphMaxText settings

This commit is contained in:
dmex
2022-08-06 13:47:19 +10:00
parent 8dc955fdc1
commit 11076b9a8b
10 changed files with 182 additions and 64 deletions
+2 -1
View File
@@ -92,7 +92,8 @@ EXT ULONG PhCsColorServiceStop;
EXT BOOLEAN PhEnableImageCoherencySupport;
EXT ULONG PhCsImageCoherencyScanLevel;
EXT ULONG PhCsEnableScaleCpuGraph;
EXT BOOLEAN PhCsEnableGraphMaxScale;
EXT BOOLEAN PhCsEnableGraphMaxText;
#define PH_SET_INTEGER_CACHED_SETTING(Name, Value) (PhSetIntegerSetting(TEXT(#Name), PhCs##Name = (Value)))
+11 -3
View File
@@ -154,7 +154,7 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
if (header->hwndFrom == performanceContext->CpuGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | (PhCsEnableScaleCpuGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhCsColorCpuKernel, PhCsColorCpuUser);
PhGraphStateGetDrawInfo(
@@ -170,7 +170,7 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
PhCopyCircularBuffer_FLOAT(&processItem->CpuUserHistory,
performanceContext->CpuGraphState.Data2, drawInfo->LineDataCount);
if (PhCsEnableScaleCpuGraph)
if (PhCsEnableGraphMaxScale)
{
FLOAT max = 0;
@@ -200,6 +200,11 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
else
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = 0.0f;
}
performanceContext->CpuGraphState.Valid = TRUE;
}
@@ -230,7 +235,7 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
}
else if (header->hwndFrom == performanceContext->PrivateGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhCsColorPrivate, 0);
PhGraphStateGetDrawInfo(
@@ -257,6 +262,9 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
);
}
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)processItem->VmCounters.PeakPagefileUsage;
performanceContext->PrivateGraphState.Valid = TRUE;
}
+2 -1
View File
@@ -380,8 +380,9 @@ VOID PhUpdateCachedSettings(
PH_UPDATE_SETTING(ColorFanRpm);
PH_UPDATE_SETTING(ImageCoherencyScanLevel);
PH_UPDATE_SETTING(EnableScaleCpuGraph);
PhCsEnableGraphMaxScale = !!PhGetIntegerSetting(L"EnableGraphMaxScale");
PhCsEnableGraphMaxText = !!PhGetIntegerSetting(L"EnableGraphMaxText");
PhEnableNetworkResolveDoHSupport = !!PhGetIntegerSetting(L"EnableNetworkResolveDoH");
PhEnableVersionShortText = !!PhGetIntegerSetting(L"EnableVersionSupport");
}
+20 -5
View File
@@ -137,7 +137,7 @@ BOOLEAN PhSipCpuSectionCallback(
if (!drawInfo)
break;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | (PhCsEnableScaleCpuGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | PH_GRAPH_LABEL_MAX_Y;
Section->Parameters->ColorSetupFunction(drawInfo, PhCsColorCpuKernel, PhCsColorCpuUser);
PhGetDrawInfoGraphBuffers(&Section->GraphState.Buffers, drawInfo, PhCpuKernelHistory.Count);
@@ -146,7 +146,7 @@ BOOLEAN PhSipCpuSectionCallback(
PhCopyCircularBuffer_FLOAT(&PhCpuKernelHistory, Section->GraphState.Data1, drawInfo->LineDataCount);
PhCopyCircularBuffer_FLOAT(&PhCpuUserHistory, Section->GraphState.Data2, drawInfo->LineDataCount);
if (PhCsEnableScaleCpuGraph)
if (PhCsEnableGraphMaxScale)
{
FLOAT max = 0;
@@ -167,6 +167,11 @@ BOOLEAN PhSipCpuSectionCallback(
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
else
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = 1.0f;
}
Section->GraphState.Valid = TRUE;
}
@@ -768,7 +773,7 @@ VOID PhSipNotifyCpuGraph(
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | (PhCsEnableScaleCpuGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_USE_LINE_2 | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhCsColorCpuKernel, PhCsColorCpuUser);
if (Index == ULONG_MAX)
@@ -784,7 +789,7 @@ VOID PhSipNotifyCpuGraph(
PhCopyCircularBuffer_FLOAT(&PhCpuKernelHistory, CpuGraphState.Data1, drawInfo->LineDataCount);
PhCopyCircularBuffer_FLOAT(&PhCpuUserHistory, CpuGraphState.Data2, drawInfo->LineDataCount);
if (PhCsEnableScaleCpuGraph)
if (PhCsEnableGraphMaxScale)
{
FLOAT max = 0;
@@ -805,6 +810,11 @@ VOID PhSipNotifyCpuGraph(
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
else
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = 1.0f;
}
CpuGraphState.Valid = TRUE;
}
@@ -822,7 +832,7 @@ VOID PhSipNotifyCpuGraph(
PhCopyCircularBuffer_FLOAT(&PhCpusKernelHistory[Index], CpusGraphState[Index].Data1, drawInfo->LineDataCount);
PhCopyCircularBuffer_FLOAT(&PhCpusUserHistory[Index], CpusGraphState[Index].Data2, drawInfo->LineDataCount);
if (PhCsEnableScaleCpuGraph)
if (PhCsEnableGraphMaxScale)
{
FLOAT max = 0;
@@ -843,6 +853,11 @@ VOID PhSipNotifyCpuGraph(
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
else
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = 1.0f;
}
CpusGraphState[Index].Valid = TRUE;
}
+28 -4
View File
@@ -124,7 +124,7 @@ BOOLEAN PhSipMemorySectionCallback(
if (PhGetIntegerSetting(L"ShowCommitInSummary"))
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
Section->Parameters->ColorSetupFunction(drawInfo, PhCsColorPrivate, 0);
PhGetDrawInfoGraphBuffers(&Section->GraphState.Buffers, drawInfo, PhCommitHistory.Count);
@@ -145,12 +145,18 @@ BOOLEAN PhSipMemorySectionCallback(
);
}
if (PhCsEnableGraphMaxText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)PhPerfInformation.CommitLimit * PAGE_SIZE;
}
Section->GraphState.Valid = TRUE;
}
}
else
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
Section->Parameters->ColorSetupFunction(drawInfo, PhCsColorPhysical, 0);
PhGetDrawInfoGraphBuffers(&Section->GraphState.Buffers, drawInfo, PhPhysicalHistory.Count);
@@ -171,6 +177,12 @@ BOOLEAN PhSipMemorySectionCallback(
);
}
if (PhCsEnableGraphMaxText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)PhSystemBasicInformation.NumberOfPhysicalPages * PAGE_SIZE;
}
Section->GraphState.Valid = TRUE;
}
}
@@ -560,7 +572,7 @@ VOID PhSipNotifyCommitGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhCsColorPrivate, 0);
PhGraphStateGetDrawInfo(
@@ -586,6 +598,12 @@ VOID PhSipNotifyCommitGraph(
);
}
if (PhCsEnableGraphMaxText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)PhPerfInformation.CommitLimit * PAGE_SIZE;
}
CommitGraphState.Valid = TRUE;
}
}
@@ -631,7 +649,7 @@ VOID PhSipNotifyPhysicalGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (PhCsEnableGraphMaxText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhCsColorPhysical, 0);
PhGraphStateGetDrawInfo(
@@ -657,6 +675,12 @@ VOID PhSipNotifyPhysicalGraph(
);
}
if (PhCsEnableGraphMaxText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)PhSystemBasicInformation.NumberOfPhysicalPages * PAGE_SIZE;
}
PhysicalGraphState.Valid = TRUE;
}
}
+1
View File
@@ -53,6 +53,7 @@ extern ULONG ProcessesUpdatedCount;
extern ULONG EtUpdateInterval;
extern BOOLEAN EtGraphShowText;
extern BOOLEAN EtEnableScaleGraph;
extern BOOLEAN EtEnableScaleText;
extern BOOLEAN EtPropagateCpuUsage;
#define PLUGIN_NAME L"ProcessHacker.ExtendedTools"
+7 -7
View File
@@ -575,7 +575,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
if (header->hwndFrom == context->FramesPerSecondGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&context->FramesPerSecondGraphState, getDrawInfo, context->Block->FramesPerSecondHistory.Count);
@@ -630,7 +630,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->FramesLatencyGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0);
PhGraphStateGetDrawInfo(&context->FramesLatencyGraphState, getDrawInfo, context->Block->FramesLatencyHistory.Count);
@@ -685,7 +685,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->PresentIntervalGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorIoWrite"), 0);
PhGraphStateGetDrawInfo(&context->PresentIntervalGraphState, getDrawInfo, context->Block->FramesMsBetweenPresentsHistory.Count);
@@ -740,7 +740,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->PresentDurationGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPrivate"), 0);
PhGraphStateGetDrawInfo(&context->PresentDurationGraphState, getDrawInfo, context->Block->FramesMsInPresentApiHistory.Count);
@@ -795,7 +795,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->FramesRenderTimeGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPrivate"), 0);
PhGraphStateGetDrawInfo(&context->FramesRenderTimeGraphState, getDrawInfo, context->Block->FramesMsUntilRenderCompleteHistory.Count);
@@ -850,7 +850,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->FramesDisplayTimeGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&context->FramesDisplayTimeGraphState, getDrawInfo, context->Block->FramesMsUntilDisplayedHistory.Count);
@@ -905,7 +905,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
}
else if (header->hwndFrom == context->FramesDisplayLatencyGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | PH_GRAPH_LABEL_MAX_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0);
PhGraphStateGetDrawInfo(&context->FramesDisplayLatencyGraphState, getDrawInfo, context->Block->FramesDisplayLatencyHistory.Count);
+15 -7
View File
@@ -440,7 +440,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
if (header->hwndFrom == context->GpuGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(&context->GpuGraphState, getDrawInfo, context->Block->GpuHistory.Count);
@@ -468,6 +468,14 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
else
{
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = 1.0f;
}
}
context->GpuGraphState.Valid = TRUE;
}
@@ -500,7 +508,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
}
else if (header->hwndFrom == context->MemGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0);
PhGraphStateGetDrawInfo(&context->MemoryGraphState, getDrawInfo, context->Block->MemoryHistory.Count);
@@ -528,7 +536,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
PhDivideSinglesBySingle(context->MemoryGraphState.Data1, max, drawInfo->LineDataCount);
}
if (EtEnableScaleGraph)
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = max * PAGE_SIZE;
@@ -561,7 +569,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
}
else if (header->hwndFrom == context->SharedGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorIoWrite"), 0);
PhGraphStateGetDrawInfo(&context->MemorySharedGraphState, getDrawInfo, context->Block->MemorySharedHistory.Count);
@@ -589,7 +597,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
PhDivideSinglesBySingle(context->MemorySharedGraphState.Data1, max, drawInfo->LineDataCount);
}
if (EtEnableScaleGraph)
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = max * PAGE_SIZE;
@@ -622,7 +630,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
}
else if (header->hwndFrom == context->CommittedGraphHandle)
{
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPrivate"), 0);
PhGraphStateGetDrawInfo(&context->GpuCommittedGraphState, getDrawInfo, context->Block->GpuCommittedHistory.Count);
@@ -651,7 +659,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
PhDivideSinglesBySingle(context->GpuCommittedGraphState.Data1, max, drawInfo->LineDataCount);
}
if (EtEnableScaleGraph)
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = max * PAGE_SIZE;
+93 -35
View File
@@ -148,7 +148,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
if (!drawInfo)
break;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
Section->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGetDrawInfoGraphBuffers(&Section->GraphState.Buffers, drawInfo, EtGpuNodeHistory.Count);
@@ -170,15 +170,14 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
if (max != 0)
{
PhDivideSinglesBySingle(
Section->GraphState.Data1,
max,
drawInfo->LineDataCount
);
PhDivideSinglesBySingle(Section->GraphState.Data1, max, drawInfo->LineDataCount);
}
}
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
drawInfo->LabelYFunctionParameter = 1.0f;
}
Section->GraphState.Valid = TRUE;
@@ -223,7 +222,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[5];
// %.2f%%\n%s / %s
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 2);
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuDedicatedUsage);
PhInitFormatS(&format[3], L" / ");
@@ -232,7 +231,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
drawPanel->SubTitle = PhFormat(format, 5, 64);
// %.2f%%\n%s
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 2);
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuDedicatedUsage);
@@ -243,7 +242,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[5];
// %.2f%%\n%s / %s
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 2);
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuSharedUsage);
PhInitFormatS(&format[3], L" / ");
@@ -252,7 +251,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
drawPanel->SubTitle = PhFormat(format, 5, 64);
// %.2f%%\n%s
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 2);
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
PhInitFormatSize(&format[2], EtGpuSharedUsage);
@@ -263,7 +262,7 @@ BOOLEAN EtpGpuSysInfoSectionCallback(
PH_FORMAT format[2];
// %.2f%%\n
PhInitFormatF(&format[0], (DOUBLE)EtGpuNodeUsage * 100, 2);
PhInitFormatF(&format[0], EtGpuNodeUsage * 100, 2);
PhInitFormatS(&format[1], L"%\n");
drawPanel->SubTitle = PhFormat(format, RTL_NUMBER_OF(format), 0);
@@ -747,6 +746,51 @@ VOID EtpLayoutGpuGraphs(
EndDeferWindowPos(deferHandle);
}
PPH_STRING EtpPowerUsageGraphLabelYFunction(
_In_ PPH_GRAPH_DRAW_INFO DrawInfo,
_In_ ULONG DataIndex,
_In_ FLOAT Value,
_In_ FLOAT Parameter
)
{
PH_FORMAT format[2];
PhInitFormatF(&format[0], Value * Parameter, 1);
PhInitFormatC(&format[1], L'%');
return PhFormat(format, RTL_NUMBER_OF(format), 0);
}
PPH_STRING EtpTemperatureGraphLabelYFunction(
_In_ PPH_GRAPH_DRAW_INFO DrawInfo,
_In_ ULONG DataIndex,
_In_ FLOAT Value,
_In_ FLOAT Parameter
)
{
PH_FORMAT format[2];
PhInitFormatF(&format[0], (ULONG)(Value * Parameter), 1);
PhInitFormatS(&format[1], L"\u00b0C\n");
return PhFormat(format, RTL_NUMBER_OF(format), 0);
}
PPH_STRING EtpFanRpmGraphLabelYFunction(
_In_ PPH_GRAPH_DRAW_INFO DrawInfo,
_In_ ULONG DataIndex,
_In_ FLOAT Value,
_In_ FLOAT Parameter
)
{
PH_FORMAT format[2];
PhInitFormatU(&format[0], (ULONG)(Value * Parameter));
PhInitFormatS(&format[1], L" RPM\n");
return PhFormat(format, RTL_NUMBER_OF(format), 0);
}
VOID EtpNotifyGpuGraph(
_In_ NMHDR *Header
)
@@ -758,7 +802,7 @@ VOID EtpNotifyGpuGraph(
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), 0);
PhGraphStateGetDrawInfo(
@@ -785,15 +829,14 @@ VOID EtpNotifyGpuGraph(
if (max != 0)
{
PhDivideSinglesBySingle(
GpuGraphState.Data1,
max,
drawInfo->LineDataCount
);
PhDivideSinglesBySingle(GpuGraphState.Data1, max, drawInfo->LineDataCount);
}
}
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiDoubleLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
drawInfo->LabelYFunctionParameter = 1.0f;
}
GpuGraphState.Valid = TRUE;
@@ -814,7 +857,7 @@ VOID EtpNotifyGpuGraph(
gpu = PhGetItemCircularBuffer_FLOAT(&EtGpuNodeHistory, getTooltipText->Index);
// %.2f%%%s\n%s
PhInitFormatF(&format[0], (DOUBLE)gpu * 100, 2);
PhInitFormatF(&format[0], gpu * 100, 2);
PhInitFormatC(&format[1], L'%');
PhInitFormatSR(&format[2], PH_AUTO_T(PH_STRING, EtpGetMaxNodeString(getTooltipText->Index))->sr);
PhInitFormatC(&format[3], L'\n');
@@ -861,7 +904,7 @@ VOID EtpNotifyDedicatedGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorPrivate"), 0);
PhGraphStateGetDrawInfo(
@@ -892,7 +935,7 @@ VOID EtpNotifyDedicatedGraph(
PhDivideSinglesBySingle(DedicatedGraphState.Data1, max, drawInfo->LineDataCount);
}
if (EtEnableScaleGraph)
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
@@ -942,7 +985,7 @@ VOID EtpNotifySharedGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleGraph ? PH_GRAPH_LABEL_MAX_Y : 0);
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0);
PhGraphStateGetDrawInfo(
@@ -955,10 +998,10 @@ VOID EtpNotifySharedGraph(
{
FLOAT max = 0;
if (EtGpuSharedLimit != 0 && !EtEnableScaleGraph)
{
max = (FLOAT)EtGpuSharedLimit;
}
//if (EtGpuSharedLimit != 0 && !EtEnableScaleGraph)
//{
// max = (FLOAT)EtGpuSharedLimit;
//}
for (i = 0; i < drawInfo->LineDataCount; i++)
{
@@ -973,12 +1016,12 @@ VOID EtpNotifySharedGraph(
PhDivideSinglesBySingle(SharedGraphState.Data1, max, drawInfo->LineDataCount);
}
if (EtEnableScaleGraph)
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = PhSiSizeLabelYFunction;
drawInfo->LabelYFunctionParameter = max;
}
SharedGraphState.Valid = TRUE;
}
}
@@ -1023,7 +1066,7 @@ VOID EtpNotifyPowerUsageGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorPowerUsage"), 0);
PhGraphStateGetDrawInfo(
@@ -1039,13 +1082,18 @@ VOID EtpNotifyPowerUsageGraph(
PowerUsageGraphState.Data1[i] = PhGetItemCircularBuffer_FLOAT(&EtGpuPowerUsageHistory, i);
}
// Scale the data.
PhDivideSinglesBySingle(
PowerUsageGraphState.Data1,
EtGpuPowerUsageLimit,
drawInfo->LineDataCount
);
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = EtpPowerUsageGraphLabelYFunction;
drawInfo->LabelYFunctionParameter = EtGpuPowerUsageLimit;
}
PowerUsageGraphState.Valid = TRUE;
}
}
@@ -1090,7 +1138,7 @@ VOID EtpNotifyTemperatureGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorTemperature"), 0);
PhGraphStateGetDrawInfo(
@@ -1106,13 +1154,18 @@ VOID EtpNotifyTemperatureGraph(
TemperatureGraphState.Data1[i] = PhGetItemCircularBuffer_FLOAT(&EtGpuTemperatureHistory, i);
}
// Scale the data.
PhDivideSinglesBySingle(
TemperatureGraphState.Data1,
EtGpuTemperatureLimit,
drawInfo->LineDataCount
);
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = EtpTemperatureGraphLabelYFunction;
drawInfo->LabelYFunctionParameter = EtGpuTemperatureLimit;
}
TemperatureGraphState.Valid = TRUE;
}
}
@@ -1165,7 +1218,7 @@ VOID EtpNotifyFanRpmGraph(
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
ULONG i;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y;
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_GRID_Y | (EtEnableScaleText ? PH_GRAPH_LABEL_MAX_Y : 0);
GpuSection->Parameters->ColorSetupFunction(drawInfo, PhGetIntegerSetting(L"ColorFanRpm"), 0);
PhGraphStateGetDrawInfo(
@@ -1181,13 +1234,18 @@ VOID EtpNotifyFanRpmGraph(
FanRpmGraphState.Data1[i] = (FLOAT)PhGetItemCircularBuffer_ULONG64(&EtGpuFanRpmHistory, i);
}
// Scale the data.
PhDivideSinglesBySingle(
FanRpmGraphState.Data1,
(FLOAT)EtGpuFanRpmLimit,
drawInfo->LineDataCount
);
if (EtEnableScaleText)
{
drawInfo->LabelYFunction = EtpFanRpmGraphLabelYFunction;
drawInfo->LabelYFunctionParameter = (FLOAT)EtGpuFanRpmLimit;
}
FanRpmGraphState.Valid = TRUE;
}
}
+3 -1
View File
@@ -45,6 +45,7 @@ static HANDLE ModuleProcessId = NULL;
ULONG EtUpdateInterval = 0;
BOOLEAN EtGraphShowText = FALSE;
BOOLEAN EtEnableScaleGraph = FALSE;
BOOLEAN EtEnableScaleText = FALSE;
BOOLEAN EtPropagateCpuUsage = FALSE;
VOID NTAPI LoadCallback(
@@ -775,7 +776,8 @@ VOID EtLoadSettings(
{
EtUpdateInterval = PhGetIntegerSetting(L"UpdateInterval");
EtGraphShowText = !!PhGetIntegerSetting(L"GraphShowText");
EtEnableScaleGraph = !!PhGetIntegerSetting(L"EnableScaleCpuGraph");
EtEnableScaleGraph = !!PhGetIntegerSetting(L"EnableGraphMaxScale");
EtEnableScaleText = !!PhGetIntegerSetting(L"EnableGraphMaxText");
EtPropagateCpuUsage = !!PhGetIntegerSetting(L"PropagateCpuUsage");
}