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
08fbe2bc
Commit
08fbe2bc
authored
Sep 10, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13789 from socaa/resource-consumer-memory
Auto commit by PR queue bot
parents
6a5049f0
9e640b35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
resource_consumer_handler.go
test/images/resource-consumer/resource_consumer_handler.go
+1
-2
utils.go
test/images/resource-consumer/utils.go
+10
-2
No files found.
test/images/resource-consumer/resource_consumer_handler.go
View file @
08fbe2bc
...
@@ -104,8 +104,7 @@ func (handler ResourceConsumerHandler) handleConsumeMem(w http.ResponseWriter, q
...
@@ -104,8 +104,7 @@ func (handler ResourceConsumerHandler) handleConsumeMem(w http.ResponseWriter, q
http
.
Error
(
w
,
incorrectFunctionArgument
,
http
.
StatusBadRequest
)
http
.
Error
(
w
,
incorrectFunctionArgument
,
http
.
StatusBadRequest
)
return
return
}
}
ConsumeMem
(
megabytes
,
durationSec
)
go
ConsumeMem
(
megabytes
,
durationSec
)
fmt
.
Fprintln
(
w
,
"Warning: not implemented!"
)
fmt
.
Fprintln
(
w
,
consumeMemAddress
[
1
:
])
fmt
.
Fprintln
(
w
,
consumeMemAddress
[
1
:
])
fmt
.
Fprintln
(
w
,
megabytes
,
megabytesQuery
)
fmt
.
Fprintln
(
w
,
megabytes
,
megabytesQuery
)
fmt
.
Fprintln
(
w
,
durationSec
,
durationSecQuery
)
fmt
.
Fprintln
(
w
,
durationSec
,
durationSecQuery
)
...
...
test/images/resource-consumer/utils.go
View file @
08fbe2bc
...
@@ -20,9 +20,13 @@ import (
...
@@ -20,9 +20,13 @@ import (
"fmt"
"fmt"
"log"
"log"
"os/exec"
"os/exec"
"strconv"
)
)
const
consumeCPUBinary
=
"./consume-cpu/consume-cpu"
const
(
consumeCPUBinary
=
"./consume-cpu/consume-cpu"
consumeMemBinary
=
"stress"
)
func
ConsumeCPU
(
millicores
int
,
durationSec
int
)
{
func
ConsumeCPU
(
millicores
int
,
durationSec
int
)
{
log
.
Printf
(
"ConsumeCPU millicores: %v, durationSec: %v"
,
millicores
,
durationSec
)
log
.
Printf
(
"ConsumeCPU millicores: %v, durationSec: %v"
,
millicores
,
durationSec
)
...
@@ -35,7 +39,11 @@ func ConsumeCPU(millicores int, durationSec int) {
...
@@ -35,7 +39,11 @@ func ConsumeCPU(millicores int, durationSec int) {
func
ConsumeMem
(
megabytes
int
,
durationSec
int
)
{
func
ConsumeMem
(
megabytes
int
,
durationSec
int
)
{
log
.
Printf
(
"ConsumeMem megabytes: %v, durationSec: %v"
,
megabytes
,
durationSec
)
log
.
Printf
(
"ConsumeMem megabytes: %v, durationSec: %v"
,
megabytes
,
durationSec
)
// not implemented
megabytesString
:=
strconv
.
Itoa
(
megabytes
)
+
"M"
durationSecString
:=
strconv
.
Itoa
(
durationSec
)
// creating new consume memory process
consumeMem
:=
exec
.
Command
(
consumeMemBinary
,
"-m"
,
"1"
,
"--vm-bytes"
,
megabytesString
,
"--vm-hang"
,
"0"
,
"-t"
,
durationSecString
)
consumeMem
.
Start
()
}
}
func
GetCurrentStatus
()
{
func
GetCurrentStatus
()
{
...
...
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