<commit_before>/************************************************************************************\
This source file is part of the Awesome Portable Rendering Interface Library         *
For latest info, see http://libapril.sourceforge.net/                                *
**************************************************************************************
Copyright (c) 2010 <NAME> (<EMAIL>)                                  *
*                                                                                    *
* This program is free software; you can redistribute it and/or modify it under      *
* the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php   *
\************************************************************************************/
#include "Timer.h"

namespace April
{
    Timer::Timer()
    {
        mDt = 0;
        mTd2 = 0;
        mTd = 0;
        mFrequency = 0;
        mPerformanceTimerStart = 0;
        mResolution = 0;
        mMmTimerStart = 0;
        mMmTimerElapsed = 0;
        mPerformanceTimerElapsed = 0;
        mPerformanceTimer = 0;
        
        if (!QueryPerformanceFrequency((LARGE_INTEGER *) &mFrequency))
        {
            printf("[april] performance timer not available, multimedia timer will be used instead!\n");
            mPerformanceTimer	= FALSE;
            mMmTimerStart	    = timeGetTime();
            mResolution		    = 1.0f/1000.0f;
            mFrequency			= 1000;
            mMmTimerElapsed	    = mMmTimerStart;
        }
        else
        {
            printf("[april] performance timer will be used.\n");
            QueryPerformanceCounter((LARGE_INTEGER *) &mPerformanceTimerStart);
            mPerformanceTimer		    = TRUE;
            mResolution				    = (float) (((double)1.0f)/((double)mFrequency));
            mPerformanceTimerElapsed	= mPerformanceTimerStart;
        }
            
        
    }
    
    Timer::~Timer()
    {
        
    }
    
    float Timer::getTime()
    {
        __int64 time;
        if (mPerformanceTimer)
        {
            QueryPerformanceCounter((LARGE_INTEGER *) &time);
            return ( (float) ( time - mPerformanceTimerStart) * mResolution)*1000.0f;
        }
        else
        {
            return( (float) ( timeGetTime() - mMmTimerStart) * mResolution)*1000.0f;
        }
    }
    
    float Timer::diff(bool update)
    {
        if(update)
        {
            this->update();
            return mDt;
        }
        else
            return mDt;
        
    }
    
    void Timer::update()
    {
        mTd2 = getTime();
        mDt = (mTd2-mTd) * 0.1f;
        mTd = mTd2;
    }
}
<commit_msg>changed log messages to rendersys->logMessage in WinTimer<commit_after>/************************************************************************************\
This source file is part of the Awesome Portable Rendering Interface Library         *
For latest info, see http://libapril.sourceforge.net/                                *
**************************************************************************************
Copyright (c) 2010 <NAME> (<EMAIL>)                                  *
*                                                                                    *
* This program is free software; you can redistribute it and/or modify it under      *
* the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php   *
\************************************************************************************/
#include "Timer.h"
#include "RenderSystem.h"

namespace April
{
    Timer::Timer()
    {
        mDt = 0;
        mTd2 = 0;
        mTd = 0;
        mFrequency = 0;
        mPerformanceTimerStart = 0;
        mResolution = 0;
        mMmTimerStart = 0;
        mMmTimerElapsed = 0;
        mPerformanceTimerElapsed = 0;
        mPerformanceTimer = 0;
        
        if (!QueryPerformanceFrequency((LARGE_INTEGER *) &mFrequency))
        {
            rendersys->logMessage("performance timer not available, multimedia timer will be used instead!");
            mPerformanceTimer	= FALSE;
            mMmTimerStart	    = timeGetTime();
            mResolution		    = 1.0f/1000.0f;
            mFrequency			= 1000;
            mMmTimerElapsed	    = mMmTimerStart;
        }
        else
        {
            QueryPerformanceCounter((LARGE_INTEGER *) &mPerformanceTimerStart);
            mPerformanceTimer		    = TRUE;
            mResolution				    = (float) (((double)1.0f)/((double)mFrequency));
            mPerformanceTimerElapsed	= mPerformanceTimerStart;
        }
            
        
    }
    
    Timer::~Timer()
    {
        
    }
    
    float Timer::getTime()
    {
        __int64 time;
        if (mPerformanceTimer)
        {
            QueryPerformanceCounter((LARGE_INTEGER *) &time);
            return ( (float) ( time - mPerformanceTimerStart) * mResolution)*1000.0f;
        }
        else
        {
            return( (float) ( timeGetTime() - mMmTimerStart) * mResolution)*1000.0f;
        }
    }
    
    float Timer::diff(bool update)
    {
        if(update)
        {
            this->update();
            return mDt;
        }
        else
            return mDt;
        
    }
    
    void Timer::update()
    {
        mTd2 = getTime();
        mDt = (mTd2-mTd) * 0.1f;
        mTd = mTd2;
    }
}

{'fraction_non_alphanumeric': 0.17681159420289855, 'fraction_numerical': 0.016304347826086956, 'mean_word_length': 1.5348943985307621, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '182895', 'n_tokens_mistral': 1605, 'n_tokens_neox': 1415, 'n_words': 295}