I have these 2 functions that are used to measure the performance for a single threaded function.
#include <Windows.h>
#include <intrin.h>
typedef unsigned __int64 prof_time_t;
void inline start_measure(prof_time_t & cycle_read)
{
SetProcessAffinityMask(GetCurrentProcess(), 1);
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
int a[4], b = 1;
__cpuid(a, b);
cycle_read = __rdtsc();
}
void inline end_measure(prof_time_t & cycle_read)
{
unsigned int c;
cycle_read = __rdtscp(&c);
int a[4], b = 1;
__cpuid(a, b);
}
But now that I am doing a multithreaded function, I realise that I'm not sure how to convert this function to account for the various threads. I am using open mp for the multithreading.
I looked for a solution but still not very sure how I should go about with editing my function to account for openmp threads.
Measuring time in a multithreaded C++ application
I'm not very strong with multi-threading, so I'm a little lost with this, please help :(
All help is appreciated, thank you!!