C++ tracy性能分析(二)

环境搭建

项目根目录下

git clone https://github.com/wolfpld/tracy

cmake 配置

add_definitions("-DTRACY_ENABLE")

add_subdirectory(tracy)

include_directories(${TRACY_PUBLIC_DIR})

target_link_libraries(project TracyClient)

test.cpp
cpp 复制代码
//#define TRACY_CALLSTACK   // 收集调用栈
// #define TRACY_LIBUNWIND_BACKTRACE   // use libunwind to perform callstack
 #define TRACY_FIBERS    //线程监控

#include "tracy/Tracy.hpp"
#include "tracy/TracyC.h"

// Memory profiling
void * operator new ( std :: size_t count )
{
  auto ptr = malloc ( count );
  TracyAlloc ( ptr , count );
  return ptr ;
}
void operator delete ( void * ptr ) noexcept
{
  TracyFree ( ptr );
  free ( ptr );
}

void test() {
    TracySetProgramName("test");
    ZoneScoped;
     TracyMessageL("Hello");
    // TracyAppInfo(text, size);
    TracyCZoneN(test, "test", true);
     FrameMarkStart (" Audio processing ");
//    FrameMarkNamed(" Audio processing ");
//    FrameImage(image, width, height, offset, flip);

//     TracyGpuZone("test");

     FrameMarkEnd (" Audio processing ");

    const char * fiber = " job1 ";
    TracyCZoneCtx zone ;
    std::thread t1([fiber]{
      TracyFiberEnter(fiber);
      TracyCZone(ctx, 1) ;

      TracyFiberLeave;
    });
    t1.join () ;

}
抓包配置

工具下载

版本配对

运行

启动 tracy-profiler.exe

启动test.exe

点击connect采集

效果
参考

GitHub - wolfpld/tracy: Frame profiler

C++ tracy性能分析_tracy c++-CSDN博客

C++ prometheus性能分析-CSDN博客

gprof性能分析-CSDN博客


创作不易,小小的支持一下吧!

相关推荐
yiangL_9 小时前
课后作业4:基于 Python 的古诗词词云可视化(P205)
开发语言·python
JosieBook9 小时前
【鸿蒙开源】把 Windows 任务栏上的流量表搬到鸿蒙 PC:TrafficMonitor 1.86 的 C++ 内核移植实践
c++·windows·harmonyos
Huangjin007_10 小时前
【C++ 算法竞赛篇】STL 常用知识点速通指南
c++·算法
geovindu11 小时前
rust: Functional Options Pattern
开发语言·后端·设计模式·rust·函数式选项模式·惯用法型模式
skywalk816312 小时前
把「假成功」赶出工具层:lightharness 两天升级复盘(4×5 模式矩阵 + 工具层 5 个缺陷)
开发语言·前端·人工智能·lightharness
敲上瘾12 小时前
Qt控件通用属性:geometry、qrc资源到QSS样式表等
开发语言·c++·qt·ui
炸膛坦客12 小时前
单片机/C/C++八股:(三十三)取别名
c语言·c++·单片机
听情歌落俗13 小时前
嵌入式学习1-C语言基础语法与STM32实践
c语言·开发语言
小飞在努力13 小时前
【实现负载均匀在线判题⑤】MVC 架构搭建与 Model 题目数据模块实现
c语言·开发语言·c++·笔记·后端
ShineWinsu13 小时前
对于Qt:QFontDialog的解析
c++·qt·面试·gui·字体·客户端·qfontdialog