android\system\extras\simpleperf\scripts\bin\android
2 利用simpleperf抓取perf.data数据
adb shell simpleperf record -p 1791 -g --duration 30 -o /sdcard/perf.data
3 pull数据到指定的目录
simpleperf-master$ adb pull /sdcard/perf.data
4 . 在该目录下执行如下指令
python report_sample.py --symfs android/out/target/product/sdm710/symbols/vendor/lib/hw/ >out.perf
注:示例中的 " --symfs " 指定符号表
5. 从github中获取如下工具
git clone https://github.com/brendangregg/FlameGraph.git
6. 生成火焰图
在 simpleperf-master$ 运行 python report_sample.py >./FlameGraph-master/out.perf
进入 /FlameGraph-master 下运行
./stackcollapse-perf.pl out.perf >out.folded
./flamegraph.pl out.folded >p.svg
注:上面的2个工具存在于FlameGraph的git仓库中 ,最后生成的p.svg需要用Google Chrome打开
一、画一朵花+签名代码如下:
# -*- coding:utf-8 -*-
#画一朵花+签名
import turtle
turtle.color('red','green')
turtle.pensize(5)
turtle.goto(0,0)
turtle.speed(10)
for i in range(15):
turtle.forward(100)
turtle.right(150)
turtle.up()
turtle.goto(150,-120)
turtle.color('black')
turtle.write("xxx" )
turtle.up()
turtle.goto(160,-140)
turtle.color('black')
turtle.write("2018 年 1 月 10 日" )
turtle.up()
turtle.goto(240,-160)
turtle.color('black')
turtle.write("." )
turtle.done()
二、画五角星脸+签名
代码如下:
# -*- coding:utf-8 -*-
#画五角星脸+签名
import turtle
turtle.color('red','green')
turtle.pensize(5)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
turtle.up()
turtle.goto(150,120)
turtle.down()
turtle.color('red','green')
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.up()
turtle.goto(-80,90)
turtle.down()
turtle.color('red','green')
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.up()
turtle.goto(150,-120)
turtle.color('black')
turtle.write("xxx" )
turtle.up()
turtle.goto(160,-140)
turtle.color('black')
turtle.write("2018 年 1 月 7 日" )
turtle.up()
turtle.goto(240,-160)
turtle.color('black')
turtle.write("." )
turtle.done()