Get current memory usage in bytes
| 55 | |
| 56 | // Get current memory usage in bytes |
| 57 | size_t get_memory_usage() |
| 58 | { |
| 59 | #ifdef _WIN32 |
| 60 | PROCESS_MEMORY_COUNTERS_EX pmc; |
| 61 | GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS *)&pmc, sizeof(pmc)); |
| 62 | return pmc.WorkingSetSize; |
| 63 | #else |
| 64 | struct rusage usage; |
| 65 | getrusage(RUSAGE_SELF, &usage); |
| 66 | return usage.ru_maxrss * 1024; // Convert KB to bytes on Linux |
| 67 | #endif |
| 68 | } |
| 69 | |
| 70 | // Precise busy wait function - waits for specified nanoseconds |
| 71 | void busy_wait_ns(int64_t nanoseconds) |
no outgoing calls
no test coverage detected