analyze: more detailed README generator config

This commit is contained in:
Gyu-Ho Lee 2016-04-05 11:19:23 -07:00
parent d70a0b5c36
commit b3964c706c
4 changed files with 52 additions and 17 deletions

View File

@ -449,9 +449,17 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
for _, result := range cfg.Step4.Results {
rdBuf.WriteString(fmt.Sprintf("<br><br><hr>\n##### %s", result.Title))
rdBuf.WriteString("\n\n")
for _, imagePath := range result.Images {
ipath := filepath.Base(imagePath)
rdBuf.WriteString(fmt.Sprintf("![%s](./%s)\n\n", ipath, ipath))
for _, img := range result.Images {
imgPath := ""
switch img.ImageType {
case "local":
imgPath = "./" + filepath.Base(img.ImagePath)
rdBuf.WriteString(fmt.Sprintf("![%s](%s)\n\n", img.ImageTitle, imgPath))
case "remote":
rdBuf.WriteString(fmt.Sprintf(`<img src="%s" alt="%s">`, img.ImagePath, img.ImageTitle))
default:
return fmt.Errorf("%s is not supported", img.ImageType)
}
}
rdBuf.WriteString("\n\n")
}

View File

@ -52,8 +52,12 @@ type Config struct {
Step4 struct {
Preface string `yaml:"preface"`
Results []struct {
Title string `yaml:"title"`
Images []string `yaml:"images"`
Title string `yaml:"title"`
Images []struct {
ImageTitle string `yaml:"image_title"`
ImagePath string `yaml:"image_path"`
ImageType string `yaml:"image_type"`
} `yaml:"images"`
} `yaml:"results"`
OutputPath string `yaml:"output_path"`
} `yaml:"step4"`

View File

@ -36,10 +36,16 @@ func TestReadConfig(t *testing.T) {
if c.Step3[0].PlotList[0].OutputPathList[1] != "bench-20160330/bench-01-avg-latency-ms.png" {
t.Fatalf("unexpected %s", c.Step3[0].PlotList[0].OutputPathList[1])
}
if c.Step4.Results[0].Images[2] != "bench-20160330/bench-01-avg-cpu.png" {
t.Fatalf("unexpected %s", c.Step4.Results[0].Images[2])
}
if c.Step4.OutputPath != "bench-20160330/README.md" {
t.Fatalf("unexpected %s", c.Step4.OutputPath)
}
if c.Step4.Results[0].Images[0].ImageTitle != "bench-01-avg-latency-ms" {
t.Fatalf("unexpected %s", c.Step4.Results[0].Images[0].ImageTitle)
}
if c.Step4.Results[0].Images[0].ImagePath != "bench-20160330/bench-01-avg-latency-ms.png" {
t.Fatalf("unexpected %s", c.Step4.Results[0].Images[0].ImagePath)
}
if c.Step4.Results[0].Images[0].ImageType != "local" {
t.Fatalf("unexpected %s", c.Step4.Results[0].Images[0].ImageType)
}
}

View File

@ -138,7 +138,8 @@ step3:
step4:
preface: |
- Google Cloud Compute Engine
- 8 vCPUs + 16GB Memory + 375GB local SSD (SCSI)
- 3 machines(server) of 8 vCPUs + 16GB Memory + 375GB local SSD (SCSI)
- 1 machine(client) of 16 vCPUs + 30GB Memory + 50GB SSD
- Ubuntu 15.10
- Go 1.6 with etcd master branch as of testing date
- Java 8 with Zookeeper 3.4.8(current)
@ -147,14 +148,30 @@ step4:
results:
- title: Write 300K keys, 1 client, key 64 bytes, value 256 bytes
images:
- bench-20160330/bench-01-avg-latency-ms.png
- bench-20160330/bench-01-throughput.png
- bench-20160330/bench-01-avg-cpu.png
- bench-20160330/bench-01-avg-memory.png
- image_title: bench-01-avg-latency-ms
image_path: bench-20160330/bench-01-avg-latency-ms.png
image_type: local
- image_title: bench-01-throughput
image_path: bench-20160330/bench-01-throughput.png
image_type: local
- image_title: bench-01-avg-cpu
image_path: bench-20160330/bench-01-avg-cpu.png
image_type: local
- image_title: bench-01-avg-memory
image_path: bench-20160330/bench-01-avg-memory.png
image_type: local
- title: Write 3M keys, 1K clients, key 64 bytes, value 256 bytes
images:
- bench-20160330/bench-02-avg-latency-ms.png
- bench-20160330/bench-02-throughput.png
- bench-20160330/bench-02-avg-cpu.png
- bench-20160330/bench-02-avg-memory.png
- image_title: bench-02-avg-latency-ms
image_path: bench-20160330/bench-02-avg-latency-ms.png
image_type: local
- image_title: bench-02-throughput
image_path: bench-20160330/bench-02-throughput.png
image_type: local
- image_title: bench-02-avg-cpu
image_path: bench-20160330/bench-02-avg-cpu.png
image_type: local
- image_title: bench-02-avg-memory
image_path: bench-20160330/bench-02-avg-memory.png
image_type: local
output_path: bench-20160330/README.md