-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add time sync logs #205
Conversation
@@ -1229,6 +1242,7 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder | |||
rti.triggerInteraction(simulationStepResult.getTrafficDetectorUpdates()); | |||
this.rti.triggerInteraction(simulationStepResult.getTrafficLightUpdates()); | |||
receivedSimulationStep = false; | |||
firstTimePrintingTime = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need both of these variables. receivedSimulationStep
should be !firstTimePrintingTime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they are meant for different cases.
receivedSimulationStep
is flagged when carla
returns with some handshake to sumoAmbassador. However, sumoAmbassador is called many times before that by MOSAIC.
firstTimePrintingTime
is meant to track the first time ever sumoAmbassador is called to progressTime. And that is by design.
In other words, we can't reuse the same variable, because if we pick !receivedSimulationStep
, the log will still end up printing many times in almost like 1ms apart. This firstTimePrintingTime
is meant to avoid such excessive logging.
@@ -87,6 +93,18 @@ public void runSimulation() throws InternalFederateException, IllegalValueExcept | |||
if (ambassador != null) { | |||
federation.getMonitor().onBeginActivity(event); | |||
long startTime = System.currentTimeMillis(); | |||
|
|||
if (!logging_map.containsKey(event.getFederateId())) // first time printing, then directly save the last simulation time requested and print |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should all be avoidable by setting log level to info. All this should be inside an if for log level debug or trace and we may want to leave a comment to consider reworking this. What you really want is just data about when each federate progresses in time. This is probably not a long term solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could even just make this whole block a method that takes in event and start time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Address code smells. |
Confirmed that this works. I enabled DEBUG in logback.xml to get this:
|
Quality Gate failedFailed conditions |
PR Details
Description
Adds logs to support usdot-fhwa-stol/carma-analytics-fotda#43
Related GitHub Issue
Related Jira Key
CDAR-774
Motivation and Context
Data Analysis
How Has This Been Tested?
Types of changes
Checklist: