Exemple #1
0
// Gets the number of elapsed milliseconds.
// @returns The elapsed milliseconds.
int UnixTimer::GetElapsed()
{
  timespec currentTime;

  clock_gettime(CLOCK_MONOTONIC, &currentTime);
  
  int timeDifference = GetTimeDiff(startTime, currentTime);
  
  return timeDifference;
}
Exemple #2
0
// Gets the number of elapsed milliseconds.
// @returns The elapsed milliseconds.
int WindowsTimer::GetElapsed()
{
  LARGE_INTEGER currentTime;

  QueryPerformanceCounter(&currentTime);
  
  int timeDifference = GetTimeDiff(startTime, currentTime);
  
  return timeDifference;
}
Exemple #3
0
// Saves the current timer value and starts a new timer.
int UnixTimer::Tick()
{
  timespec currentTime;

  clock_gettime(CLOCK_MONOTONIC, &currentTime);
  
  int timeDifference = GetTimeDiff(startTime, currentTime);
  
  startTime.tv_sec = currentTime.tv_sec;
  startTime.tv_nsec = currentTime.tv_nsec;
  
  return timeDifference;
}
Exemple #4
0
void Engine::_Process(void)
{
    _layermgr->Update(GetCurFrameTime());
    objmgr->Update(GetTimeDiff(), GetTimeDiffF(), GetCurFrameTime());

    _resPoolTimer.Update(s_diffTimeReal);

    if(_resPoolTimer.Passed())
    {
        _resPoolTimer.Reset();
        resMgr.pool.Cleanup();
    }
}
GLOBALOSGLUPROC WaitForNextTick(void)
{
label_retry:
	CheckForSystemEvents();
	CheckForSavedTasks();
	if (ForceMacOff) {
		return;
	}

	if (CurSpeedStopped) {
		MyDrawChangesAndClear();
		WaitForTheNextEvent();
		goto label_retry;
	}

	if (ExtraTimeNotOver()) {
		si5b TimeDiff = GetTimeDiff();
		if (TimeDiff < 0) {
			/*
				FIXME:

				Implement this?

				struct timespec rqt;
				struct timespec rmt;

				rqt.tv_sec = 0;
				rqt.tv_nsec = (- TimeDiff) * 1000;

				(void) nanosleep(&rqt, &rmt);
			*/
		}
		goto label_retry;
	}

	if (CheckDateTime()) {
#if MySoundEnabled
		MySound_SecondNotify();
#endif
#if EnableDemoMsg
		DemoModeSecondNotify();
#endif
	}

	CheckMouseState();

	OnTrueTime = TrueEmulatedTime;
}
Exemple #6
0
void Eluna::RunScripts()
{
    uint32 oldMSTime = GetCurrTime();
    uint32 count = 0;

    ScriptList scripts;
    scripts.insert(scripts.end(), lua_extensions.begin(), lua_extensions.end());
    scripts.insert(scripts.end(), lua_scripts.begin(), lua_scripts.end());

    lua_getglobal(L, "package");
    luaL_getsubtable(L, -1, "loaded");
    int modules = lua_gettop(L);
    for (ScriptList::const_iterator it = scripts.begin(); it != scripts.end(); ++it)
    {
        lua_getfield(L, modules, it->modulepath.c_str());
        if (!lua_isnoneornil(L, -1))
        {
            lua_pop(L, 1);
            ELUNA_LOG_DEBUG("[Eluna]: Extension was already loaded or required `%s`", it->filepath.c_str());
            continue;
        }
        lua_pop(L, 1);
        if (!luaL_loadfile(L, it->filepath.c_str()) && !lua_pcall(L, 0, 1, 0))
        {
            if (!lua_toboolean(L, -1))
            {
                lua_pop(L, 1);
                Push(L, true);
            }
            lua_setfield(L, modules, it->modulepath.c_str());

            // successfully loaded and ran file
            ELUNA_LOG_DEBUG("[Eluna]: Successfully loaded `%s`", it->filepath.c_str());
            ++count;
            continue;
        }
        ELUNA_LOG_ERROR("[Eluna]: Error loading extension `%s`", it->filepath.c_str());
        report(L);
    }
    lua_pop(L, 2);

    ELUNA_LOG_INFO("[Eluna]: Executed %u Lua scripts in %u ms", count, GetTimeDiff(oldMSTime));
}
int Util::CheckMissedFrame(const std::string msg, XnUInt64& nTimestamp, XnUInt32* pFrames, XnUInt64* pLastTime, XnUInt32* pMissedFrames)
{
	int ret = 0;

	++(*pFrames);
//		printf("Timestamp(User):%d\n", nTimestamp);
//	if ((*pLastTime != 0) && ((nTimestamp - *pLastTime) > 35000))
	if ((*pLastTime != 0) && (GetTimeDiff(nTimestamp, *pLastTime) > 35))
	{
		int missed = (int)(nTimestamp - *pLastTime) / 32000 - 1;
		printf("Missed %s: %llu -> %llu = %d > 35000 - %d frames\n",
			msg.c_str(), *pLastTime, nTimestamp, XnUInt32(nTimestamp - *pLastTime), missed);
		*pMissedFrames += missed;

		ret = missed;
	}
	*pLastTime = nTimestamp;

	return ret;
}
LOCALPROC UpdateTrueEmulatedTime(void)
{
	si5b TimeDiff;

	GetCurrentTicks();

	TimeDiff = GetTimeDiff();
	if (TimeDiff >= 0) {
		if (TimeDiff > 4 * MyInvTimeStep) {
			/* emulation interrupted, forget it */
			++TrueEmulatedTime;
			InitNextTime();
		} else {
			do {
				++TrueEmulatedTime;
				IncrNextTime();
				TimeDiff -= TicksPerSecond;
			} while (TimeDiff >= 0);
		}
	} else if (TimeDiff < - 2 * MyInvTimeStep) {
		/* clock goofed if ever get here, reset */
		InitNextTime();
	}
}
Exemple #9
0
void  PALAPI Run_Thread (LPVOID lpParam)
{
    unsigned int i = 0;
    DWORD dwWaitResult; 

    struct statistics stats;
    DWORD dwStartTime;

	stats.relationId = RELATION_ID;
    stats.processId = USE_PROCESS_COUNT;
    stats.operationsFailed = 0;
    stats.operationsPassed = 0;
    stats.operationsTotal  = 0;
    stats.operationTime    = 0;

    int Id=(int)lpParam;
   
    dwWaitResult = WaitForSingleObject( 
                            StartTestsEvHandle,   // handle to start test handle
                            TIMEOUT);  

    if(dwWaitResult != WAIT_OBJECT_0)
    {
        Trace("Error:%d: while waiting for StartTest Event@ thread %d\n", GetLastError(), Id);
        testStatus = FAIL;
    }

    dwStartTime = GetTickCount();

    for( i = 0; i < REPEAT_COUNT; i++ )
    {
        dwWaitResult = WaitForSingleObject( 
                            hEventHandle,   // handle to Event
                            TIMEOUT);  

        if(dwWaitResult != WAIT_OBJECT_0)
        {
            //Trace("Error:%d: while waiting for onject @ thread %d, # iter %d\n", GetLastError(), Id, i);
	        stats.operationsFailed += 1;
            stats.operationsTotal  += 1;
            testStatus = FAIL;
            continue;
        }

        if (! SetEvent(hEventHandle)) 
        { 
            // Deal with error.
//            Trace("Error while setting Event @ thread %d # iter %d\n", Id, i);
            stats.operationsFailed += 1;
            stats.operationsTotal  += 1;
            // do we need to have while true loop to attempt to set event...?
            testStatus = FAIL;
            continue;
        } 

        stats.operationsTotal  += 1;
        stats.operationsPassed += 1;    
      //  Trace("Successs while setting Event @ iteration %d -> thread %d -> Process %d for handle %d\n", i, Id, USE_PROCESS_COUNT, hEventHandle);
        
    }
    
    stats.operationTime = GetTimeDiff(dwStartTime); 
    //Trace("OPeration time is %d", stats.operationTime );
    if(resultBuffer->LogResult(Id, (char *)&stats))
    {
        Fail("Error:%d: while writing to shared memory, Thread Id is[%d] and Process id is [%d]\n", GetLastError(), Id, USE_PROCESS_COUNT);
    }
    //Trace("Thread %d over for process %d\n", Id, USE_PROCESS_COUNT);
}
Exemple #10
0
 int __cdecl main(INT argc, CHAR **argv)
{
    unsigned int i = 0;
    HANDLE hThread[MAXIMUM_WAIT_OBJECTS];
    DWORD  threadId[MAXIMUM_WAIT_OBJECTS];

    WCHAR *wcObjName = NULL;

    char ObjName[MAX_PATH] = "SHARED_EVENT";
    DWORD dwParam = 0;

    int returnCode = 0;
    
    /* Variables to capture the file name and the file pointer at thread level*/
    char fileName[MAX_PATH];
    FILE *pFile = NULL;
    struct statistics* buffer = NULL;
    int statisticsSize = 0;

    /* Variables to capture the file name and the file pointer at process level*/
    char processFileName[MAX_PATH];
    FILE *pProcessFile = NULL;   
    struct ProcessStats processStats;
    DWORD dwStartTime;

    testStatus = PASS;

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return ( FAIL );
    }

    ZeroMemory( objectSuffix, MAX_PATH );

    if(GetParameters(argc, argv))
    {
        Fail("Error in obtaining the parameters\n");
    }
