Skip to content

Commit

Permalink
2024.05.12
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed May 12, 2024
1 parent b03476c commit 1a7de8e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

硬盘IO测试 (Disk IO Test)

开发中,不要使用

## 功能

- [x] winstat测试
Expand All @@ -12,6 +14,7 @@
- [x] 支持双语输出,以```-l```指定```zh``````en```可指定输出的语言,未指定时默认使用中文输出
- [x] 支持单/多盘IO测试,以```-d```指定```single``````multi```可指定是否测试多盘,未指定时默认仅测试单盘```/root``````C:```路径
- [ ] 支持指定路径IO测试,以```-p```指定路径
- [ ] 测试前需检测剩余硬盘大小是否支持进行测试
- [x] 全平台编译支持

## 使用
Expand Down
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func main() {
http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2FdiskTest&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false")
}()
fmt.Println("项目地址:", "https://github.com/oneclickvirt/diskTest")
// go run main.go -l en -d multi
languagePtr := flag.String("l", "", "Language parameter (en or zh)")
multiDiskPtr := flag.String("d", "", "Enable multi disk check parameter (single or multi, default is single)")
flag.Parse()
Expand All @@ -40,7 +41,7 @@ func main() {
}
}
fmt.Println("--------------------------------------------------")
fmt.Println(res)
fmt.Printf(res)
fmt.Println("--------------------------------------------------")
// TODO https://github.com/devlights/diskio
}
10 changes: 9 additions & 1 deletion disktest/disktest.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func DDTest(language string, enableMultiCheck bool) string {
}
}
}
os.Remove(path + "/100MB.test")
// 读取测试
// dd if=/tmp/100MB.test of=/dev/null bs=4k count=25600 oflag=direct
cmd2 := exec.Command("dd", "if="+path+"/100MB.test", "of=/dev/null", "bs=4k", "count=25600", "oflag=direct")
Expand Down Expand Up @@ -199,6 +198,15 @@ func FioTest(language string, enableMultiCheck bool) string {
}
}
}
cmd := exec.Command("command", "-v", "fio")
output, err := cmd.Output()
if err == nil {
if !strings.Contains(string(output), "fio") {
return ""
}
} else {
return ""
}
if language == "en" {
result += "Test Path Block Read(IOPS) Write(IOPS) Total(IOPS)\n"
} else {
Expand Down

0 comments on commit 1a7de8e

Please sign in to comment.