Minor : upgrade profiler utils to use the logging functions
This commit is contained in:
parent
7e6761e968
commit
87646463b8
@ -81,3 +81,16 @@ void StkTime::getDate(int *day, int *month, int *year)
|
|||||||
if(month) *month = now->tm_mon + 1;
|
if(month) *month = now->tm_mon + 1;
|
||||||
if(year) *year = now->tm_year + 1900;
|
if(year) *year = now->tm_year + 1900;
|
||||||
} // getDate
|
} // getDate
|
||||||
|
|
||||||
|
StkTime::ScopeProfiler::ScopeProfiler(const char* name)
|
||||||
|
{
|
||||||
|
Log::info("ScopeProfiler", "%s {\n", name);
|
||||||
|
m_time = (float)getRealTime();
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
StkTime::ScopeProfiler::~ScopeProfiler()
|
||||||
|
{
|
||||||
|
float f2 = (float)getRealTime();
|
||||||
|
Log::info("ScopeProfiler", "} // took %f s (%s)\n", (f2 - m_time), m_name.c_str());
|
||||||
|
}
|
@ -136,18 +136,10 @@ public:
|
|||||||
class ScopeProfiler
|
class ScopeProfiler
|
||||||
{
|
{
|
||||||
float m_time;
|
float m_time;
|
||||||
|
std::string m_name;
|
||||||
public:
|
public:
|
||||||
ScopeProfiler(const char* name)
|
ScopeProfiler(const char* name);
|
||||||
{
|
~ScopeProfiler();
|
||||||
printf("%s {\n", name);
|
|
||||||
m_time = (float)getRealTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
~ScopeProfiler()
|
|
||||||
{
|
|
||||||
float f2 = (float)getRealTime();
|
|
||||||
printf("} // took %f s\n", (f2 - m_time));
|
|
||||||
}
|
|
||||||
}; // class ScopeProfiler
|
}; // class ScopeProfiler
|
||||||
|
|
||||||
}; // namespace time
|
}; // namespace time
|
||||||
|
Loading…
Reference in New Issue
Block a user