func CalculateEventCost(rpcstats rpcinfo.RPCStats, start, end stats.Event) time.Duration {
	endEvent := rpcstats.GetEvent(end)
	startEvent := rpcstats.GetEvent(start)
	if startEvent == nil || endEvent == nil {
		return 0
	}
	return endEvent.Time().Sub(startEvent.Time())
}
CalculateEventCost get events from rpcstats, and calculates the time duration of (end - start).
It returns 0 when get nil rpcinfo event of either stats event.
package utils
import (
	"time"
	"github.com/cloudwego/kitex/pkg/rpcinfo"
	"github.com/cloudwego/kitex/pkg/stats"
)