Skip to content

Commit

Permalink
Merge pull request #12 from tebeka/master
Browse files Browse the repository at this point in the history
faster get_worker_id (no defer)
  • Loading branch information
sasile authored Jul 2, 2017
2 parents 7ffc9c4 + b895b2b commit 353304d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions http_blaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"errors"
"flag"
"fmt"
"github.com/v3io/http_blaster/httpblaster"
"github.com/v3io/http_blaster/httpblaster/config"
"io"
"log"
"math/rand"
Expand All @@ -33,12 +31,15 @@ import (
"sync"
"sync/atomic"
"time"

"github.com/v3io/http_blaster/httpblaster"
"github.com/v3io/http_blaster/httpblaster/config"
)

var (
start_time time.Time
end_time time.Time
wl_id int32 = 0
wl_id int32 = -1
conf_file string
results_file string
showVersion bool
Expand Down Expand Up @@ -73,8 +74,7 @@ func init() {
}

func get_workload_id() int32 {
defer atomic.AddInt32(&wl_id, 1)
return wl_id
return atomic.AddInt32(&wl_id, 1)
}

func start_cpu_profile() {
Expand All @@ -85,7 +85,6 @@ func start_cpu_profile() {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
}

Expand Down

0 comments on commit 353304d

Please sign in to comment.