3 ms·
> the debugger is likely to change the timing And the print will 100% change the timing.
by mrheosuper 1y ago
> the debugger is likely to change the timing
And the print will 100% change the timing.
- seanmcdirmid 1y agoYes, but often no where as drastic as the debugger. In Android we have huge logs anyways, a few more printf statements aren’t going to hurt.
- PhilipRoman 1y agoLog to a memory ring buffer (if you need extreme precision, prefetch everything and write binary fixed size "log entries"), flush asynchronously at some point when you don't care about timing anymore. Really helpful in kernel debugging.
- mrheosuper 1y agoFormatting log still takes considerable computing, especially when working on embedded system, where your cpu is only a few hundreds MHz.
- sandos 1y agoHence the mention of binary stuff.... We use ftrace in linux and we limit ourselves a lot on what we "print".
- rcxdude 1y agoYou don't need to format the log on-device. You can push a binary representation and format when you need to display it. Look a 'defmt' for an example of this approach. Logging overhead in the path that emits the log messages can be tens of instructions.