【重构】目录结构调整
This commit is contained in:
20
src/util/TimeCount.cpp
Normal file
20
src/util/TimeCount.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "TimeCount.h"
|
||||
#include <iostream>
|
||||
|
||||
USE_TIME::USE_TIME(std::string str) :
|
||||
strTmp(str)
|
||||
{
|
||||
start = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
USE_TIME::~USE_TIME()
|
||||
{
|
||||
end = std::chrono::system_clock::now();
|
||||
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
|
||||
std::cout << strTmp << "\t" << float(duration.count()*1.0) * std::chrono::milliseconds::period::num << "ms \t\n";
|
||||
|
||||
//auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
//std::cout << strTmp << "\t" << float(duration.count()*1.0) * std::chrono::microseconds::period::num << "ms \t\n";
|
||||
}
|
||||
|
||||
18
src/util/TimeCount.h
Normal file
18
src/util/TimeCount.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef TIME_COUNT_H
|
||||
#define TIME_COUNT_H
|
||||
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
class USE_TIME{
|
||||
public:
|
||||
USE_TIME(std::string str = "");
|
||||
~USE_TIME();
|
||||
|
||||
private:
|
||||
std::string strTmp;
|
||||
std::chrono::system_clock::time_point start;
|
||||
std::chrono::system_clock::time_point end;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user