Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3660563e
Commit
3660563e
authored
Jan 16, 2018
by
Yanqiang Miao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Benchmark non docker specific
Signed-off-by:
Yanqiang Miao
<
miao.yanqiang@zte.com.cn
>
parent
bc361fae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
resource_collector.go
test/e2e_node/resource_collector.go
+11
-20
No files found.
test/e2e_node/resource_collector.go
View file @
3660563e
...
@@ -85,16 +85,16 @@ func NewResourceCollector(interval time.Duration) *ResourceCollector {
...
@@ -85,16 +85,16 @@ func NewResourceCollector(interval time.Duration) *ResourceCollector {
// Start starts resource collector and connects to the standalone Cadvisor pod
// Start starts resource collector and connects to the standalone Cadvisor pod
// then repeatedly runs collectStats.
// then repeatedly runs collectStats.
func
(
r
*
ResourceCollector
)
Start
()
{
func
(
r
*
ResourceCollector
)
Start
()
{
// Get the cgroup container names for kubelet and
docker
// Get the cgroup container names for kubelet and
runtime
kubeletContainer
,
err
:=
getContainerNameForProcess
(
kubeletProcessName
,
""
)
kubeletContainer
,
err
:=
getContainerNameForProcess
(
kubeletProcessName
,
""
)
dockerContainer
,
err
:=
getContainerNameForProcess
(
dockerProcessName
,
docker
PidFile
)
runtimeContainer
,
err
:=
getContainerNameForProcess
(
framework
.
TestContext
.
ContainerRuntimeProcessName
,
framework
.
TestContext
.
ContainerRuntime
PidFile
)
if
err
==
nil
{
if
err
==
nil
{
systemContainers
=
map
[
string
]
string
{
systemContainers
=
map
[
string
]
string
{
stats
.
SystemContainerKubelet
:
kubeletContainer
,
stats
.
SystemContainerKubelet
:
kubeletContainer
,
stats
.
SystemContainerRuntime
:
docker
Container
,
stats
.
SystemContainerRuntime
:
runtime
Container
,
}
}
}
else
{
}
else
{
framework
.
Failf
(
"Failed to get
docker
container name in test-e2e-node resource collector."
)
framework
.
Failf
(
"Failed to get
runtime
container name in test-e2e-node resource collector."
)
}
}
wait
.
Poll
(
1
*
time
.
Second
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
wait
.
Poll
(
1
*
time
.
Second
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
...
@@ -240,12 +240,11 @@ func (r *ResourceCollector) GetBasicCPUStats(containerName string) map[float64]f
...
@@ -240,12 +240,11 @@ func (r *ResourceCollector) GetBasicCPUStats(containerName string) map[float64]f
func
formatResourceUsageStats
(
containerStats
framework
.
ResourceUsagePerContainer
)
string
{
func
formatResourceUsageStats
(
containerStats
framework
.
ResourceUsagePerContainer
)
string
{
// Example output:
// Example output:
//
//
// Resource usage for node "e2e-test-foo-node-abcde":
// Resource usage:
// container cpu(cores) memory(MB)
//container cpu(cores) memory_working_set(MB) memory_rss(MB)
// "/" 0.363 2942.09
//"kubelet" 0.068 27.92 15.43
// "/docker-daemon" 0.088 521.80
//"runtime" 0.664 89.88 68.13
// "/kubelet" 0.086 424.37
// "/system" 0.007 119.88
buf
:=
&
bytes
.
Buffer
{}
buf
:=
&
bytes
.
Buffer
{}
w
:=
tabwriter
.
NewWriter
(
buf
,
1
,
0
,
1
,
' '
,
0
)
w
:=
tabwriter
.
NewWriter
(
buf
,
1
,
0
,
1
,
' '
,
0
)
fmt
.
Fprintf
(
w
,
"container
\t
cpu(cores)
\t
memory_working_set(MB)
\t
memory_rss(MB)
\n
"
)
fmt
.
Fprintf
(
w
,
"container
\t
cpu(cores)
\t
memory_working_set(MB)
\t
memory_rss(MB)
\n
"
)
...
@@ -258,7 +257,7 @@ func formatResourceUsageStats(containerStats framework.ResourceUsagePerContainer
...
@@ -258,7 +257,7 @@ func formatResourceUsageStats(containerStats framework.ResourceUsagePerContainer
func
formatCPUSummary
(
summary
framework
.
ContainersCPUSummary
)
string
{
func
formatCPUSummary
(
summary
framework
.
ContainersCPUSummary
)
string
{
// Example output for a node (the percentiles may differ):
// Example output for a node (the percentiles may differ):
// CPU usage of containers
on node "e2e-test-foo-node-0vj7"
:
// CPU usage of containers:
// container 5th% 50th% 90th% 95th%
// container 5th% 50th% 90th% 95th%
// "/" 0.051 0.159 0.387 0.455
// "/" 0.051 0.159 0.387 0.455
// "/runtime 0.000 0.000 0.146 0.166
// "/runtime 0.000 0.000 0.146 0.166
...
@@ -461,15 +460,7 @@ func (r *ResourceCollector) GetResourceTimeSeries() map[string]*perftype.Resourc
...
@@ -461,15 +460,7 @@ func (r *ResourceCollector) GetResourceTimeSeries() map[string]*perftype.Resourc
return
resourceSeries
return
resourceSeries
}
}
// Code for getting container name of docker, copied from pkg/kubelet/cm/container_manager_linux.go
const
kubeletProcessName
=
"kubelet"
// since they are not exposed
const
(
kubeletProcessName
=
"kubelet"
dockerProcessName
=
"docker"
dockerPidFile
=
"/var/run/docker.pid"
containerdProcessName
=
"docker-containerd"
containerdPidFile
=
"/run/docker/libcontainerd/docker-containerd.pid"
)
func
getPidsForProcess
(
name
,
pidFile
string
)
([]
int
,
error
)
{
func
getPidsForProcess
(
name
,
pidFile
string
)
([]
int
,
error
)
{
if
len
(
pidFile
)
>
0
{
if
len
(
pidFile
)
>
0
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment