This commit is contained in:
Stefan Markovic
2024-10-11 11:56:08 +02:00
parent f0d538741e
commit d662b5885a
7 changed files with 11 additions and 26 deletions

View File

@@ -13,7 +13,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" />
<PackageReference Include="System.Diagnostics.Tracing" />
</ItemGroup>
</Project>

View File

@@ -265,7 +265,6 @@ If you don't configure this policy, the user takes control over the setting and
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
<string id="NewPlusHideTemplateFilenameExtension">Hide template filename extension</string>
<string id="AllowPowerToysAdvancedPasteOnlineAIModels">Advanced Paste: Allow using online AI models</string>
<string id="AllowDiagnosticData">Allow sending diagnostic data</string>
</stringTable>

View File

@@ -17,7 +17,7 @@
#include <common/Telemetry/EtwTrace/EtwTrace.h>
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
namespace winrt
{
@@ -114,8 +114,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
HANDLE m_exit_event_handle;
std::thread m_event_triggers_thread;
std::function<void(HWND)> removeWindowCallback = [&](HWND windowHandle)
{
std::function<void(HWND)> removeWindowCallback = [&](HWND windowHandle) {
if (!m_running)
{
// If we're not running, the reference to croppedWindows might no longer be valid and cause a crash at exit time, due to being called by destructors after wWinMain returns.
@@ -129,8 +128,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
}
};
std::function<void(CropAndLockType)> ProcessCommand = [&](CropAndLockType mode)
{
std::function<void(CropAndLockType)> ProcessCommand = [&](CropAndLockType mode) {
std::function<void(HWND, RECT)> windowCroppedCallback = [&, mode](HWND targetWindow, RECT cropRect) {
auto targetInfo = util::WindowInfo(targetWindow);
// TODO: Fix WindowInfo.h to not contain the null char at the end.
@@ -160,7 +158,6 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
Logger::trace(L"Creating a thumbnail window");
Trace::CropAndLock::CreateThumbnailWindow();
Trace::CropAndLock::ActivateThumbnail();
break;
default:
return;
@@ -203,9 +200,8 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
}
m_event_triggers_thread = std::thread([&]() {
MSG msg;
HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle};
HANDLE event_handles[3] = { m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle };
while (m_running)
{
DWORD dwEvt = MsgWaitForMultipleObjects(3, event_handles, false, INFINITE, QS_ALLINPUT);

View File

@@ -19,13 +19,8 @@ namespace ColorPickerUI
/// </summary>
public partial class App : Application, IDisposable
{
#pragma warning disable CA1051 // Do not declare visible instance fields
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
#pragma warning disable SA1401 // Accessible fields should begin with upper-case letter
public ETWTrace etwTrace = new ETWTrace();
#pragma warning restore SA1401 // Accessible fields should begin with upper-case letter
#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter
#pragma warning restore CA1051 // Do not declare visible instance fields
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
private Mutex _instanceMutex;
private static string[] _args;
private int _powerToysRunnerPid;
@@ -51,7 +46,7 @@ namespace ColorPickerUI
Logger.LogError("CultureNotFoundException: " + ex.Message);
}
etwTrace.Start();
EtwTrace.Start();
NativeThreadCTS = new CancellationTokenSource();
ExitToken = NativeThreadCTS.Token;
@@ -105,7 +100,7 @@ namespace ColorPickerUI
if (disposing)
{
_instanceMutex?.Dispose();
etwTrace?.Dispose();
EtwTrace?.Dispose();
}
disposedValue = true;

View File

@@ -3,10 +3,8 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Windows;
using ColorPicker.Helpers;
using ColorPickerUI;
using Common.UI;
using Wpf.Ui.Controls;

View File

@@ -7,8 +7,6 @@ using System.Windows;
using System.Windows.Interop;
using ColorPicker.ViewModelContracts;
using ColorPickerUI;
using Microsoft.PowerToys.Telemetry;
using Wpf.Ui.Controls;
namespace ColorPicker

View File

@@ -22,7 +22,7 @@ using namespace PowerRenameUI::implementation;
namespace fs = std::filesystem;
#define DEBUG_BENCHMARK_100K_ENTRIES
//#define DEBUG_BENCHMARK_100K_ENTRIES
std::vector<std::wstring> g_files;
@@ -121,7 +121,7 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
}
#ifdef DEBUG_BENCHMARK_100K_ENTRIES
const std::wstring_view ROOT_PATH = L"C:\\PowerRenameBenchmark";
const std::wstring_view ROOT_PATH = L"R:\\PowerRenameBenchmark";
std::wstring subdirectory_name = L"0";
std::error_code _;
@@ -136,7 +136,7 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
g_files.push_back(fs::path{ ROOT_PATH });
constexpr int pow2_threshold = 10;
constexpr int num_files = 10;
constexpr int num_files = 100'000;
for (int i = 0; i < num_files; ++i)
{
fs::path file_path{ ROOT_PATH };