-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix issue #8055 missing timestamps on serial monitor #8088
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
Conversation
Also, introduce 3 new dependencies for testing scope only. Testing dynamic behavior with Mockito library enables better test coverage
@nitram509 , thanks for your contributions, but this still won't work as expected, the sketch:
prints: instead it should be:
The problem is that the variable Now, things that should be improved:
String now = new SimpleDateFormat("HH:mm:ss.SSS -> ").format(new Date()); is very bad because it creates a new SimpleDateFormat that parses "HH:mm:ss.SSS" and creates all the internal structures to format the date string each time the
// Pre-allocate all objects used for streaming data
Date t = new Date();
String now;
StringBuilder out = new StringBuilder(16384);
boolean isStartingLine = false; was meant to be created once for all at startup, so they should really be fields of Finally, can you explain briefly what the added jars do? I see that they are related to tests, that is a good thing, but I'd like to know a bit more. |
This PR https://github.com/arduino/Arduino/pull/8131/files?w=1 moves the |
Thank you for providing, this feedback. And thank you very much for catching/spotting a scenario, my this PR did not cover yet. Please, allow me some feedback to your comments as well.
Assuming there are only 30 instances per second created, my gut feeling says this is OK.
The JARs are only required for TEST phase and not needed at deployment/runtime of Arduino program. |
This duplicates #8131 |
I did a small comparison by using VisualGC graphs TL;DRTo me they look almost identical. Test methodology
Results1. monitoring PR #81312. monitoring PR #8055 |
…p should be printed
The test sketch you're using is slowed down, you should remove the
This sketch is able to crash old versions of the Arduino IDE, or even make the PC unresponsive.
oh, you're right, what I was referring to is the method
The |
Thank you for your feedback, @cmaglie. Indeed, for a full regression test, the delay() will not work. When there is a single-thread guarantee for the UI, than using a non-thread-safe class would cause probably no harm. Thanks for pointing this out. Do you have any thoughts regarding the tests or newly included JARs? Since we have two PRs with the same purpose, I would like to leave my ego out and come to a conclusion or suggestion/proposal for the core DEV team (I don't know if you are part of, are you?). May I ask for you input too, to collect some criteria to compare the two PRs (see below)? Since the feature is implemented in both, it seems to me, we could just focus on non-functional criteria.
My view so far:
Simple point wise it's a draw so far ;) I'm curious and looking forward to read your opinion. |
Hi @nitram509, I've made some tests with an Arduino Due, indeed the performance difference is negligible, I was deceived by the At this point I would like to merge this one, but I have a last concern looking at your patch: I see that you changed the boolean field I think that you made the public void message(String msg) {
SwingUtilities.invokeLater(() -> updateTextArea(msg));
}
boolean isStartingLine = true;
//other fields here, instead of passing them in runnable constructor...
void updateTextArea(String msg) {
....the body of the old UpdateTextAreaAction.run() method here....
} |
The overhead is negligible and this design simplifies a lot the class structure. More discussion here: arduino#8088 (comment)
The overhead is negligible and this design simplifies a lot the class structure. More discussion here: #8088 (comment)
Hi @nitram509 This one is taking too much dev-time, in the end I opted to pick your first commit, changed the class into a method (that "incidentally" fix also the Thanks for all your feedback! |
The root cause was a wrong initialized variable "isStartingLine".
Additionally, I did refactor the lambda method to an inner class,
in order to make it more convenient to write a unit test (UpdateTextAreaActionTest)
This PR also introduces 3 new dependencies for testing scope only.
Testing dynamic behavior with Mockito library enables better test coverage.
As usual, any feedback is welcome.
@cmaglie I would be glad if you could have a look, since you originally developed it.