//    Trace("Process created, value of process count is [%d]\n", USE_PROCESS_COUNT);

    if(argc == 5)
    {
        strncat(ObjName, objectSuffix, MAX_PATH - (sizeof(ObjName) + 1) );
    }

     /* Register the start time */  
    dwStartTime = GetTickCount();
    processStats.relationId = RELATION_ID;
    processStats.processId  = USE_PROCESS_COUNT;

    _snprintf(processFileName, MAX_PATH, "%d_process_event_%d_.txt", USE_PROCESS_COUNT, RELATION_ID);
    pProcessFile = fopen(processFileName, "w+");
    if(pProcessFile == NULL)
    { 
        Fail("Error:%d: in opening Process File for write for process [%d]\n", GetLastError(), USE_PROCESS_COUNT);
    }

    statisticsSize = sizeof(struct statistics);

    _snprintf(fileName, MAX_PATH, "%d_thread_event_%d_.txt", USE_PROCESS_COUNT, RELATION_ID);
    pFile = fopen(fileName, "w+");
    
    if(pFile == NULL)
    { 
        Fail("Error:%d: in opening thread file for write for process [%d]\n", GetLastError(), USE_PROCESS_COUNT);
    }
    // For each thread we will log operations failed (int), passed (int), total (int)
    // and number of ticks (DWORD) for the operations
    resultBuffer = new ResultBuffer( THREAD_COUNT, statisticsSize);

    wcObjName = convert(ObjName);

    StartTestsEvHandle  = CreateEvent( NULL, /* lpEventAttributes*/
                                        TRUE,  /* bManualReset */
                                        FALSE,   /* bInitialState */
                                        NULL);  /* name of Event */

    if( StartTestsEvHandle  == NULL )
    {
        Fail("Error:%d: Unexpected failure "
            "to create %s Event for process count %d\n", GetLastError(), sTmpEventName, USE_PROCESS_COUNT );
  
    }

    /* Create StartTest Event */

    hEventHandle = OpenEventW(
                                EVENT_ALL_ACCESS, /* lpEventAttributes, inheritable to child processes*/
                                FALSE,  /* bAutomaticReset */
                                wcObjName  
                               );
            
    if( hEventHandle == NULL)
    {
        Fail("Unable to create Event handle for process id [%d], returned error [%d]\n", i, GetLastError());
    }
    /* We already assume that the Event was created previously*/

    for( i = 0; i < THREAD_COUNT; i++ )
    {
        dwParam = (int) i;
        //Create thread
        hThread[i] = CreateThread(
                                    NULL,                   /* no security attributes */
                                    0,                      /* use default stack size */
                                    (LPTHREAD_START_ROUTINE)Run_Thread,/* thread function */
                                    (LPVOID)dwParam,  /* argument to thread function */
                                    0,                      /* use default creation flags  */
                                    &threadId[i]     /* returns the thread identifier*/                                  
                                  );
  
        if(hThread[i] == NULL)
        {
            Fail("Create Thread failed for %d process, and GetLastError value is %d\n", USE_PROCESS_COUNT, GetLastError());
        }
    
    }

    if (!SetEvent(StartTestsEvHandle))
    {
        Fail("Set Event for Start Tests failed for %d process, and GetLastError value is %d\n", USE_PROCESS_COUNT, GetLastError());           
    }

    /* Test running */
    returnCode = WaitForMultipleObjects( THREAD_COUNT, hThread, TRUE, INFINITE);  

    if( WAIT_OBJECT_0 != returnCode )
    {
        Trace("Wait for Object(s) for %d process returned %d, and GetLastError value is %d\n", USE_PROCESS_COUNT, returnCode, GetLastError());
        testStatus = FAIL;
    }
    
    processStats.operationTime = GetTimeDiff(dwStartTime);  

    /* Write to a file*/
    if(pFile!= NULL)
    { 
        for( i = 0; i < THREAD_COUNT; i++ )
        {  
            buffer = (struct statistics *)resultBuffer->getResultBuffer(i);
            returnCode = fprintf(pFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId );
//            Trace("Iteration %d over\n", i);
            
        }
    }

    if(fclose(pFile))
    {
        Trace("Error: fclose failed for pFile at Process %d\n", USE_PROCESS_COUNT);
        testStatus = FAIL;
    }

    fprintf(pProcessFile, "%d,%d,%d\n", USE_PROCESS_COUNT, processStats.operationTime, processStats.relationId );
    if(fclose(pProcessFile))
    {
        Trace("Error: fclose failed for pProcessFile at Process %d\n", USE_PROCESS_COUNT);
        testStatus = FAIL;
    }
    /* Logging for the test case over, clean up the handles */

