Skip to content

Commit

Permalink
fix wrong merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuxuan committed Apr 30, 2018
1 parent 1ce2f63 commit 899fbf0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 43 deletions.
4 changes: 2 additions & 2 deletions benchmark/benchmain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func main() {
s.SetBenchmarkResult("Unary", benchFeature, results.N,
results.AllocedBytesPerOp(), results.AllocsPerOp(), sharedPos)
fmt.Println(s.BenchString())
// fmt.Println(s.String())
fmt.Println(s.String())
resultSlice = append(resultSlice, s.GetBenchmarkResults())
s.Clear()
}
Expand All @@ -468,7 +468,7 @@ func main() {
s.SetBenchmarkResult("Stream", benchFeature, results.N,
results.AllocedBytesPerOp(), results.AllocsPerOp(), sharedPos)
fmt.Println(s.BenchString())
// fmt.Println(s.String())
fmt.Println(s.String())
resultSlice = append(resultSlice, s.GetBenchmarkResults())
s.Clear()
}
Expand Down
29 changes: 6 additions & 23 deletions benchmark/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,37 +142,20 @@ func (stats *Stats) GetBenchmarkResults() BenchResults {
func (stats *Stats) BenchString() string {
stats.maybeUpdate()
s := stats.result
// res := s.RunMode + "-" + s.Features.String() + ","
res := s.RunMode + "-" + s.Features.ConciseString() + ","

res := s.RunMode + "-" + s.Features.String() + ": \n"
if len(s.Latency) != 0 {
var statsUnit = s.Latency[0].Value
var timeUnit = fmt.Sprintf("%v", statsUnit)[1:]
for i := 1; i < len(s.Latency)-1; i++ {
res += fmt.Sprintf("%d_Latency,%s,%s,", s.Latency[i].Percent,
res += fmt.Sprintf("%d_Latency: %s %s \t", s.Latency[i].Percent,
strconv.FormatFloat(float64(s.Latency[i].Value)/float64(statsUnit), 'f', 4, 64), timeUnit)
}
res += fmt.Sprintf("Avg latency,%s,%s,",
res += fmt.Sprintf("Avg latency: %s %s \t",
strconv.FormatFloat(float64(s.Latency[len(s.Latency)-1].Value)/float64(statsUnit), 'f', 4, 64), timeUnit)
}
res += fmt.Sprintf("Count,%v,", s.Operations)
res += fmt.Sprintf("Bytes/op,%v,", s.AllocedBytesPerOp)
res += fmt.Sprintf("Allocs/op,%v", s.AllocsPerOp)

// res := s.RunMode + "-" + s.Features.String() + ": \n"
// if len(s.Latency) != 0 {
// var statsUnit = s.Latency[0].Value
// var timeUnit = fmt.Sprintf("%v", statsUnit)[1:]
// for i := 1; i < len(s.Latency)-1; i++ {
// res += fmt.Sprintf("%d_Latency: %s %s \t", s.Latency[i].Percent,
// strconv.FormatFloat(float64(s.Latency[i].Value)/float64(statsUnit), 'f', 4, 64), timeUnit)
// }
// res += fmt.Sprintf("Avg latency: %s %s \t",
// strconv.FormatFloat(float64(s.Latency[len(s.Latency)-1].Value)/float64(statsUnit), 'f', 4, 64), timeUnit)
// }
// res += fmt.Sprintf("Count: %v \t", s.Operations)
// res += fmt.Sprintf("%v Bytes/op\t", s.AllocedBytesPerOp)
// res += fmt.Sprintf("%v Allocs/op\t", s.AllocsPerOp)
res += fmt.Sprintf("Count: %v \t", s.Operations)
res += fmt.Sprintf("%v Bytes/op\t", s.AllocedBytesPerOp)
res += fmt.Sprintf("%v Allocs/op\t", s.AllocsPerOp)

return res
}
Expand Down
1 change: 1 addition & 0 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ func (ac *addrConn) connect() error {
ac.state = connectivity.Connecting
ac.cc.handleSubConnStateChange(ac.acbw, ac.state)
ac.mu.Unlock()

// Start a goroutine connecting to the server asynchronously.
go func() {
if err := ac.resetTransport(); err != nil {
Expand Down
10 changes: 1 addition & 9 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,6 @@ func (s *Server) Serve(lis net.Listener) error {
// Stop or GracefulStop called; block until done and return nil.
case <-s.quit:
<-s.done

s.channelzRemoveOnce.Do(func() {
if channelz.IsOn() {
channelz.RemoveEntry(s.channelzID)
}
})
default:
}
}()
Expand Down Expand Up @@ -1037,6 +1031,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Last: true,
Delay: false,
}

if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil {
if err == io.EOF {
// The entire stream is done (for unary RPC only).
Expand Down Expand Up @@ -1338,9 +1333,6 @@ func (s *Server) Stop() {
})

s.mu.Lock()
if channelz.IsOn() {
channelz.RemoveEntry(s.channelzID)
}
listeners := s.lis
s.lis = nil
st := s.conns
Expand Down
2 changes: 1 addition & 1 deletion test/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string)
opts = append(opts, grpc.WithPerRPCCredentials(te.perRPCCreds))
}
if te.customCodec != nil {
opts = append(opts, grpc.WithCodec(te.customCodec))
opts = append(opts, grpc.WithDefaultCallOptions(grpc.CallCustomCodec(te.customCodec)))
}
if !te.nonBlockingDial && te.srvAddr != "" {
// Only do a blocking dial if server is up.
Expand Down
8 changes: 0 additions & 8 deletions transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ type Stream struct {
// contentSubtype is the content-subtype for requests.
// this must be lowercase or the behavior is undefined.
contentSubtype string

// eosReceived indicates whether a frame with eos bit set has been received on client side.
// There a three possible values for it: -1, 0, 1.
// 1 indicates: frame with eos bit set has been received.
// 0 indicates: frame with eos bit set has not been received.
// -1 indicates: eosReceived value has been read before and should not be counted again
// for streams failed/successful.
eosReceived int
}

func (s *Stream) swapState(st streamState) streamState {
Expand Down

0 comments on commit 899fbf0

Please sign in to comment.