文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Linux启动性能分析工具

Linux启动性能分析工具

时间:2005-09-22  来源:sky-walker

Bootchart ,该工具可对Linux启动过程进行性能分析,并图示化。

http://www.bootchart.org/

下载install.sh安装

最好备份一个启动环境,因为bootchart将修改rc.sysinit,重启后,可以从/var/log/bootchart.log.tar.gz获得数据,在Bootchart的Web 服务中得到图像文件 ,很精细的图

【How it Works】

The boot logger (/sbin/bootchartd) is run by the kernel instead of /sbin/init. This can be achieved by modifying the GRUB or LILO kernel command line, e.g.:

/boot/grub/menu.lst [...] title Fedora Core (2.6.10) - bootchart root (hd0,1) kernel /vmlinuz-2.6.10 ro root=/dev/hda1 init=/sbin/bootchartd initrd /initrd-2.6.10.img 

The installation script and RPM package will try to add the boot loader entry automatically.

The boot logger will start itself in the background and immediately run the default init process, /sbin/init. The boot process will then continue as usual.

Data Collection

Since the root partition is mounted read-only during boot, the logger needs to store data in memory, using a virtual memory file system (tmpfs).

As soon as the /proc file system is mounted — usually early in the sysinit script — the logger will start collecting output from various files:

/proc/stat system-wide CPU statistics: user, system, IO and idle times
/proc/diskstats system-wide disk statistics: disk utilization and throughput
(only available in 2.6 kernels)
/proc/[PID]/stat information about the running processes: start time, parent PID, process state, CPU usage, etc.

The contents of these files are periodically appended to corresponding log files, every 0.2 seconds by default.

The logger will try to detect the end of the boot process by looking for specific processes. For example, when in runlevel 5 (multi-user graphical mode), it will look for gdmgreeter, kdm_greet, etc. As soon as one of these processes is found running, the logger will stop collecting data, package the log files and store them to /var/log/bootchart.tgz.

Optional Process Accounting

In most cases, the output from /proc/[PID]/stat files suffices to recreate the process tree. It is possible however, that a short-lived process will not get picked up by the logger. If that process also forks new processes, the logger will lack dependency information for these "orphaned" processes — meaning that they might get incorrectly grouped by the chart renderer.

When truly accurate dependency information is required, process accounting may be utilized. If configured, the kernel will keep a log file with detailed information about processes. BSD process accounting v3 includes information about the process' PID and parent PID (PPID) — effectively enabling an accurate reconstruction of the process tree.

To enable process accounting, the kernel needs to be configured to include CONFIG_BSD_PROCESS_ACCT_V3, under:

[ ] General setup [ ] BSD Process Accounting [ ] BSD Process Accounting version 3 file format

The GNU accounting utilities (package psacct or acct) also need to be installed. The boot logger will use the accton command to enable process accounting; it will include the accounting log in the tarball.

Visualization

The log tarball is later passed to the Java application for parsing and rendering the data. The CPU and disk statistics are used to render stacked area and line charts. The process information is used to create a Gantt chart showing process dependency, states and CPU usage.

A typical boot sequence consists of several hundred processes. Since it is difficult to visualize such amount of data in a comprehensible way, tree pruning is utilized. Idle background processes and short-lived processes are removed. Similar processes running in parallel are also merged together.

Finally, the performance and dependency charts are renderer as a single image in either PNG, SVG or EPS format.

相关阅读 更多 +
排行榜 更多 +
翌日波奇狗的历险记手机版下载

翌日波奇狗的历险记手机版下载

休闲益智 下载
怪兽远征安卓版下载

怪兽远征安卓版下载

角色扮演 下载
谷歌卫星地图免费版下载

谷歌卫星地图免费版下载

生活实用 下载