Actually manage memory in the old-style AOS logging
LeakSanitizer should be happy with it now. It's also still just as
thread-safe.
Change-Id: Id09a0349657cf4f719267b053f0ea3d8ec366256
diff --git a/aos/ipc_lib/named_pipe_latency.cc b/aos/ipc_lib/named_pipe_latency.cc
index 6683f59..c3f5c5c 100644
--- a/aos/ipc_lib/named_pipe_latency.cc
+++ b/aos/ipc_lib/named_pipe_latency.cc
@@ -19,7 +19,8 @@
// pipe.
DEFINE_bool(sender, true, "If true, send signals to the other process.");
-DEFINE_string(fifo, "/dev/shm/aos/named_pipe_latency", "FIFO to use for the test.");
+DEFINE_string(fifo, "/dev/shm/aos/named_pipe_latency",
+ "FIFO to use for the test.");
DEFINE_int32(seconds, 10, "Duration of the test to run");
DEFINE_int32(
latency_threshold, 1000,
@@ -36,7 +37,8 @@
namespace aos {
void SenderThread() {
- int pipefd = open(FLAGS_fifo.c_str(), FD_CLOEXEC | O_NONBLOCK | O_WRONLY | O_NOATIME);
+ int pipefd =
+ open(FLAGS_fifo.c_str(), FD_CLOEXEC | O_NONBLOCK | O_WRONLY | O_NOATIME);
const monotonic_clock::time_point end_time =
monotonic_clock::now() + chrono::seconds(FLAGS_seconds);
// Standard mersenne_twister_engine seeded with 0
@@ -75,7 +77,8 @@
}
void ReceiverThread() {
- int pipefd = open(FLAGS_fifo.c_str(), O_CLOEXEC | O_NONBLOCK | O_RDONLY | O_NOATIME);
+ int pipefd =
+ open(FLAGS_fifo.c_str(), O_CLOEXEC | O_NONBLOCK | O_RDONLY | O_NOATIME);
Tracing t;
t.Start();
@@ -151,8 +154,7 @@
FLAGS_timer_priority);
});
- ::std::thread st(
- []() { SenderThread(); });
+ ::std::thread st([]() { SenderThread(); });
ReceiverThread();
st.join();
@@ -167,8 +169,6 @@
::gflags::ParseCommandLineFlags(&argc, &argv, true);
::aos::logging::Init();
- ::aos::logging::SetImplementation(
- new ::aos::logging::StreamLogImplementation(stdout));
return ::aos::Main(argc, argv);
}