in src/CodeAbortTimings/CodeAbortTimings.cpp [209:251]
void runExp(int id, F victimFunc, const void* target, int victimCore, int attackerCore, const string name)
{
// clear histograms
//e.clear();
t.clear();
// create victim and attacker threads
runAttacker = true;
auto attacker = CreateThread(
NULL,
0,
attack,
(LPVOID)target,
CREATE_SUSPENDED,
NULL
);
if (!attacker) throw "Arg.";
if (!SetThreadAffinityMask(attacker, 1ull << attackerCore)) throw "Arg.";
ResumeThread(attacker);
auto victim = CreateThread(
NULL,
0,
execLoop,
(LPVOID)victimFunc,
CREATE_SUSPENDED,
NULL
);
if (!victim) throw "Arg.";
if (!SetThreadAffinityMask(victim, 1ull << victimCore)) throw "Arg.";
ResumeThread(victim);
if (WaitForSingleObject(victim, INFINITE) == WAIT_FAILED) throw "Waiting failed.";
runAttacker = false;
if (WaitForSingleObject(attacker, INFINITE) == WAIT_FAILED) throw "Waiting failed.";
cout << "Exp. " << id << ": " << name << "\n";
//writeToDisk(t, id);
cout << t;
cout << "\n";
}