Add timer to print how long the generation took
This commit is contained in:
@@ -31,6 +31,6 @@ $(OBJPATH)/IncludeDeps.o : src/IncludeDeps.cpp src/IncludeDeps.h
|
|||||||
$(OBJPATH)/Makefile.o : src/Makefile.cpp src/Common.h src/IncludeDeps.h src/Makefile.h src/ConfigFile.h
|
$(OBJPATH)/Makefile.o : src/Makefile.cpp src/Common.h src/IncludeDeps.h src/Makefile.h src/ConfigFile.h
|
||||||
$(info -[75%]- $<)
|
$(info -[75%]- $<)
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
$(OBJPATH)/main.o : src/main.cpp src/Common.h src/ConfigFile.h src/IncludeDeps.h src/Makefile.h
|
$(OBJPATH)/main.o : src/main.cpp src/Common.h src/ConfigFile.h src/IncludeDeps.h src/Makefile.h src/Timer.h
|
||||||
$(info -[100%]- $<)
|
$(info -[100%]- $<)
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|||||||
+4
-1
@@ -7,9 +7,12 @@
|
|||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#define STR(x) STRINGIFY(x)
|
#define STR(x) STRINGIFY(x)
|
||||||
|
|
||||||
|
// Major changes, probably not be backwards compatible
|
||||||
#define MAKEGEN_VERSION_MAJOR 1
|
#define MAKEGEN_VERSION_MAJOR 1
|
||||||
|
// Release , should be backwards compatible with any minor version
|
||||||
#define MAKEGEN_VERSION_RELEASE 0
|
#define MAKEGEN_VERSION_RELEASE 0
|
||||||
#define MAKEGEN_VERSION_MINOR 4
|
// Minor changes, should be compatible with any other minor version with same major and release.
|
||||||
|
#define MAKEGEN_VERSION_MINOR 5
|
||||||
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
||||||
|
|
||||||
const static unsigned int FLAG_HELP = BIT(0);
|
const static unsigned int FLAG_HELP = BIT(0);
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
class Timer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> m_start;
|
||||||
|
public:
|
||||||
|
Timer(){
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
m_start = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
|
|
||||||
|
float Elapsed()
|
||||||
|
{
|
||||||
|
return std::chrono::duration_cast<std::chrono::duration<float,std::milli>>(std::chrono::high_resolution_clock::now() - m_start).count() / 1000.0f;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,10 +4,12 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <cmath>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "IncludeDeps.h"
|
#include "IncludeDeps.h"
|
||||||
#include "ConfigFile.h"
|
#include "ConfigFile.h"
|
||||||
#include "Makefile.h"
|
#include "Makefile.h"
|
||||||
|
#include "Timer.h"
|
||||||
|
|
||||||
void GenMakefile()
|
void GenMakefile()
|
||||||
{
|
{
|
||||||
@@ -70,7 +72,9 @@ int main(int argc, char** argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LOG_INFO("Generating Makefile...");
|
LOG_INFO("Generating Makefile...");
|
||||||
|
Timer timer;
|
||||||
GenMakefile();
|
GenMakefile();
|
||||||
|
LOG_INFO("Took ", round(timer.Elapsed()*1000.0)/1000.0,"s");
|
||||||
LOG_INFO("Running Makefile...");
|
LOG_INFO("Running Makefile...");
|
||||||
for(int i = 1;i<argc;i++)
|
for(int i = 1;i<argc;i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user