2727)
2828
2929type ThroughoutMeasure struct {
30- LoadTPS int `json:"load_tps"`
31- ProcessedTPS int `json:"processed_tps"`
32- NotReceivedP2PEventCount int `json:"not_received_p2p_event_count"`
30+ LoadTPS int `json:"load_tps"`
31+ ProcessedTPS int `json:"processed_tps"`
32+ NotReceivedP2PEventCount int `json:"not_received_p2p_event_count"`
33+ CoordinatedOmissionEventCount int `json:"coordinated_omission_event_count"`
3334}
3435
3536type Task struct {
@@ -138,10 +139,11 @@ func (t *Task) Execute(ctx context.Context) error {
138139 t .config .StartingTPS , t .config .EndingTPS , t .config .IncrementTPS )
139140
140141 missedP2PEventCount := 0
142+ totalCoordinatedOmissionEventCount := 0
141143
142144 for sendingTps := t .config .StartingTPS ; sendingTps <= t .config .EndingTPS ; sendingTps += t .config .IncrementTPS {
143145 // measure the throughput with the current sendingTps
144- processedTps , notReceivedP2PEventCount , err := t .measureTpsWithLoad (loadTarget , sendingTps , t .config .DurationS , singleMeasureDeadline , percentile )
146+ processedTps , notReceivedP2PEventCount , coordinatedOmissionEventCount , err := t .measureTpsWithLoad (loadTarget , sendingTps , t .config .DurationS , singleMeasureDeadline , percentile )
145147 if err != nil {
146148 t .logger .Errorf ("Error during throughput measurement with sendingTps=%d, duration=%d: %v" , sendingTps , t .config .DurationS , err )
147149 t .ctx .SetResult (types .TaskResultFailure )
@@ -151,12 +153,14 @@ func (t *Task) Execute(ctx context.Context) error {
151153
152154 // add to throughoutMeasures
153155 throughoutMeasures = append (throughoutMeasures , ThroughoutMeasure {
154- LoadTPS : sendingTps ,
155- ProcessedTPS : processedTps ,
156- NotReceivedP2PEventCount : notReceivedP2PEventCount ,
156+ LoadTPS : sendingTps ,
157+ ProcessedTPS : processedTps ,
158+ NotReceivedP2PEventCount : notReceivedP2PEventCount ,
159+ CoordinatedOmissionEventCount : coordinatedOmissionEventCount ,
157160 })
158161
159162 missedP2PEventCount += notReceivedP2PEventCount
163+ totalCoordinatedOmissionEventCount += coordinatedOmissionEventCount
160164 }
161165
162166 t .logger .Infof ("Finished measuring throughput, collected %d measures" , len (throughoutMeasures ))
@@ -166,8 +170,9 @@ func (t *Task) Execute(ctx context.Context) error {
166170 t .ctx .Outputs .SetVar ("throughput_measures" , throughoutMeasures ) // log coordinated_omission_event_count and missed_p2p_event_count?
167171
168172 outputs := map [string ]interface {}{
169- "throughput_measures" : throughoutMeasures ,
170- "missed_p2p_event_count" : missedP2PEventCount ,
173+ "throughput_measures" : throughoutMeasures ,
174+ "missed_p2p_event_count" : missedP2PEventCount ,
175+ "coordinated_omission_event_count" : totalCoordinatedOmissionEventCount ,
171176 }
172177
173178 outputsJSON , _ := json .Marshal (outputs )
@@ -180,7 +185,7 @@ func (t *Task) Execute(ctx context.Context) error {
180185}
181186
182187func (t * Task ) measureTpsWithLoad (loadTarget * txloadtool.LoadTarget , sendingTps , durationS int ,
183- testDeadline time.Time , percentile float64 ) (processedTps , notReceivedP2PEventCount int , err error ) {
188+ testDeadline time.Time , percentile float64 ) (processedTps , notReceivedP2PEventCount , coordinatedOmissionEventCount int , err error ) {
184189 t .logger .Infof ("Single measure of throughput, sending TPS: %d, duration: %d secs" , sendingTps , durationS )
185190
186191 // Prepare to collect transaction latencies
@@ -192,7 +197,7 @@ func (t *Task) measureTpsWithLoad(loadTarget *txloadtool.LoadTarget, sendingTps,
192197 t .logger .Errorf ("Error during transaction load execution: %v" , execErr )
193198 t .ctx .SetResult (types .TaskResultFailure )
194199
195- return 0 , 0 , execErr
200+ return 0 , 0 , 0 , execErr
196201 }
197202
198203 // Collect the transactions and their latencies
@@ -201,12 +206,12 @@ func (t *Task) measureTpsWithLoad(loadTarget *txloadtool.LoadTarget, sendingTps,
201206 t .logger .Errorf ("Error measuring transaction propagation latencies: %v" , measureErr )
202207 t .ctx .SetResult (types .TaskResultFailure )
203208
204- return 0 , 0 , measureErr
209+ return 0 , 0 , 0 , measureErr
205210 }
206211
207212 // Check if the context was cancelled or other errors occurred
208213 if result .Failed {
209- return 0 , 0 , fmt .Errorf ("error measuring transaction propagation latencies: load failed" )
214+ return 0 , 0 , 0 , fmt .Errorf ("error measuring transaction propagation latencies: load failed" )
210215 }
211216
212217 // Send txes to other clients, for speeding up tx mining
@@ -233,7 +238,7 @@ func (t *Task) measureTpsWithLoad(loadTarget *txloadtool.LoadTarget, sendingTps,
233238 // Calculate the percentile of latencies using result.LatenciesMus
234239 // Not implemented yet
235240 notImpl := errors .New ("percentile selection not implemented, use 0.99" )
236- return 0 , 0 , notImpl
241+ return 0 , 0 , 0 , notImpl
237242 }
238243
239244 t .logger .Infof ("Using 0.99 percentile for latency calculation" )
@@ -243,10 +248,11 @@ func (t *Task) measureTpsWithLoad(loadTarget *txloadtool.LoadTarget, sendingTps,
243248 processedTpsF := float64 (result .TotalTxs ) / result .LastMeasureDelay .Seconds ()
244249 processedTps = int (processedTpsF ) // round
245250 notReceivedP2PEventCount = result .NotReceivedP2PEventCount
251+ coordinatedOmissionEventCount = result .CoordinatedOmissionEventCount
246252
247253 t .logger .Infof ("Processed %d transactions in %.2fs, mean throughput: %.2f tx/s" ,
248254 result .TotalTxs , result .LastMeasureDelay .Seconds (), processedTpsF )
249255 t .logger .Infof ("Sent %d transactions in %.2fs" , result .TotalTxs , result .LastMeasureDelay .Seconds ())
250256
251- return processedTps , notReceivedP2PEventCount , nil
257+ return processedTps , notReceivedP2PEventCount , coordinatedOmissionEventCount , nil
252258}
0 commit comments