我想使用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
如何计算泊坞窗容器的周期?
我看了Monitoring Linux performance events for cgroups和kubelet fails to get cgroup stats for docker and kubelet services。
答案 0 :(得分:0)
它不适合使用--cgroup=
。我应该使用-p
来配置进程ID,以监视特定进程。