Skip to content

Commit

Permalink
remove the new config, and move the options into new perfm
Browse files Browse the repository at this point in the history
  • Loading branch information
lza@arthur committed Jun 6, 2017
1 parent 9b0a1d3 commit 17afaa8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ a golang performence testing platform

## demo client
```go
perfm := perfm.New(perfm.NewConfig())
perfm := perfm.New(perfm.WithParallel(5))
perfm.Registe(func() error {
_, err := http.Get("http://www.baidu.com")
return err
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Config struct {
}

//NewConfig gen the config
func NewConfig(options ...Options) Config {
func newConfig(options ...Options) Config {
c := Config{10, 4, 0, false, 1, 6553500, 15, 1.4, 1000000, 1000}
for _, o := range options {
o(&c)
Expand Down
4 changes: 1 addition & 3 deletions demo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import (
)

func main() {
conf := perfm.NewConfig(perfm.WithBinsNumber(15), perfm.WithMinValue(0),
perfm.WithGrowthFactor(0.4), perfm.WithBaseBucketSize(20), perfm.WithParallel(5))

perfm := perfm.New(conf)
perfm := perfm.New(perfm.WithBinsNumber(15), perfm.WithMinValue(0), perfm.WithGrowthFactor(0.4), perfm.WithBaseBucketSize(20), perfm.WithParallel(5))

perfm.Registe(func() error {
_, err := http.Get("http://www.baidu.com")
Expand Down
4 changes: 3 additions & 1 deletion perfm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ type perfmonitor struct {
}

//New gengrate the perfm monitor
func New(conf Config) PerfMonitor {
func New(options ...Options) PerfMonitor {
conf := newConfig(options...)

histopt := hist.HistogramOptions{
NumBuckets: conf.BinsNumber,
GrowthFactor: conf.GrowthFactor,
Expand Down

0 comments on commit 17afaa8

Please sign in to comment.