gpt4 book ai didi

docker - perf监视未计数的Docker容器

转载 作者:行者123 更新时间:2023-12-02 20:04:39 29 4
gpt4 key购买 nike

我想使用perf来监视docker容器:

$sudo perf stat -e cycles -a -I 1000 -o out.txt --cgroup=docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95 sleep 5

但是,它无法计算out.txt中的周期:
 1 # started on Thu Jun  7 22:49:34 2018
2
3 # time counts unit events
4 1.000224074 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
5 2.000515835 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
6 3.000805321 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
7 4.001008437 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
8 5.001234875 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95

并监视多个事件,例如:
$sudo perf stat -e cycles,instructions -a -I 1000 -o out2.txt --cgroup=docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95,docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95 sleep 5

在out2.txt中得到了相同的结果:
  1 # started on Thu Jun  7 23:23:15 2018
2
3 # time counts unit events
4 1.000326390 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
5 1.000326390 <not counted> instructions docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
6 2.000665181 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
7 2.000665181 <not counted> instructions docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
8 3.000979419 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
9 3.000979419 <not counted> instructions docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
10 4.001281621 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
11 4.001281621 <not counted> instructions docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
12 5.001233401 <not counted> cycles docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95
13 5.001233401 <not counted> instructions docker/c04e4686d0195f9863112983e472ec7b519642bf4cfd3856f327d02e05047f95

如何计算docker容器的周期?

我看了 Monitoring Linux performance events for cgroupskubelet fails to get cgroup stats for docker and kubelet services

最佳答案

不适合使用--cgroup=。我应该使用-p配置进程ID,以监视特定进程。

关于docker - perf监视未计数的Docker容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50744998/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com