Skip to content

Commit d840587

Browse files
committed
Fix reset latency
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent e8e7420 commit d840587

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

examples/tls/getting_started_tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func main() {
115115
streamName,
116116
handleMessages,
117117
stream.NewConsumerOptions().
118-
SetConsumerName("my_consumer"). // set a consumer name
118+
SetConsumerName("my_consumer"). // set a consumer name
119119
SetOffset(stream.OffsetSpecification{}.First())) // start consuming from the beginning
120120
CheckErr(err)
121121
channelClose := consumer.NotifyClose()

perfTest/cmd/silent.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,15 @@ func printStats() {
7676
select {
7777
case _ = <-ticker.C:
7878
v := time.Now().Sub(start).Milliseconds()
79-
80-
PMessagesPerSecond := float64(atomic.LoadInt32(&publisherMessageCount)) / float64(v) * 1000
81-
CMessagesPerSecond := float64(atomic.LoadInt32(&consumerMessageCount)) / float64(v) * 1000
82-
//latency := float64(totalLatency) / float64(atomic.LoadInt32(&consumerMessageCount))
8379
averageLatency := int64(0)
8480
if atomic.LoadInt32(&consumerMessageCount) > 0 {
81+
PMessagesPerSecond := float64(atomic.LoadInt32(&publisherMessageCount)) / float64(v) * 1000
82+
CMessagesPerSecond := float64(atomic.LoadInt32(&consumerMessageCount)) / float64(v) * 1000
8583
averageLatency = totalLatency / int64(atomic.LoadInt32(&consumerMessageCount))
84+
ConfirmedMessagesPerSecond := float64(atomic.LoadInt32(&confirmedMessageCount)) / float64(v) * 1000
85+
logInfo("Published %8.1f msg/s | Confirmed %8.1f msg/s | Consumed %8.1f msg/s | %3v | %3v | msg sent: %3v | latency: %d ms",
86+
PMessagesPerSecond, ConfirmedMessagesPerSecond, CMessagesPerSecond, decodeRate(), decodeBody(), atomic.LoadInt64(&messagesSent), averageLatency)
8687
}
87-
88-
ConfirmedMessagesPerSecond := float64(atomic.LoadInt32(&confirmedMessageCount)) / float64(v) * 1000
89-
logInfo("Published %8.1f msg/s | Confirmed %8.1f msg/s | Consumed %8.1f msg/s | %3v | %3v | msg sent: %3v | latency: %d ms",
90-
PMessagesPerSecond, ConfirmedMessagesPerSecond, CMessagesPerSecond, decodeRate(), decodeBody(), atomic.LoadInt64(&messagesSent), averageLatency)
9188
}
9289
}
9390

@@ -100,6 +97,7 @@ func printStats() {
10097

10198
atomic.SwapInt32(&publisherMessageCount, 0)
10299
atomic.SwapInt32(&consumerMessageCount, 0)
100+
atomic.SwapInt64(&totalLatency, 0)
103101
atomic.SwapInt32(&confirmedMessageCount, 0)
104102
atomic.SwapInt32(&notConfirmedMessageCount, 0)
105103
start = time.Now()
@@ -159,8 +157,9 @@ func startSimulation() error {
159157
err := initStreams()
160158
checkErr(err)
161159

160+
//
162161
simulEnvironment, err = stream.NewEnvironment(stream.NewEnvironmentOptions().
163-
SetUris(rabbitmqBrokerUrl).
162+
SetUri(rabbitmqBrokerUrl[0]).
164163
SetMaxProducersPerClient(publishersPerClient).
165164
SetMaxConsumersPerClient(consumersPerClient))
166165
checkErr(err)

0 commit comments

Comments
 (0)