-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
156 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "GreenWorldApp.hpp" | ||
#include "GLRenderSettings.hpp" | ||
|
||
namespace GW | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "Benchmark.hpp" | ||
|
||
namespace Engine | ||
{ | ||
// ----- Private ----- | ||
|
||
void Benchmark::End() | ||
{ | ||
//If benchmark file doesn't exist, create it | ||
|
||
//Append monitored values | ||
|
||
Logger::Info("Logged", "File", _filename); | ||
} | ||
|
||
// ----- Public ----- | ||
|
||
void Benchmark::Start(const std::string& appName, const uint32 time_msec) | ||
{ | ||
//Init variables | ||
_isRunning = true; | ||
_appName = appName; | ||
_count = 0; | ||
_avg = 0.0; | ||
_min = FLT_MAX; | ||
_max = FLT_MIN; | ||
_timer = MakeScope<Timer>(time_msec); | ||
|
||
Logger::Info("Started", "Benchmark", _appName); | ||
} | ||
|
||
void Benchmark::AddFrame(const double dt_msec) | ||
{ | ||
_timer->Update(dt_msec); | ||
|
||
//Check if timer has elapsed, else monitor values | ||
if(_timer->CheckElapsedAndReset() == true) | ||
{ | ||
//Calculate average, end benchmark and reset states | ||
_avg /= (double)_count; | ||
End(); | ||
_isRunning = false; | ||
UIParams::runBenchmark = false; | ||
|
||
Logger::Info("Finished", "Benchmark", _appName); | ||
} | ||
else | ||
{ | ||
_count++; | ||
_avg += dt_msec; | ||
|
||
if(_min > dt_msec) | ||
_min = dt_msec; | ||
|
||
if(_max < dt_msec) | ||
_max = dt_msec; | ||
} | ||
} | ||
|
||
bool Benchmark::IsRunning() | ||
{ | ||
return _isRunning; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "Timer.hpp" | ||
#include "Logger.hpp" | ||
#include "GlobalParams.hpp" | ||
|
||
#include <string> | ||
|
||
namespace Engine | ||
{ | ||
class Benchmark | ||
{ | ||
private: | ||
inline static constexpr const char* _filename = "Benchmark.md"; | ||
|
||
inline static bool _isRunning = bool(); | ||
inline static std::string _appName = std::string(); | ||
inline static uint64 _count = uint64(); | ||
inline static double _avg = double(), _min = double(), _max = double(); | ||
inline static Scope<Timer> _timer; | ||
|
||
static void End(); | ||
|
||
public: | ||
Benchmark() = delete; | ||
static void Start(const std::string& appName, uint32 time_msec); | ||
static void AddFrame(double dt_msec); | ||
|
||
[[nodiscard]] static bool IsRunning(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "GridRenderer.hpp" | ||
#include "Utility.hpp" | ||
|
||
namespace Engine | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters