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
082da18e
Commit
082da18e
authored
Feb 12, 2016
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e2e: change memory fields to use unit64
parent
715ea4c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
kubelet_stats.go
test/e2e/kubelet_stats.go
+10
-10
resource_usage_gatherer.go
test/e2e/resource_usage_gatherer.go
+6
-6
No files found.
test/e2e/kubelet_stats.go
View file @
082da18e
...
@@ -197,8 +197,8 @@ type containerResourceUsage struct {
...
@@ -197,8 +197,8 @@ type containerResourceUsage struct {
Name
string
Name
string
Timestamp
time
.
Time
Timestamp
time
.
Time
CPUUsageInCores
float64
CPUUsageInCores
float64
MemoryUsageInBytes
int64
MemoryUsageInBytes
u
int64
MemoryWorkingSetInBytes
int64
MemoryWorkingSetInBytes
u
int64
MemoryRSSInBytes
uint64
MemoryRSSInBytes
uint64
// The interval used to calculate CPUUsageInCores.
// The interval used to calculate CPUUsageInCores.
CPUInterval
time
.
Duration
CPUInterval
time
.
Duration
...
@@ -303,16 +303,16 @@ func formatResourceUsageStats(nodeName string, containerStats resourceUsagePerCo
...
@@ -303,16 +303,16 @@ func formatResourceUsageStats(nodeName string, containerStats resourceUsagePerCo
return
fmt
.
Sprintf
(
"Resource usage on node %q:
\n
%s"
,
nodeName
,
buf
.
String
())
return
fmt
.
Sprintf
(
"Resource usage on node %q:
\n
%s"
,
nodeName
,
buf
.
String
())
}
}
type
int64arr
[]
int64
type
uint64arr
[]
u
int64
func
(
a
int64arr
)
Len
()
int
{
return
len
(
a
)
}
func
(
a
u
int64arr
)
Len
()
int
{
return
len
(
a
)
}
func
(
a
int64arr
)
Swap
(
i
,
j
int
)
{
a
[
i
],
a
[
j
]
=
a
[
j
],
a
[
i
]
}
func
(
a
u
int64arr
)
Swap
(
i
,
j
int
)
{
a
[
i
],
a
[
j
]
=
a
[
j
],
a
[
i
]
}
func
(
a
int64arr
)
Less
(
i
,
j
int
)
bool
{
return
a
[
i
]
<
a
[
j
]
}
func
(
a
u
int64arr
)
Less
(
i
,
j
int
)
bool
{
return
a
[
i
]
<
a
[
j
]
}
type
usageDataPerContainer
struct
{
type
usageDataPerContainer
struct
{
cpuData
[]
float64
cpuData
[]
float64
memUseData
[]
int64
memUseData
[]
u
int64
memWorkSetData
[]
int64
memWorkSetData
[]
u
int64
}
}
// Performs a get on a node proxy endpoint given the nodename and rest client.
// Performs a get on a node proxy endpoint given the nodename and rest client.
...
@@ -365,8 +365,8 @@ func computeContainerResourceUsage(name string, oldStats, newStats *cadvisorapi.
...
@@ -365,8 +365,8 @@ func computeContainerResourceUsage(name string, oldStats, newStats *cadvisorapi.
Name
:
name
,
Name
:
name
,
Timestamp
:
newStats
.
Timestamp
,
Timestamp
:
newStats
.
Timestamp
,
CPUUsageInCores
:
float64
(
newStats
.
Cpu
.
Usage
.
Total
-
oldStats
.
Cpu
.
Usage
.
Total
)
/
float64
(
newStats
.
Timestamp
.
Sub
(
oldStats
.
Timestamp
)
.
Nanoseconds
()),
CPUUsageInCores
:
float64
(
newStats
.
Cpu
.
Usage
.
Total
-
oldStats
.
Cpu
.
Usage
.
Total
)
/
float64
(
newStats
.
Timestamp
.
Sub
(
oldStats
.
Timestamp
)
.
Nanoseconds
()),
MemoryUsageInBytes
:
int64
(
newStats
.
Memory
.
Usage
)
,
MemoryUsageInBytes
:
newStats
.
Memory
.
Usage
,
MemoryWorkingSetInBytes
:
int64
(
newStats
.
Memory
.
WorkingSet
)
,
MemoryWorkingSetInBytes
:
newStats
.
Memory
.
WorkingSet
,
MemoryRSSInBytes
:
newStats
.
Memory
.
RSS
,
MemoryRSSInBytes
:
newStats
.
Memory
.
RSS
,
CPUInterval
:
newStats
.
Timestamp
.
Sub
(
oldStats
.
Timestamp
),
CPUInterval
:
newStats
.
Timestamp
.
Sub
(
oldStats
.
Timestamp
),
}
}
...
...
test/e2e/resource_usage_gatherer.go
View file @
082da18e
...
@@ -38,7 +38,7 @@ const (
...
@@ -38,7 +38,7 @@ const (
type
resourceConstraint
struct
{
type
resourceConstraint
struct
{
cpuConstraint
float64
cpuConstraint
float64
memoryConstraint
int64
memoryConstraint
u
int64
}
}
type
containerResourceGatherer
struct
{
type
containerResourceGatherer
struct
{
...
@@ -51,7 +51,7 @@ type containerResourceGatherer struct {
...
@@ -51,7 +51,7 @@ type containerResourceGatherer struct {
type
SingleContainerSummary
struct
{
type
SingleContainerSummary
struct
{
Name
string
Name
string
Cpu
float64
Cpu
float64
Mem
int64
Mem
u
int64
}
}
// we can't have int here, as JSON does not accept integer keys.
// we can't have int here, as JSON does not accept integer keys.
...
@@ -165,8 +165,8 @@ func (g *containerResourceGatherer) computePercentiles(timeSeries map[time.Time]
...
@@ -165,8 +165,8 @@ func (g *containerResourceGatherer) computePercentiles(timeSeries map[time.Time]
if
dataMap
[
name
]
==
nil
{
if
dataMap
[
name
]
==
nil
{
dataMap
[
name
]
=
&
usageDataPerContainer
{
dataMap
[
name
]
=
&
usageDataPerContainer
{
cpuData
:
make
([]
float64
,
len
(
timeSeries
)),
cpuData
:
make
([]
float64
,
len
(
timeSeries
)),
memUseData
:
make
([]
int64
,
len
(
timeSeries
)),
memUseData
:
make
([]
u
int64
,
len
(
timeSeries
)),
memWorkSetData
:
make
([]
int64
,
len
(
timeSeries
)),
memWorkSetData
:
make
([]
u
int64
,
len
(
timeSeries
)),
}
}
}
}
dataMap
[
name
]
.
cpuData
=
append
(
dataMap
[
name
]
.
cpuData
,
data
.
CPUUsageInCores
)
dataMap
[
name
]
.
cpuData
=
append
(
dataMap
[
name
]
.
cpuData
,
data
.
CPUUsageInCores
)
...
@@ -176,8 +176,8 @@ func (g *containerResourceGatherer) computePercentiles(timeSeries map[time.Time]
...
@@ -176,8 +176,8 @@ func (g *containerResourceGatherer) computePercentiles(timeSeries map[time.Time]
}
}
for
_
,
v
:=
range
dataMap
{
for
_
,
v
:=
range
dataMap
{
sort
.
Float64s
(
v
.
cpuData
)
sort
.
Float64s
(
v
.
cpuData
)
sort
.
Sort
(
int64arr
(
v
.
memUseData
))
sort
.
Sort
(
u
int64arr
(
v
.
memUseData
))
sort
.
Sort
(
int64arr
(
v
.
memWorkSetData
))
sort
.
Sort
(
u
int64arr
(
v
.
memWorkSetData
))
}
}
result
:=
make
(
map
[
int
]
resourceUsagePerContainer
)
result
:=
make
(
map
[
int
]
resourceUsagePerContainer
)
...
...
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