From c1a0cde62da279d1bc6615c99c078f456fe20a08 Mon Sep 17 00:00:00 2001 From: zara Date: Wed, 19 Apr 2023 20:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=B0=8F=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E8=AE=A1=E6=97=B6=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=87=87=E7=94=A8?= =?UTF-8?q?chrono=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 ++++++ cmake-build-debug/utils.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake-build-debug/utils.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e41094f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25) +project(utils) + +set(CMAKE_CXX_STANDARD 17) + +add_library(utils INTERFACE utils.h) diff --git a/cmake-build-debug/utils.h b/cmake-build-debug/utils.h new file mode 100644 index 0000000..2aa8d1b --- /dev/null +++ b/cmake-build-debug/utils.h @@ -0,0 +1,31 @@ +#ifndef __UTILS__ +#define __UTILS__ +#include +#include +namespace utils{ + + + class hdTimer{ + public: + hdTimer(){ + } + void tik(){ + start = std::chrono::high_resolution_clock::now(); + } + void tok(){ + end = std::chrono::high_resolution_clock::now(); + } + double cost(){ + return std::chrono::duration_cast(end-start).count(); + } + private: + + std::chrono::time_point start,end; + + }; + + +} + + +#endif \ No newline at end of file