3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-09 00:35:47 +00:00

Z3 sources

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-10-02 11:35:25 -07:00
parent 3f9edad676
commit e9eab22e5c
1186 changed files with 381859 additions and 0 deletions

41
lib/instruction_count.cpp Normal file
View file

@ -0,0 +1,41 @@
#ifdef _WINDOWS
#include "windows.h"
#endif
#include "instruction_count.h"
#ifdef _WINDOWS
typedef BOOL (WINAPI *QTCP)(HANDLE, PULONG64);
static QTCP QTCP_proc;
BOOL WINAPI dummy_qtcp(HANDLE h, PULONG64 u)
{
*u = 0;
return 0;
}
inline void check_handler()
{
if (!QTCP_proc) {
QTCP_proc = (QTCP) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "QueryThreadCycleTime");
if (!QTCP_proc)
QTCP_proc = &dummy_qtcp;
}
}
#endif
void instruction_count::start() {
m_count = 0;
#ifdef _WINDOWS
check_handler();
QTCP_proc(GetCurrentThread(), &m_count);
#endif
}
double instruction_count::get_num_instructions() {
unsigned long long current = 0;
#ifdef _WINDOWS
check_handler();
QTCP_proc(GetCurrentThread(), &current);
#endif
return static_cast<double>(current - m_count);
}