X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=tools%2Fxappmock%2Fmodels%2Fprocess_result.go;h=8847d2d133b380c3b86a7cf17291cfd700a949e9;hb=78d25790b63bd8de394108e6d0211a671ea960c8;hp=eb9543f75760c5035e2fa5e829c203ff00d7943b;hpb=bcb124908ffd1de0c00868838bbac733b881fcb2;p=ric-plt%2Fe2mgr.git diff --git a/tools/xappmock/models/process_result.go b/tools/xappmock/models/process_result.go index eb9543f..8847d2d 100644 --- a/tools/xappmock/models/process_result.go +++ b/tools/xappmock/models/process_result.go @@ -17,23 +17,27 @@ package models -import "fmt" +import ( + "fmt" + "go.uber.org/atomic" + "time" +) type ProcessStats struct { - SentCount int - SentErrorCount int - ReceivedExpectedCount int - ReceivedUnexpectedCount int - ReceivedErrorCount int + SentCount atomic.Int32 + SentErrorCount atomic.Int32 + ReceivedExpectedCount atomic.Int32 + ReceivedUnexpectedCount atomic.Int32 + ReceivedErrorCount atomic.Int32 } type ProcessResult struct { - Stats ProcessStats - Err error + StartTime *time.Time + Stats ProcessStats + Err error } -func (pr ProcessResult) String() string { - return fmt.Sprintf("\nNumber of sent messages: %d\nNumber of send errors: %d\n" + - "Number of expected received messages: %d\nNumber of unexpected received messages: %d\n" + - "Number of receive errors: %d\n", pr.Stats.SentCount, pr.Stats.SentErrorCount, pr.Stats.ReceivedExpectedCount, pr.Stats.ReceivedUnexpectedCount, pr.Stats.ReceivedErrorCount) +func (ps ProcessStats) String() string { + return fmt.Sprintf("sent messages: %d | send errors: %d | expected received messages: %d | unexpected received messages: %d | receive errors: %d", + ps.SentCount, ps.SentErrorCount, ps.ReceivedExpectedCount, ps.ReceivedUnexpectedCount, ps.ReceivedErrorCount) }