Ai
9 Star 32 Fork 21

10km/common_source_cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
time_utilits.h 637 Bytes
一键复制 编辑 原始数据 按行查看 历史
10km 提交于 2018-04-11 09:37 +08:00 . 导入代码
/*
* time_utility.h
*
* Created on: 2016年4月22日
* Author: guyadong
*/
#ifndef COMMON_SOURCE_CPP_TIME_UTILITS_H_
#define COMMON_SOURCE_CPP_TIME_UTILITS_H_
#include <ctime>
namespace gdface{
/*
* 用于运行时间计算的类
*/
struct time_probe_type{
clock_t _start;
/* 开始计时 */
void start(){
_start=clock();
}
/* 计时结束返回时间(秒) */
float end(){
return float(clock()-_start)/CLOCKS_PER_SEC;
}
};
/* TLS变量用于同一线程内的程序执行时间统计 */
thread_local static time_probe_type tls_clock_probe;
} /* namespace gdface */
#endif /* COMMON_SOURCE_CPP_TIME_UTILITS_H_ */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/l0km/common_source_cpp.git
git@gitee.com:l0km/common_source_cpp.git
l0km
common_source_cpp
common_source_cpp
master

搜索帮助