WSL 配置bootchart
Bootchart 是一个用于 Linux 启动过程性能分析和可视化的工具。
资源利用率和进程信息在启动过程的用户空间部分收集,然后以 PNG、SVG 或 EPS 编码图表呈现。
-
安装WSL
for
windows11
Install WSL | Microsoft Learnfor
windows10及更早
Manual installation steps for older versions of WSL | Microsoft Learn-
SL2 和 Proxifier 冲突的解决方案
- 下载 http://www.proxifier.com/tmp/Test20200228/NoLsp.exe;
- 使用管理员权限运行:
NoLsp.exe c:\windows\system32\wsl.exe
方案来源
Thanks for the info.
We have reproduced this issue. Apparently, wsl.exe displays this error if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call for wsl.exe to prevent this. Under the hood the call creates an entry for wsl.exe at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the parameter: NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.
-
-
检查linux内核版本
cat /proc/version
WSL support · dorssel/usbipd-win Wiki · GitHub
Recent versions of Windows running WSL kernel 5.10.60.1 or later already include support for common scenarios like USB-to-serial adapters and flashing embedded development boards. If you’re trying to do one of these tasks on Ubuntu, you can avoid recompiling the kernel by following the WSL Setup instructions at the top of this page.
需要注意kernel 版本在5.10.60.1 及以上才支持USB
若为此前的版本,可通过编译内核完成升级
-
adb配置
-
安装adb package
apt-get install adb
不建议在WSL安装adb,直接使用Windows的adb可以保持版本的一致性,也避免驱动的重新适配。
-
wsl配置windows adb
/etc/bash.bashrc
或~/.bashrc
文件结尾处添加以下内容#Android Debug Bridge export PATH=$PATH:/mnt/c/adb/ alias adb='adb.exe'
执行修改后的脚本:
source /etc/bash.bashrc
或source ~/.bashrc
-
查看adb 版本及windows路径
adb —-version
root@xa-rj-wangweidong:/# adb --version
Android Debug Bridge version 1.0.41
Version 31.0.2-7242960
Installed as C:\adb\adb.exe
-
-
pybootchartgui.py
https://github.com/shubh-agrawal/pybootchartgui
Install cairo. For ubuntu,
sudo apt install python-cairo
Unzip / clone this directory in your system as per your wish.
-
grab-bootchar.sh 获取bootchart.png
init/grab-bootchart.sh - platform/system/core - Git at Google (googlesource.com)
#!/bin/sh # # This script is used to retrieve a bootchart log generated by init. # All options are passed to adb, for better or for worse. # See the readme in this directory for more on bootcharting. TMPDIR=/tmp/android-bootchart rm -rf $TMPDIR mkdir -p $TMPDIR LOGROOT=/data/bootchart TARBALL=bootchart.tgz FILES="header proc_stat.log proc_ps.log proc_diskstats.log" for f in $FILES; do adb "${@}" pull $LOGROOT/$f $TMPDIR/$f 2>&1 > /dev/null done (cd $TMPDIR && tar -czf $TARBALL $FILES) # pybootchartgui ${TMPDIR}/${TARBALL} # 指定脚本路径 python ~/Documents/bootchart/pybootchartgui.py ${TMPDIR}/${TARBALL} #将生成png文件导出至驱动盘 mv ${TARBALL%.tgz}.png /mnt/e/Downloads/${TARBALL%.tgz}.png #WSL无图形界面,此行注释 # xdg-open ${TARBALL%.tgz}.png echo "Clean up ${TMPDIR}/ and ./${TARBALL%.tgz}.png when done"
6.bootchart.png部分展示