WSL 配置bootchart

WSL 配置bootchart

Bootchart 是一个用于 Linux 启动过程性能分析和可视化的工具。
资源利用率和进程信息在启动过程的用户空间部分收集,然后以 PNG、SVG 或 EPS 编码图表呈现。

  1. 安装WSL

    for windows11 Install WSL | Microsoft Learn

    for windows10及更早 Manual installation steps for older versions of WSL | Microsoft Learn

    • SL2 和 Proxifier 冲突的解决方案

      1. 下载 http://www.proxifier.com/tmp/Test20200228/NoLsp.exe;
      2. 使用管理员权限运行:NoLsp.exe c:\windows\system32\wsl.exe

      方案来源

      microsoft/WSL#4177 (comment)

      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.

  2. 检查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

    若为此前的版本,可通过编译内核完成升级

    为你的WSL 2编译一个最新的Linux内核吧!

  3. 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.bashrcsource ~/.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

  4. 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.

  5. 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部分展示
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值