目标:新建Ubuntu 虚拟机(18.04),安装perf 命令调试,安装出现报错,问题解决总结如下,希望对大家有所帮助。

1.perf 安装提示

WARNING: perf not found for kernel 5.4.0-42

  You may need to install the following packages for this specific kernel:
    linux-tools-5.4.0-42-generic
    linux-cloud-tools-5.4.0-42-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic
 

2、那就以提示此安装吧

 sudo apt-get install linux-tools-5.4.0-42-generic linux-cloud-tools-5.4.0-42-generic linux-tools-generic linux-cloud-tools-generic

3、然后出现了,Ubuntu package 安装常见问题

Unable to locate package ***

遇到这个问题直接尝试sudo apt-get update 和 sudo apt-get upgrade 一般可以解决,

但是执行之后出现源的问题,访问ubuntu 官方源link  time out.

Cannot initiate the connection to cn.archive.ubuntu.com:80 (2001:67c:1562::18)

4、划重点: 直接换源

注释掉Ubuntu 官方deb 链接,添加国内源链接

sudo vim /etc/apt/source.list

添加国内原链接:阿里源或者其他国内源

阿里源:

1

2

3

4

5

6

7

8

9

10

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

5 、重新update 和 upgrade,且重新安装perf 依赖

sudo apt-get update

sudo apt-get upgrade

 sudo apt-get install linux-tools-5.4.0-42-generic linux-cloud-tools-5.4.0-42-generic linux-tools-generic linux-cloud-tools-generic

6、搞定

perf

 usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]

 The most commonly used perf commands are:
   annotate        Read perf.data (created by perf record) and display annotated code
   archive         Create archive with object files with build-ids found in perf.data file
   bench           General framework for benchmark suites
   buildid-cache   Manage build-id cache.
   buildid-list    List the buildids in a perf.data file
   c2c             Shared Data C2C/HITM Analyzer.
   config          Get and set variables in a configuration file.
   data            Data file related processing
   diff            Read perf.data files and display the differential profile
   evlist          List the event names in a perf.data file
   ftrace          simple wrapper for kernel's ftrace functionality
   inject          Filter to augment the events stream with additional information
   kallsyms        Searches running kernel for symbols
   kmem            Tool to trace/measure kernel memory properties
   kvm             Tool to trace/measure kvm guest os
   list            List all symbolic event types
   lock            Analyze lock events
   mem             Profile memory accesses
   record          Run a command and record its profile into perf.data
   report          Read perf.data (created by perf record) and display the profile
   sched           Tool to trace/measure scheduler properties (latencies)
   script          Read perf.data (created by perf record) and display trace output
   stat            Run a command and gather performance counter statistics
   test            Runs sanity tests.
   timechart       Tool to visualize total system behavior during a workload
   top             System profiling tool.
   version         display the version of perf binary
   probe           Define new dynamic tracepoints
   trace           strace inspired tool

 See 'perf help COMMAND' for more information on a specific command.

 

 

 

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