Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5132,7 +5132,7 @@

std::string line;
int processors = 0;
bool in_section = false;

Check warning on line 5135 in src/vmaware.hpp

View workflow job for this annotation

GitHub Actions / Analyze (cpp, gcc-14, Ninja Multi-Config, Debug, ON)

variable 'in_section' set but not used [-Wunused-but-set-variable]
int cur_phys = -1, cur_core = -1;
std::vector<std::pair<int, int>> cores;

Expand Down Expand Up @@ -5637,7 +5637,9 @@

const HANDLE current_thread = reinterpret_cast<HANDLE>(-2LL);
const HANDLE current_process = reinterpret_cast<HANDLE>(-1LL);
SetThreadAffinityMask(current_thread, 1);
const DWORD_PTR old_affinity = SetThreadAffinityMask(current_thread, 1);
const int old_thread_priority = GetThreadPriority(current_thread);
const DWORD old_process_priority = GetPriorityClass(current_process);
SetPriorityClass(current_process, ABOVE_NORMAL_PRIORITY_CLASS); // ABOVE_NORMAL_PRIORITY_CLASS + THREAD_PRIORITY_HIGHEST = 12 base priority
SetThreadPriority(current_thread, THREAD_PRIORITY_HIGHEST);
SetThreadPriorityBoost(current_thread, TRUE); // disable dynamic boosts
Expand Down Expand Up @@ -5728,9 +5730,13 @@
}
}

// cleanup
SetThreadPriorityBoost(current_thread, FALSE);
SetThreadPriority(current_thread, old_thread_priority);
SetPriorityClass(current_process, old_process_priority);
SetThreadAffinityMask(current_thread, old_affinity);
VirtualUnlock(vm_samples.data(), BATCH_SIZE * sizeof(u64));
VirtualUnlock(ref_samples.data(), BATCH_SIZE * sizeof(u64));
SetPriorityClass(current_process, NORMAL_PRIORITY_CLASS);
};

std::thread t1(counter_thread);
Expand Down
Loading