Function Call Tracing by gadievron/raptor
npx skills add https://github.com/gadievron/raptor --skill 'Function Call Tracing'追踪 C/C++ 程序中的所有函数调用,提供每线程日志和 Perfetto 可视化。
捕获函数进入/退出,写入每线程日志。
构建:
gcc -c -fPIC trace_instrument.c -o trace_instrument.o
gcc -shared trace_instrument.o -o libtrace.so -ldl -lpthread
将日志转换为 Chrome JSON 格式,用于 Perfetto UI。
构建:
g++ -O3 -std=c++17 trace_to_perfetto.cpp -o trace_to_perfetto
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
make
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
./program
# 创建 trace_<tid>.log 文件
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
./trace_to_perfetto trace_*.log -o trace.json
# 在 ui.perfetto.dev 中打开 trace.json
[seq] [timestamp] [dots] [ENTRY|EXIT!] function_name
[0] [1.000000000] [ENTRY] main
[1] [1.000050000] . [ENTRY] helper
[2] [1.000100000] . [EXIT!] helper
[3] [1.000150000] [EXIT!] main
trace_instrument.c 和 trace_to_perfetto.cpp 复制到项目中-finstrument-functions 添加到 CFLAGS-L. -ltrace -ldl -lpthread 添加到 LDFLAGSLD_LIBRARY_PATH 并运行程序./trace_to_perfetto trace_*.log -o trace.jsonMakefile: 有条件地添加标志
ENABLE_TRACE ?= 0
ifeq ($(ENABLE_TRACE),1)
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
endif
CMake: 添加选项
option(ENABLE_TRACE "启用追踪" OFF)
if(ENABLE_TRACE)
add_compile_options(-finstrument-functions -g)
link_libraries(trace dl pthread)
endif()
函数 ENTRY → "B" (开始) 事件 函数 EXIT! → "E" (结束) 事件 所有线程按时间戳对齐在单个文件中。
每周安装次数
–
代码仓库
GitHub 星标数
1.5K
首次出现时间
–
安全审计
Trace all function calls in C/C++ programs with per-thread logs and Perfetto visualization.
Captures function entry/exit, writes per-thread logs.
Build:
gcc -c -fPIC trace_instrument.c -o trace_instrument.o
gcc -shared trace_instrument.o -o libtrace.so -ldl -lpthread
Converts logs to Chrome JSON for Perfetto UI.
Build:
g++ -O3 -std=c++17 trace_to_perfetto.cpp -o trace_to_perfetto
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
make
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
./program
# Creates trace_<tid>.log files
./trace_to_perfetto trace_*.log -o trace.json
# Open trace.json in ui.perfetto.dev
[seq] [timestamp] [dots] [ENTRY|EXIT!] function_name
[0] [1.000000000] [ENTRY] main
[1] [1.000050000] . [ENTRY] helper
[2] [1.000100000] . [EXIT!] helper
[3] [1.000150000] [EXIT!] main
trace_instrument.c and trace_to_perfetto.cpp to project-finstrument-functions to CFLAGS-L. -ltrace -ldl -lpthread to LDFLAGSLD_LIBRARY_PATH and run./trace_to_perfetto trace_*.log -o trace.jsonMakefile: Add flags conditionally
ENABLE_TRACE ?= 0
ifeq ($(ENABLE_TRACE),1)
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
endif
CMake: Add option
option(ENABLE_TRACE "Enable tracing" OFF)
if(ENABLE_TRACE)
add_compile_options(-finstrument-functions -g)
link_libraries(trace dl pthread)
endif()
Function ENTRY → "B" (begin) event Function EXIT! → "E" (end) event All threads aligned by timestamp in single file.
Weekly Installs
–
Repository
GitHub Stars
1.5K
First Seen
–
Security Audits
Electron应用自动化指南:使用agent-browser通过CDP实现桌面应用自动化
12,600 周安装
Google Gemini Embeddings API 完整指南:文本嵌入、RAG集成与语义搜索最佳实践
337 周安装
Crypto Agent Trading 技能:自动化加密货币交易智能体开发指南
337 周安装
Playwright 浏览器自动化技能 - 智能检测开发服务器,可视化网页测试与自动化
Go语言最佳实践指南:Google/Uber生产级代码规范与Go 1.25新特性
344 周安装
OpenAI图像生成脚本:批量生成DALL-E 3/GPT图像,支持多模型参数与自动图库
338 周安装
Cloudflare Workers AI 完整指南:2025 模型更新、性能优化与常见问题解决方案
338 周安装