From 607b0edc013708f816797294b24503a5017ceafe Mon Sep 17 00:00:00 2001 From: emanuel Date: Tue, 22 Feb 2022 16:38:55 +0000 Subject: [PATCH] Log PCM reply time --- src/pcm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pcm.c b/src/pcm.c index 8689ea3..32b2aee 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -173,7 +173,14 @@ static int pcm_check_handle_reply(facilities_t* facilities, PCM_t* pcm, mc_neigh CoordinationReply_t* reply = &pcm->pcm.maneuverContainer.choice.vehicle.negotiation->choice.reply; - syslog_info("[facilities] [pc] received PCM.reply with %d accepted trajectories", reply->acceptedTrajectoriesIds.list.count); + pthread_mutex_lock(&facilities->epv.time.lock); + uint64_t now_us = it2s_tender_get_now(TIME_MICROSECONDS); + pthread_mutex_unlock(&facilities->epv.time.lock); + + syslog_info("[facilities] [pc] received PCM.reply with %d accepted trajectories | took %ld us", reply->acceptedTrajectoriesIds.list.count, now_us-neighbour->t_iid); + + neighbour->intersecting = false; + neighbour->proposed = false; return rv; } @@ -193,13 +200,17 @@ static int pcm_check_intersection_detected(facilities_t* facilities, PCM_t* pcm, uint64_t now = it2s_tender_get_clock(&facilities->epv); - if (now < neighbour->t_iid + MC_RESOLUTION_TIMEOUT) { + if (now < neighbour->t_iid/1000 + MC_RESOLUTION_TIMEOUT) { rv = 0; goto cleanup; } neighbour->intersecting = true; - neighbour->t_iid = now; + + pthread_mutex_lock(&facilities->epv.time.lock); + uint64_t now_us = it2s_tender_get_now(TIME_MICROSECONDS) ; + pthread_mutex_unlock(&facilities->epv.time.lock); + neighbour->t_iid = now_us; if (now < neighbour->t_proposal + MC_RESOLUTION_TIMEOUT) { rv = 0;