Do it empirically and compare with other contracts (samples). The most precise measurement you can get.
in core/state_transition.go
modify TransitionDb()
function to capture current time and, then do a difference with the time after the execution of your contract. Theses are the lines you have to modify:
if contractCreation {
ret, _, st.gas, vmerr = evm.Create(sender, st.data, st.gas, st.value)
} else {
// Increment the nonce for the next transaction
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
ret, st.gas, vmerr = evm.Call(sender, st.to(), st.data, st.gas, st.value)
}
This is how you would take the time:
start_ts:=time.Now().UnixNano() / int64(time.Millisecond)
if contractCreation {
ret, _, st.gas, vmerr = evm.Create(sender, st.data, st.gas, st.value)
} else {
// Increment the nonce for the next transaction
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
ret, st.gas, vmerr = evm.Call(sender, st.to(), st.data, st.gas, st.value)
}
end_ts:=time.Now().UnixNano() / int64(time.Millisecond)
log.Info(fmt.Sprintf("Call() time: %v ms",(end_ts-start_ts)))
The above code has not been tested.