commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
39
include/framework/timing/benchmark.cpp
Normal file
39
include/framework/timing/benchmark.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "timing/benchmark.h"
|
||||
#include "sort/sort.h"
|
||||
#include "platform.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Benchmark::Start()
|
||||
{
|
||||
r_clock = Platform::Get().GetTime();
|
||||
}
|
||||
void Benchmark::Stop()
|
||||
{
|
||||
Time c_clock = Platform::Get().GetTime();
|
||||
|
||||
t_clock += c_clock - r_clock;
|
||||
r_clock = c_clock;
|
||||
}
|
||||
float Benchmark::GetMs() const
|
||||
{ return avg.GetMedian(); }
|
||||
void Benchmark::Reset()
|
||||
{
|
||||
avg.LogValue(t_clock.toMs());
|
||||
t_clock.setSec(0);
|
||||
}
|
||||
|
||||
Benchmark::Benchmark(bool start)
|
||||
{
|
||||
if (start)
|
||||
Start();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
53
include/framework/timing/loop_benchmark.cpp
Normal file
53
include/framework/timing/loop_benchmark.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "timing/loop_benchmark.h"
|
||||
#include "platform.h"
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void LoopBenchmark::MarkLoop()
|
||||
{
|
||||
++loop_count;
|
||||
|
||||
Time c_time = Platform::Get().GetTime();
|
||||
|
||||
t_time += c_time - r_time;
|
||||
r_time = c_time;
|
||||
|
||||
float t_ms = t_time.toMs();
|
||||
|
||||
if (t_ms > 1000.f)
|
||||
{
|
||||
ms = t_ms / loop_count;
|
||||
|
||||
loop_count = 0;
|
||||
t_time.setSec(0);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
float LoopBenchmark::GetMs() const
|
||||
{ return ms; }
|
||||
float LoopBenchmark::GetFps() const
|
||||
{ return ms ? 1000.f / ms : 0.f; }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void LoopBenchmark::Reset()
|
||||
{
|
||||
ms = 0.f;
|
||||
|
||||
loop_count = 0;
|
||||
|
||||
r_time = Platform::Get().GetTime();
|
||||
t_time.setSec(0);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user