Add encoding profiling to aos logger
The diagnostic data logger compression uses a significant amount
of CPU. To help profile the system, this change will record the
encode time for each message.
When profiling is enabled (through constructor argument) the encode
times will be collected in a log along with the event loop
monotonic clock time stamps.
Add a python script to create a graph of the encode_times from
the logger.
Change-Id: If1cc19fbffe0ff31f63e5789f610c4ca40a9d47a
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index d781a20..f9a62b1 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -73,8 +73,9 @@
// Triggers a flush if there's enough data queued up.
//
// Steals the detached buffer from it.
- void CopyMessage(DataEncoder::Copier *coppier,
- aos::monotonic_clock::time_point now);
+ // Returns the duration of time spent on encoding the message.
+ std::chrono::nanoseconds CopyMessage(DataEncoder::Copier *copier,
+ aos::monotonic_clock::time_point now);
// Indicates we got ENOSPC when trying to write. After this returns true, no
// further data is written.