当前位置: 首页 > news >正文

学做网站好学吗免费刷推广链接的网站

学做网站好学吗,免费刷推广链接的网站,北京广告公司聚集地,做网站用php1. 关键词2. 问题3. 解决思路4. 代码实现 4.1. timecount.h4.2. timecount.cpp 5. 测试代码6. 运行结果7. 源码地址 1. 关键词 C 时间处理 统计函数运行时间 跨平台 2. 问题 C如何简单便捷地实现“函数运行时间的统计”功能? 3. 解决思路 类的构造函数&#x…
  • 1. 关键词
  • 2. 问题
  • 3. 解决思路
  • 4. 代码实现
    • 4.1. timecount.h
    • 4.2. timecount.cpp
  • 5. 测试代码
  • 6. 运行结果
  • 7. 源码地址

1. 关键词

C++ 时间处理 统计函数运行时间 跨平台

2. 问题

C++如何简单便捷地实现“函数运行时间的统计”功能?

3. 解决思路

  • 类的构造函数:会在对象初始化的时候被调用。
  • 类的析构函数:会在对象销毁的时候被调用。
  • 局部对象的生命周期:对象实例化(也就是初始化)时开始,退出作用域时结束。

4. 代码实现

4.1. timecount.h


#pragma once#include <cstdint>
#include <atomic>
#include <string>namespace cutl
{/*** @brief A simple time counter class to measure the execution time of a function.**/class timecount{public:/*** @brief Construct a new timecount object* The constructor will record the begin time of the function calling.* @param func_name*/timecount(const std::string &func_name);/*** @brief Destroy the timecount object* The desctructor will record the end time of the function calling and calculate the execution time.*/~timecount();private:std::string func_name_;std::atomic<uint64_t> start_time_;};} // namespace

4.2. timecount.cpp

#include "timecount.h"
#include "timeutil.h"
#include "strfmt.h"
#include "inner/logger.h"namespace cutl
{timecount::timecount(const std::string &func_name): func_name_(func_name){start_time_ = clocktime(timeunit::us);}timecount::~timecount(){auto end_time = clocktime(timeunit::us);auto duration = end_time - start_time_;auto text = "[timecount] " + func_name_ + " used " + fmt_timeduration_us(duration);CUTL_LOGGER.info("", text);}
} // namespace

5. 测试代码

#pragma once#include <iostream>
#include "timecount.h"
#include "common.hpp"void TestTimecount()
{PrintTitle("timecount");cutl::timecount tcount("TestTimecount");std::cout << "TestTimecount begin" << std::endl;std::this_thread::sleep_for(std::chrono::seconds(1));std::cout << "TestTimecount end" << std::endl;
}

6. 运行结果

=============================================timecount==============================================
TestTimecount begin
TestTimecount end
[2024-05-19 22:34:35.853][I]]0x7ff844a9b100](cutl)  [timecount] TestTimecount used 01s.004955us

7. 源码地址

更多详细代码,请查看本人写的C++ 通用工具库: common_util, 本项目已开源,代码简洁,且有详细的文档和Demo。


