Application of bootchart tool in Android system boot measurement (2) Problem Solving

Source: Internet
Author: User

In my previous blog "Application of bootchart tool in Android system boot measurement", I had a Summary of the problem, which was more than a year ago. I finally gave three examples. the download link of The py file cannot be found. In addition, the problem occurred in python2.7. Later, I reinstalled the system and found that the Python version built in ubuntu10.04 is 2.6. It is estimated that the Python version in my system has been upgraded to 2.7. There will be new problems in python2.6. Here is a summary.

1. directly execute the command:

$sudo apt-get install bootchart    $sudo apt-get install pybootchartgui  

After bootchart is installed, run the following command:

$bootchart ./bootchart.tgz 

When bootchart.png is generated, an error is prompted:

    parsing 'header'      parsing 'proc_stat.log'      parsing 'proc_ps.log'      warning: no parent for pid '2' with ppid '0'      parsing 'proc_diskstats.log'      parsing 'kernel_pacct'      merged 0 logger processes      pruned 63 process, 0 exploders, 2 threads, and 0 runs      False      Traceback (most recent call last):        File "/usr/bin/bootchart", line 23, in <module>          sys.exit(main())        File "/usr/lib/pymodules/python2.6/pybootchartgui/main.py", line      137, in main          render()        File "/usr/lib/pymodules/python2.6/pybootchartgui/main.py", line      128, in render          batch.render(writer, res, options, filename)        File "/usr/lib/pymodules/python2.6/pybootchartgui/batch.py", line      41, in render          draw.render(ctx, options, *res)        File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line      282, in render          draw_chart(ctx, IO_COLOR, True, chart_rect, [(sample.time,      sample.util) for sample in disk_stats], proc_tree)        File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line      201, in draw_chart          yscale = float(chart_bounds[3]) / max(y for (x,y) in data)      ZeroDivisionError: float division   

This is the same as execution in python2.7. There are two solutions:

1) download from this linkDraw. py,Parsing. py,Samples. pyThree files, and then replace the files in the/usr/share/pyshared/pybootchartgui/directory of ubuntu.

2) Consider 1) when the download link in is not properly guaranteed, the chain will be dropped. Therefore, to solve this problem, directly modify the/usr/share/pyshared/pybootchartgui/directory in Ubuntu.Draw. py,Parsing. py,Samples. pyModify the three files as follows:

Draw. py:

Set 200,201 rows to: XScale = float (chart_bounds [2])/MAX (X for (x, y) in data) yscale = float (chart_bounds [3]) /MAX (Y for (x, y) in data) to: XScale = float (chart_bounds [2])/MAX (0.00001, max (X for (x, y) in data) yscale = float (chart_bounds [3])/MAX (0.00001, max (Y for (x, y) in data ))

Parsing. py:

Add: If interval = 0: interval = 1 after row 3, and modify it as follows: sums = [A-B for a, B in zip (sample1.diskdata, sample2.diskdata)] if interval = 0: interval = 1

Samples. py:

Add: If interval = 0: interval = 1 after row 81, and then modify it as follows: def calc_load (self, usercpu, syscpu, interval): If interval = 0: <br> interval = 1

2. After problem 1 is solved, run the following command again:

$bootchart ./bootchart.tgz   

The following error occurs:

Traceback (most recent call last):  File "/usr/bin/bootchart", line 23, in <module>    sys.exit(main())  File "/usr/lib/pymodules/python2.6/pybootchartgui/main.py", line 137, in main    render()  File "/usr/lib/pymodules/python2.6/pybootchartgui/main.py", line 128, in render    batch.render(writer, res, options, filename)  File "/usr/lib/pymodules/python2.6/pybootchartgui/batch.py", line 41, in render    draw.render(ctx, options, *res)  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 299, in render    draw_process_bar_chart(ctx, proc_tree, times, curr_y + bar_h, w, h)  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 319, in draw_process_bar_chart    draw_processes_recursively(ctx, root, proc_tree, y, proc_h, chart_rect)  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 357, in draw_processes_recursively    child_x, child_y = draw_processes_recursively(ctx, child, proc_tree, next_y, proc_h, rect)  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 349, in draw_processes_recursively    draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect)  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 376, in draw_process_activity_colors    state = get_proc_state( sample.state )  File "/usr/lib/pymodules/python2.6/pybootchartgui/draw.py", line 105, in get_proc_state    return "RSDTZXW".index(flag) + 1ValueError: substring not found

The solution is to modify the file:/usr/lib/pymodules/python2.6/pybootchartgui/draw. py. The change is as follows:

Change "return" rsdtzxw ". Index (FLAG) + 1 to" return "rsdtzxw". Find (FLAG) + 1

Now, run the following command again:

$bootchart ./bootchart.tgz   

A long time later, bootchart.png will be generated.

References:

Http://blog.csdn.net/harry_helei/article/details/7281356

Https://groups.google.com/forum? Fromgroups = #! Topic/Android-kernel/mdgqzzvodmq

Https://bugs.launchpad.net/ubuntu/+source/bootchart/+bug/580560

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.