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博客


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

相关推荐
江上清风山间明月19 分钟前
如何将python开发的window应用打包成exe
开发语言·python·exe·打包
SXJR25 分钟前
Java中的Cross-Encoder模型解决方案
java·开发语言
咩咦28 分钟前
C++学习笔记24:构造函数初始化列表
c++·学习笔记·类和对象·构造函数·初始化列表·const引用
彦为君34 分钟前
JavaSE-11-BIO/NIO/AIO(多人聊天室)
java·开发语言·python·ai·nio
为何创造硅基生物37 分钟前
C 语言 typedef 结构体私有化
c语言·开发语言·算法
计算机安禾42 分钟前
【c++面向对象编程】第43篇:可变参数模板(C++11):优雅处理不定长参数
java·开发语言·c++
Hanniel1 小时前
Python __slots__ 入门指南
开发语言·python·性能优化
AI人工智能+电脑小能手1 小时前
【大白话说Java面试题 第69题】【JVM篇】第29题:GC Roots 有哪些?
java·开发语言·jvm·面试
Matlab程序猿小助手1 小时前
【MATLAB源码-第319期】基于matlab的帝王蝶优化算法(MBO)无人机三维路径规划,输出做短路径图和适应度曲线.
开发语言·算法·matlab
码点滴1 小时前
CRI-O选型与容器运行时标准
开发语言·人工智能·架构·kubernetes·cri-o