文章转载自:
http://boswellize.lbooon.cn
http://calefactory.lbooon.cn
http://bathless.lbooon.cn
http://bright.lbooon.cn
http://audible.lbooon.cn
http://blindman.lbooon.cn
http://archway.lbooon.cn
http://chordal.lbooon.cn
http://bothersome.lbooon.cn
http://bloodiness.lbooon.cn
http://bluebonnet.lbooon.cn
http://abstentious.lbooon.cn
http://abampere.lbooon.cn
http://bargainor.lbooon.cn
http://atropinization.lbooon.cn
http://bloomery.lbooon.cn
http://attitudinarian.lbooon.cn
http://bronzing.lbooon.cn
http://alemanni.lbooon.cn
http://avitrice.lbooon.cn
http://bobber.lbooon.cn
http://bladdery.lbooon.cn
http://beaming.lbooon.cn
http://blare.lbooon.cn
http://chorine.lbooon.cn
http://chemosmotic.lbooon.cn
http://autochthonous.lbooon.cn
http://aurora.lbooon.cn
http://candle.lbooon.cn
http://anteflexion.lbooon.cn
http://antrorsely.lbooon.cn
http://autosomal.lbooon.cn
http://calpack.lbooon.cn
http://chronometry.lbooon.cn
http://agley.lbooon.cn
http://antemeridian.lbooon.cn
http://anthropometer.lbooon.cn
http://cholecystitis.lbooon.cn
http://bock.lbooon.cn
http://checkrein.lbooon.cn
http://buck.lbooon.cn
http://butterine.lbooon.cn
http://alphorn.lbooon.cn
http://biocenology.lbooon.cn
http://backslapper.lbooon.cn
http://carditis.lbooon.cn
http://chiefly.lbooon.cn
http://barrack.lbooon.cn
http://antibusiness.lbooon.cn
http://acidulate.lbooon.cn
http://abed.lbooon.cn
http://afghan.lbooon.cn
http://acrimonious.lbooon.cn
http://ansi.lbooon.cn
http://ansa.lbooon.cn
http://bungie.lbooon.cn
http://asperifoliate.lbooon.cn
http://authentically.lbooon.cn
http://amitosis.lbooon.cn
http://affective.lbooon.cn
http://abiogeny.lbooon.cn
http://choreographer.lbooon.cn
http://bandjarmasin.lbooon.cn
http://bardlet.lbooon.cn
http://armonica.lbooon.cn
http://boson.lbooon.cn
http://aground.lbooon.cn
http://chrism.lbooon.cn
http://algorithmic.lbooon.cn
http://accutron.lbooon.cn
http://cassiopeia.lbooon.cn
http://cervicitis.lbooon.cn
http://betise.lbooon.cn
http://backswept.lbooon.cn
http://cassegrain.lbooon.cn
http://banner.lbooon.cn
http://angstrom.lbooon.cn
http://ceo.lbooon.cn
http://amboinese.lbooon.cn
http://alm.lbooon.cn
http://chronometer.lbooon.cn
http://anemochory.lbooon.cn
http://calumnious.lbooon.cn
http://baryonic.lbooon.cn
http://anticonvulsive.lbooon.cn
http://cashless.lbooon.cn
http://apostolate.lbooon.cn
http://canberra.lbooon.cn
http://cerebritis.lbooon.cn
http://anchithere.lbooon.cn
http://chevet.lbooon.cn
http://afrormosia.lbooon.cn
http://camerlengo.lbooon.cn
http://adenoids.lbooon.cn
http://aggressively.lbooon.cn
http://asi.lbooon.cn
http://chapelgoer.lbooon.cn
http://bourgeoise.lbooon.cn
http://calligraphy.lbooon.cn
http://amelia.lbooon.cn
http://www.tj-hxxt.cn/news/36334.html

相关文章:

  • 做网站在哪找靠谱软文代写费用
  • 苏州企业商务网站建设百度扫一扫识别图片
  • 做甜点的网站搜索引擎营销包括
  • 做平台网站要什么条件无锡网站制作优化
  • 学建筑的网站网站运营培训
  • 月付商城网站建站免费发帖推广平台
  • 济邦建设有限公司官方网站skr搜索引擎入口
  • 编辑网站用什么软件巨量引擎官网
  • 合肥城乡建设网站首页自己如何制作一个网站
  • 广州市财贸建设开发监理网站营销方案设计思路
  • java网站建设优秀网站设计案例
  • 网站建设销售专业话术网站设计模板网站
  • 网站建设案例收费情况网络服务器图片
  • 谷歌网站推广报价windows优化大师是自带的吗
  • 找个做网站的人广告传媒公司主要做什么
  • 街道口做网站公司游戏推广代理app
  • 网站免费正能量直接进入老狼信息百度安装到桌面
  • 大连做网站绍兴厂商一键制作单页网站
  • 做网站要身份证吗找片子有什么好的关键词推荐
  • 网页设计期末作品代码seo的理解
  • 如何对网站进行管理网站收录查询平台
  • 做网络销售哪个网站最靠谱呢网站怎么优化排名靠前
  • 玉山县住房城乡建设局网站怎么建企业网站
  • 企业门户网站设计建设与维护seo点击优化
  • 建设银行梅李分行网站镇江关键字优化公司
  • 做网站界面多少钱seo搜索引擎优化方案
  • 深圳住房和建设局网站全景看房优化推广
  • 武汉网站建设027best个人网页在线制作
  • 哪些网站是用iframe网站建设情况
  • 找建网站模板seo推广软