|
@@ -1,14 +1,33 @@
|
|
#include "widget.h"
|
|
#include "widget.h"
|
|
|
|
|
|
#include <QApplication>
|
|
#include <QApplication>
|
|
-#include "loginit.h"
|
|
|
|
|
|
+#include "Logs/loginit.h"
|
|
|
|
+#include "spdlog/spdlog.h"
|
|
|
|
+#include "Timer/TWTimer.hpp"
|
|
|
|
|
|
|
|
+std::chrono::steady_clock::time_point lastTime = std::chrono::steady_clock::now();
|
|
|
|
+long count = 0;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void print()
|
|
|
|
+{
|
|
|
|
+ std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
|
|
|
|
+ SPDLOG_INFO("count:{} 间隔: {} us",count, std::chrono::duration_cast<std::chrono::microseconds>(now - lastTime).count());
|
|
|
|
+ lastTime = now;
|
|
|
|
+ count++;
|
|
|
|
+}
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
int main(int argc, char *argv[])
|
|
{
|
|
{
|
|
QApplication a(argc, argv);
|
|
QApplication a(argc, argv);
|
|
init_log();
|
|
init_log();
|
|
- Widget w;
|
|
|
|
- w.show();
|
|
|
|
|
|
+
|
|
|
|
+ SPDLOG_INFO("********** Timer **********");
|
|
|
|
+
|
|
|
|
+ TimerWheel timer;
|
|
|
|
+ timer.Start();
|
|
|
|
+
|
|
|
|
+ timer.AddTask(1000, print, true);
|
|
|
|
+
|
|
return a.exec();
|
|
return a.exec();
|
|
}
|
|
}
|