# LuaProfiler **Repository Path**: cheng-shuyi/LuaProfiler ## Basic Information - **Project Name**: LuaProfiler - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-21 - **Last Updated**: 2023-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Lua Profiler [](https://github.com/Patrick08T/LuaProfiler) 注意: 本库依赖于 cmake2.8+, lua5.3+ 和 [FlameGraph](https://github.com/brendangregg/FlameGraph.git) ## 原理 类似于Perf, 这个工具能收集Lua虚拟机中的函数调用栈, 并将结果输出成火焰图. ## 使用教程 安装 lua5.3.6 ``` curl -R -O http://www.lua.org/ftp/lua-5.3.6.tar.gz tar zxf lua-5.3.6.tar.gz cd lua-5.3.6 make linux test make install cd .. ``` 安装 FlameGraph ``` git clone https://github.com/Patrick08T/FlameGraph.git ``` 编译项目 ``` ./build.sh ``` 然后, 你就可以在 ./bin/debug/ 目录下看到 libluaperf.so 文件了 ## 测试 ``` cp ./bin/debug/libluaperf.so ./ lua ./sample/sample.lua ./FlameGraph/flamegraph.pl samling.log > perf.svg ``` ![image](https://user-images.githubusercontent.com/18464261/148522352-6f5734f3-ee38-4174-978c-99f353c81d6a.png)