Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
d87ca2c2
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d87ca2c2
编写于
5月 29, 2020
作者:
P
Priya Wadhwa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for docker driver to mkcmp
上级
abba4b3d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
10 deletion
+18
-10
pkg/minikube/perf/result_manager.go
pkg/minikube/perf/result_manager.go
+3
-1
pkg/minikube/perf/start.go
pkg/minikube/perf/start.go
+15
-9
未找到文件。
pkg/minikube/perf/result_manager.go
浏览文件 @
d87ca2c2
...
...
@@ -64,8 +64,10 @@ func (rm *resultManager) averageTime(binary *Binary) float64 {
return
average
(
times
)
}
func
(
rm
*
resultManager
)
summarizeResults
(
binaries
[]
*
Binary
)
{
func
(
rm
*
resultManager
)
summarizeResults
(
binaries
[]
*
Binary
,
driver
string
)
{
// print total and average times
fmt
.
Printf
(
"**%s Driver**
\n
"
,
driver
)
for
_
,
b
:=
range
binaries
{
fmt
.
Printf
(
"Times for %s: %v
\n
"
,
b
.
Name
(),
rm
.
totalTimes
(
b
))
fmt
.
Printf
(
"Average time for %s: %v
\n\n
"
,
b
.
Name
(),
rm
.
averageTime
(
b
))
...
...
pkg/minikube/perf/start.go
浏览文件 @
d87ca2c2
...
...
@@ -18,6 +18,7 @@ package perf
import
(
"context"
"fmt"
"io"
"log"
"os"
...
...
@@ -28,25 +29,30 @@ import (
const
(
// runs is the number of times each binary will be timed for 'minikube start'
runs
=
1
runs
=
3
)
// CompareMinikubeStart compares the time to run `minikube start` between two minikube binaries
func
CompareMinikubeStart
(
ctx
context
.
Context
,
out
io
.
Writer
,
binaries
[]
*
Binary
)
error
{
rm
,
err
:=
collectResults
(
ctx
,
binaries
)
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"collecting results"
)
drivers
:=
[]
string
{
"kvm2"
,
"docker"
}
for
_
,
d
:=
range
drivers
{
rm
,
err
:=
collectResults
(
ctx
,
binaries
,
d
)
if
err
!=
nil
{
log
.
Printf
(
"error collecting results for %s driver: %v"
,
d
,
err
)
continue
}
rm
.
summarizeResults
(
binaries
,
d
)
fmt
.
Println
()
}
rm
.
summarizeResults
(
binaries
)
return
nil
}
func
collectResults
(
ctx
context
.
Context
,
binaries
[]
*
Binary
)
(
*
resultManager
,
error
)
{
func
collectResults
(
ctx
context
.
Context
,
binaries
[]
*
Binary
,
driver
string
)
(
*
resultManager
,
error
)
{
rm
:=
newResultManager
()
for
run
:=
0
;
run
<
runs
;
run
++
{
log
.
Printf
(
"Executing run %d/%d..."
,
run
,
runs
)
for
_
,
binary
:=
range
binaries
{
r
,
err
:=
timeMinikubeStart
(
ctx
,
binary
)
r
,
err
:=
timeMinikubeStart
(
ctx
,
binary
,
driver
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"timing run %d with %s"
,
run
,
binary
.
Name
())
}
...
...
@@ -66,8 +72,8 @@ func average(nums []float64) float64 {
// timeMinikubeStart returns the time it takes to execute `minikube start`
// It deletes the VM after `minikube start`.
func
timeMinikubeStart
(
ctx
context
.
Context
,
binary
*
Binary
)
(
*
result
,
error
)
{
startCmd
:=
exec
.
CommandContext
(
ctx
,
binary
.
path
,
"start"
)
func
timeMinikubeStart
(
ctx
context
.
Context
,
binary
*
Binary
,
driver
string
)
(
*
result
,
error
)
{
startCmd
:=
exec
.
CommandContext
(
ctx
,
binary
.
path
,
"start"
,
fmt
.
Sprintf
(
"--driver=%s"
,
driver
)
)
startCmd
.
Stderr
=
os
.
Stderr
deleteCmd
:=
exec
.
CommandContext
(
ctx
,
binary
.
path
,
"delete"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录