//    Trace("Test Thread %d done\n", USE_PROCESS_COUNT);
    
    for( i = 0; i < THREAD_COUNT; i++ )
    {
        if(!CloseHandle(hThread[i]) )
        {
            Trace("Error:%d: CloseHandle failed for Process [%d] hThread[%d]\n", GetLastError(), USE_PROCESS_COUNT, i);
            testStatus = FAIL;
        }
    }

    if(!CloseHandle(StartTestsEvHandle))
    {
        Trace("Error:%d: CloseHandle failed for Process [%d] StartTestsEvHandle\n", GetLastError(), USE_PROCESS_COUNT);
        testStatus = FAIL;
    }

    if(!CloseHandle(hEventHandle))
    {
        Trace("Error:%d: CloseHandle failed for Process [%d] hEventHandle\n", GetLastError(), USE_PROCESS_COUNT);
        testStatus = FAIL;
    } 

    free(wcObjName);
    PAL_Terminate();
    return testStatus;
}
Exemple #11
0
void Eluna::Initialize()
{
    uint32 oldMSTime = GetCurrTime();

    lua_scripts.clear();
    lua_extensions.clear();

    lua_folderpath = eConfigMgr->GetStringDefault("Eluna.ScriptPath", "lua_scripts");
#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE
    if (lua_folderpath[0] == '~')
        if (const char* home = getenv("HOME"))
            lua_folderpath.replace(0, 1, home);
#endif
    ELUNA_LOG_INFO("[Eluna]: Searching scripts from `%s`", lua_folderpath.c_str());
    GetScripts(lua_folderpath + "/extensions", lua_extensions);
    GetScripts(lua_folderpath, lua_scripts);

    ELUNA_LOG_DEBUG("[Eluna]: Loaded %u scripts in %u ms", uint32(lua_scripts.size()), GetTimeDiff(oldMSTime));

    // Create global eluna
    new Eluna();
}
Exemple #12
0
void RunTests(
        PerfTest* tests,
        size_t testCount
        )
{
    size_t testIndex;
    BOOL passed;
    PVOID runArg;
    struct timespec startTime = {0};
    struct timespec endTime = {0};
    int result;
    int runNum;

    for (testIndex = 0; testIndex < testCount; testIndex++)
    {
        printf("Running: %s\n", tests[testIndex].description);

        runArg = NULL;
        if (tests[testIndex].setup != NULL)
        {
            passed = tests[testIndex].setup(
                    tests[testIndex].setupArg,
                    &runArg);
            if (!passed)
            {
                printf("Failed\n");
                continue;
            }
        }

        if (tests[testIndex].run == NULL)
        {
            printf("Error: test function is null\n");
            continue;
        }

        result = clock_gettime(CLOCK_REALTIME, &startTime);
        if (result < 0)
        {
            perror("clock_gettime");
            return;
        }

        switch (tests[testIndex].type)
        {
            case TEST_TYPE_RUNS_PER_SEC:
                runNum = 0;
                do
                {
                    do
                    {
                        passed = tests[testIndex].run(
                                runArg);
                        runNum++;
                    } while (passed && runNum % 10 != 0);

                    result = clock_gettime(CLOCK_REALTIME, &endTime);
                    if (result < 0)
                    {
                        perror("clock_gettime");
                        return;
                    }
                } while (passed &&
                        GetTimeDiff(&endTime, &startTime) < 10 * (int64_t)1000000000);

                if (passed)
                {
                    printf("Result: %f calls per second\n", runNum /
                            (GetTimeDiff(&endTime, &startTime) / 1000000000.0));
                }
                else
                {
                    printf("Failed\n");
                }
                break;

            case TEST_TYPE_SINGLE_RUN:
                passed = tests[testIndex].run(
                        runArg);
                result = clock_gettime(CLOCK_REALTIME, &endTime);
                if (result < 0)
                {
                    perror("clock_gettime");
                    return;
                }

                if (passed)
                {
                    printf("Result: %f seconds\n",
                            (GetTimeDiff(&endTime, &startTime) / 1000000000.0));
                }
                else
                {
                    printf("Failed\n");
                }
                break;

            default:
                printf("Unknown test type %d\n", tests[testIndex].type);
                return;
        }
        if (tests[testIndex].cleanup != NULL)
        {
            tests[testIndex].cleanup(runArg);
        }
    }
}
Exemple #13
0
 int __cdecl main(INT argc, CHAR **argv)
{
    unsigned int i = 0;
    HANDLE hProcess[MAXIMUM_WAIT_OBJECTS];
   
    STARTUPINFO si[MAXIMUM_WAIT_OBJECTS];
    PROCESS_INFORMATION pi[MAXIMUM_WAIT_OBJECTS];

    char lpCommandLine[MAX_PATH] = "";

    int returnCode = 0;
    DWORD processReturnCode = 0;
    int testReturnCode = PASS;

    char fileName[MAX_PATH];
    FILE *pFile = NULL;
    DWORD dwStartTime;
    struct TestStats testStats;

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return ( FAIL );
    }

    if(GetParameters(argc, argv))
    {
        Fail("Error in obtaining the parameters\n");
    }

     /* Register the start time */  
    dwStartTime = GetTickCount();
    testStats.relationId = 0;
    testStats.relationId   = RELATION_ID;
    testStats.processCount = PROCESS_COUNT;
    testStats.threadCount  = THREAD_COUNT;
    testStats.repeatCount  = REPEAT_COUNT;
    testStats.buildNumber  = getBuildNumber();



    _snprintf(fileName, MAX_PATH, "main_wfmo_%d_.txt",testStats.relationId);
    pFile = fopen(fileName, "w+");
    if(pFile == NULL)
    { 
        Fail("Error in opening main file for write\n");
    }

    for( i = 0; i < PROCESS_COUNT; i++ )
    {

        ZeroMemory( lpCommandLine, MAX_PATH );
        if ( _snprintf( lpCommandLine, MAX_PATH-1, "mutex %d %d %d %d %d", i, THREAD_COUNT, REPEAT_COUNT, SLEEP_LENGTH, RELATION_ID) < 0 )
        {
            Trace ("Error: Insufficient commandline string length for for iteration [%d]\n", i);
        }
        
        /* Zero the data structure space */
        ZeroMemory ( &pi[i], sizeof(pi[i]) );
        ZeroMemory ( &si[i], sizeof(si[i]) );

        /* Set the process flags and standard io handles */
        si[i].cb = sizeof(si[i]);
        
        //Create Process
        if(!CreateProcess( NULL, /* lpApplicationName*/
                          lpCommandLine, /* lpCommandLine */
                          NULL, /* lpProcessAttributes  */
                          NULL, /* lpThreadAttributes */
                          TRUE, /* bInheritHandles */
                          0, /* dwCreationFlags, */
                          NULL, /* lpEnvironment  */
                          NULL, /* pCurrentDirectory  */
                          &si[i], /* lpStartupInfo  */
                          &pi[i] /* lpProcessInformation  */
                          ))
        {
            Fail("Process Not created for [%d], the error code is [%d]\n", i, GetLastError());
        }
        else
        {
            hProcess[i] = pi[i].hProcess;
            // Trace("Process created for [%d]\n", i);
        }

    }

    returnCode = WaitForMultipleObjects( PROCESS_COUNT, hProcess, TRUE, INFINITE);  
    if( WAIT_OBJECT_0 != returnCode )
    {
        Trace("Wait for Object(s) @ Main thread for %d processes returned %d, and GetLastError value is %d\n", PROCESS_COUNT, returnCode, GetLastError());
    }
    
    for( i = 0; i < PROCESS_COUNT; i++ )
    {
        /* check the exit code from the process */
        if( ! GetExitCodeProcess( pi[i].hProcess, &processReturnCode ) )
        {
            Trace( "GetExitCodeProcess call failed for iteration %d with error code %u\n", 
                i, GetLastError() ); 
           
            testReturnCode = FAIL;
        }

        if(processReturnCode == FAIL)
        {
            Trace( "Process [%d] failed and returned FAIL\n", i); 
            testReturnCode = FAIL;
        }

        if(!CloseHandle(pi[i].hThread))
        {
            Trace("Error:%d: CloseHandle failed for Process [%d] hThread\n", GetLastError(), i);
        }

        if(!CloseHandle(pi[i].hProcess) )
        {
            Trace("Error:%d: CloseHandle failed for Process [%d] hProcess\n", GetLastError(), i);
        }
    }

    testStats.operationTime = GetTimeDiff(dwStartTime); 
    fprintf(pFile, "%d,%d,%d,%d,%d,%s\n", testStats.operationTime, testStats.relationId, testStats.processCount, testStats.threadCount, testStats.repeatCount, testStats.buildNumber);
    if(fclose(pFile))
    {
        Trace("Error: fclose failed for pFile\n");
        testReturnCode = FAIL;
    }
    
    if( testReturnCode == PASS)
    {
        Trace("Test Passed\n");
    }
    else
    {
        Trace("Test Failed\n");
    }
    PAL_Terminate();
    return testReturnCode;
}
Exemple #14
0
void  PALAPI Run_Thread (LPVOID lpParam)
{
    unsigned int i = 0;
    DWORD dwWaitResult; 

    struct statistics stats;
    DWORD dwStartTime;

	stats.relationId = RELATION_ID;
    stats.processId = USE_PROCESS_COUNT;
    stats.operationsFailed = 0;
    stats.operationsPassed = 0;
    stats.operationsTotal  = 0;
    stats.operationTime    = 0;

    int Id=(int)lpParam;
    
    dwWaitResult = WaitForSingleObject( 
                            StartTestsEvHandle,   // handle to mutex
                            TIMEOUT);  

    if(dwWaitResult != WAIT_OBJECT_0)
    {
        Trace("Error while waiting for StartTest Event@ thread %d\n", Id);
        testStatus = FAIL;
    }

    dwStartTime = GetTickCount();

    for( i = 0; i < REPEAT_COUNT; i++ )
    {
        dwWaitResult = WaitForSingleObject( 
                            hMutexHandle,   // handle to mutex
                            TIMEOUT);  

        if(dwWaitResult != WAIT_OBJECT_0)
        {
//            Trace("Error while waiting for onject @ thread %d, # iter %d, Error Returned [%d]\n", Id, i, GetLastError());
            stats.operationsFailed += 1;
            stats.operationsTotal  += 1;
            testStatus = FAIL;
            continue;
        }
        if (! ReleaseMutex(hMutexHandle)) 
        { 
            // Deal with error.
//            Trace("Error while releasing mutex @ thread %d # iter %d\n", Id, i);
            stats.operationsFailed += 1;
            stats.operationsTotal  += 1;
            // Probably need to have while true loop to attempt to release mutex...
            testStatus = FAIL;
            continue;
        } 
    
        stats.operationsTotal  += 1;
        stats.operationsPassed += 1;  
//        Trace("Successs while releasing mutex @ iteration %d -> thread %d -> Process count %d\n", i, Id, USE_PROCESS_COUNT);
        
    }
    stats.operationTime = GetTimeDiff(dwStartTime); 
    if(resultBuffer->LogResult(Id, (char *)&stats))
    {
        Fail("Error:%d: while writing to shared memory, Thread Id is[%d] and Process id is [%d]\n", GetLastError(), Id, USE_PROCESS_COUNT);
    }
}