python log函數轉成call graph

shihyuyao 2014-04-27 11:10:21
enter main test.c:85
enter func1 test.c:70
enter func2 test.c:67
leave func2 test.c:67
enter func3 test.c:75
enter func4 test.c:80
leave func4 test.c:80
leave func3 test.c:75
leave func1 test.c:70
enter func3 test.c:75
enter func4 test.c:80
leave func4 test.c:80
leave func3 test.c:75
leave main test.c:85


怎么透过函数 enter and leave 转成下面 dot 格式 ?

digraph G {
node [peripheries=2 style="filled,rounded" fontname="Vera Sans YuanTi Mono" color="#eecc80"];
rankdir=LR;
label="test.c"
main [shape=box];
node [color="#eecc80" shape=ellipse];edge [color="#eecc80"];
main->func1
node [color="#ccee80" shape=octagon];edge [color="#ccee80"];
func1->func2
node [color="#ccee80" shape=octagon];edge [color="#ccee80"];
func1->func3
node [color="#80ccee" shape=hexagon];edge [color="#80ccee"];
func3->func4
node [color="#eecc80" shape=ellipse];edge [color="#eecc80"];
main->func3
}



...全文
65 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