Can this help timing?
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
int main(int argc, char **argv)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
FILETIME ftCreationTime, ftExitTime, ftKernelTime, ftUserTime;
SYSTEMTIME stTime;
long long ll, *pLL1, *pLL2;
char *lpszCmdLine, *pChar;
pChar = GetCommandLine();
if (*pChar == '"') {
pChar++;
while (*pChar && *pChar != '"')
pChar++;
pChar++;
} else {
while (*pChar && *pChar != ' ')
pChar++;
}
while (*pChar && *pChar <= ' ')
pChar++;
ftExitTime.dwHighDateTime = 0;
ftExitTime.dwLowDateTime = 0;
memset(&si, 0, sizeof(si));
si.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, pChar, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
{
WaitForSingleObject(pi.hProcess, INFINITE);
GetProcessTimes(pi.hProcess, &ftCreationTime, &ftExitTime, &ftKernelTime, &ftUserTime);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
ll = *((long long*)&ftExitTime) - *((long long*)&ftCreationTime);
FileTimeToSystemTime(((FILETIME*)&ll), &stTime);
printf("%d:%d.%d %lld\n", stTime.wMinute, stTime.wSecond, stTime.wMilliseconds, ll);
} else printf("error\n");
return 0;
}
Or AddIn ?
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <addin.h>
static HWND g_hwndMain = NULL;
BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{
return TRUE;
}
ADDINAPI BOOL WINAPI AddInMain(HWND hwnd, ADDIN_EVENT eEvent)
{
TCHAR szTmp[100];
static DWORD dwStart, dwEnd;
switch (eEvent)
{
case AIE_APP_CREATE:
g_hwndMain = hwnd;
return TRUE;
case AIE_PRJ_STARTBUILD:
dwStart = GetTickCount();
return TRUE;
case AIE_PRJ_ENDBUILD:
dwEnd = GetTickCount();
wsprintf(szTmp, "%dms", dwEnd - dwStart);
AddIn_WriteOutput(g_hwndMain, szTmp);
return TRUE;
default:
return TRUE;
}
}