Move over to ABSL logging and flags.
Removes gperftools too since that wants gflags.
Here come the fireworks.
Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/util/BUILD b/aos/util/BUILD
index 7e19d4d..814bab6 100644
--- a/aos/util/BUILD
+++ b/aos/util/BUILD
@@ -63,7 +63,8 @@
target_compatible_with = ["@platforms//os:linux"],
deps = [
"@com_github_google_flatbuffers//:flatbuffers",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
],
)
@@ -203,7 +204,8 @@
target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/time",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
],
)
@@ -346,7 +348,8 @@
deps = [
"//aos/scoped:scoped_fd",
"@com_github_google_flatbuffers//:flatbuffers",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
@@ -390,7 +393,8 @@
":process_info_fbs",
"//aos/containers:ring_buffer",
"//aos/events:event_loop",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
],
)
@@ -418,7 +422,8 @@
hdrs = ["scoped_pipe.h"],
target_compatible_with = ["@platforms//os:linux"],
deps = [
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_absl//absl/types:span",
],
)
@@ -513,8 +518,9 @@
":config_validator_lib",
"//aos:json_to_flatbuffer",
"//aos/testing:googletest",
- "@com_github_gflags_gflags//:gflags",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/flags:flag",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_googletest//:gtest",
],
)
@@ -527,7 +533,8 @@
":foxglove_websocket_lib",
"//aos:init",
"//aos/events:shm_event_loop",
- "@com_github_gflags_gflags//:gflags",
+ "@com_google_absl//absl/flags:flag",
+ "@com_google_absl//absl/flags:usage",
],
)
@@ -561,7 +568,8 @@
"//aos/events/logging:log_writer",
"//aos/network:timestamp_channel",
"//aos/testing:tmpdir",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_googletest//:gtest",
],
)
@@ -616,8 +624,8 @@
target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/containers:inlined_vector",
- "@com_github_google_glog//:glog",
"@com_github_tartanllama_expected",
+ "@com_google_absl//absl/log",
"@com_google_absl//absl/strings:str_format",
],
)
diff --git a/aos/util/config_validator.cc b/aos/util/config_validator.cc
index 0ee1018..660a7bd 100644
--- a/aos/util/config_validator.cc
+++ b/aos/util/config_validator.cc
@@ -1,6 +1,6 @@
#include <memory>
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
#include "gtest/gtest.h"
#include "aos/configuration.h"
@@ -9,9 +9,9 @@
#include "aos/util/config_validator_config_generated.h"
#include "aos/util/config_validator_lib.h"
-DEFINE_string(config, "", "Name of the config file to replay using.");
-DEFINE_string(validation_config, "{}",
- "JSON config to use to validate the config.");
+ABSL_FLAG(std::string, config, "", "Name of the config file to replay using.");
+ABSL_FLAG(std::string, validation_config, "{}",
+ "JSON config to use to validate the config.");
/* This binary is used to validate that all of the
needed remote timestamps channels are in the config
to log the timestamps.
@@ -23,14 +23,14 @@
each one
Reference superstructure_lib_test.cc*/
TEST(ConfigValidatorTest, ReadConfig) {
- ASSERT_TRUE(!FLAGS_config.empty());
+ ASSERT_TRUE(!absl::GetFlag(FLAGS_config).empty());
const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
- aos::configuration::ReadConfig(FLAGS_config);
+ aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
const aos::FlatbufferDetachedBuffer<aos::util::ConfigValidatorConfig>
validator_config =
aos::JsonToFlatbuffer<aos::util::ConfigValidatorConfig>(
- FLAGS_validation_config);
+ absl::GetFlag(FLAGS_validation_config));
aos::util::ConfigIsValid(&config.message(), &validator_config.message());
}
diff --git a/aos/util/config_validator_lib.cc b/aos/util/config_validator_lib.cc
index 4347017..79309b0 100644
--- a/aos/util/config_validator_lib.cc
+++ b/aos/util/config_validator_lib.cc
@@ -13,12 +13,13 @@
#include <utility>
#include <vector>
+#include "absl/flags/declare.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "flatbuffers/buffer.h"
#include "flatbuffers/detached_buffer.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "gflags/gflags_declare.h"
-#include "glog/logging.h"
#include "gtest/gtest.h"
#include "aos/events/event_loop.h"
@@ -36,7 +37,7 @@
#include "aos/util/file.h"
#include "aos/util/simulation_logger.h"
-DECLARE_bool(validate_timestamp_logger_nodes);
+ABSL_DECLARE_FLAG(bool, validate_timestamp_logger_nodes);
namespace aos::util {
diff --git a/aos/util/error_counter.h b/aos/util/error_counter.h
index 7837f9e..c18c019 100644
--- a/aos/util/error_counter.h
+++ b/aos/util/error_counter.h
@@ -4,10 +4,11 @@
#include <array>
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "flatbuffers/buffer.h"
#include "flatbuffers/flatbuffer_builder.h"
#include "flatbuffers/vector.h"
-#include "glog/logging.h"
namespace aos::util {
// Class to manage simple error counters for flatbuffer status message.
diff --git a/aos/util/file.h b/aos/util/file.h
index d0037fd..881af33 100644
--- a/aos/util/file.h
+++ b/aos/util/file.h
@@ -12,8 +12,9 @@
#include <string_view>
#include <vector>
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/types/span.h"
-#include "glog/logging.h"
#include "aos/scoped/scoped_fd.h"
diff --git a/aos/util/filesystem_monitor.cc b/aos/util/filesystem_monitor.cc
index df1dd22..be3229b 100644
--- a/aos/util/filesystem_monitor.cc
+++ b/aos/util/filesystem_monitor.cc
@@ -9,13 +9,14 @@
#include <string_view>
#include <vector>
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/strings/str_split.h"
#include "flatbuffers/buffer.h"
#include "flatbuffers/flatbuffer_builder.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
#include "aos/configuration.h"
#include "aos/events/event_loop.h"
@@ -24,7 +25,8 @@
#include "aos/init.h"
#include "aos/util/filesystem_generated.h"
-DEFINE_string(config, "aos_config.json", "File path of aos configuration");
+ABSL_FLAG(std::string, config, "aos_config.json",
+ "File path of aos configuration");
namespace aos::util {
namespace {
@@ -145,7 +147,7 @@
aos::InitGoogle(&argc, &argv);
aos::FlatbufferDetachedBuffer<aos::Configuration> config =
- aos::configuration::ReadConfig(FLAGS_config);
+ aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
aos::ShmEventLoop shm_event_loop(&config.message());
diff --git a/aos/util/foxglove_websocket.cc b/aos/util/foxglove_websocket.cc
index 57326de..d71ceba 100644
--- a/aos/util/foxglove_websocket.cc
+++ b/aos/util/foxglove_websocket.cc
@@ -1,6 +1,7 @@
#include <string>
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
+#include "absl/flags/usage.h"
#include "aos/configuration.h"
#include "aos/events/shm_event_loop.h"
@@ -8,21 +9,21 @@
#include "aos/init.h"
#include "aos/util/foxglove_websocket_lib.h"
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_uint32(port, 8765, "Port to use for foxglove websocket server.");
-DEFINE_string(mode, "flatbuffer", "json or flatbuffer serialization.");
-DEFINE_bool(fetch_pinned_channels, true,
- "Set this to allow foxglove_websocket to make fetchers on channels "
- "with a read_method of PIN (see aos/configuration.fbs; PIN is an "
- "enum value). Having this enabled will cause foxglove to consume "
- "extra shared memory resources.");
-DEFINE_bool(
- canonical_channel_names, false,
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(uint32_t, port, 8765, "Port to use for foxglove websocket server.");
+ABSL_FLAG(std::string, mode, "flatbuffer", "json or flatbuffer serialization.");
+ABSL_FLAG(bool, fetch_pinned_channels, true,
+ "Set this to allow foxglove_websocket to make fetchers on channels "
+ "with a read_method of PIN (see aos/configuration.fbs; PIN is an "
+ "enum value). Having this enabled will cause foxglove to consume "
+ "extra shared memory resources.");
+ABSL_FLAG(
+ bool, canonical_channel_names, false,
"If set, use full channel names; by default, will shorten names to be the "
"shortest possible version of the name (e.g., /aos instead of /pi/aos).");
int main(int argc, char *argv[]) {
- gflags::SetUsageMessage(
+ absl::SetProgramUsageMessage(
"Runs a websocket server that a foxglove instance can connect to in "
"order to view live data on a device.\n\n"
"Typical Usage: foxglove_websocket [--port 8765]\n"
@@ -51,19 +52,19 @@
aos::InitGoogle(&argc, &argv);
aos::FlatbufferDetachedBuffer<aos::Configuration> config =
- aos::configuration::ReadConfig(FLAGS_config);
+ aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
aos::ShmEventLoop event_loop(&config.message());
aos::FoxgloveWebsocketServer server(
- &event_loop, FLAGS_port,
- FLAGS_mode == "flatbuffer"
+ &event_loop, absl::GetFlag(FLAGS_port),
+ absl::GetFlag(FLAGS_mode) == "flatbuffer"
? aos::FoxgloveWebsocketServer::Serialization::kFlatbuffer
: aos::FoxgloveWebsocketServer::Serialization::kJson,
- FLAGS_fetch_pinned_channels
+ absl::GetFlag(FLAGS_fetch_pinned_channels)
? aos::FoxgloveWebsocketServer::FetchPinnedChannels::kYes
: aos::FoxgloveWebsocketServer::FetchPinnedChannels::kNo,
- FLAGS_canonical_channel_names
+ absl::GetFlag(FLAGS_canonical_channel_names)
? aos::FoxgloveWebsocketServer::CanonicalChannelNames::kCanonical
: aos::FoxgloveWebsocketServer::CanonicalChannelNames::kShortened);
diff --git a/aos/util/foxglove_websocket_lib.cc b/aos/util/foxglove_websocket_lib.cc
index 7a825e4..de19443 100644
--- a/aos/util/foxglove_websocket_lib.cc
+++ b/aos/util/foxglove_websocket_lib.cc
@@ -6,13 +6,14 @@
#include <utility>
#include "absl/container/btree_set.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/strings/escaping.h"
#include "absl/types/span.h"
#include "flatbuffers/reflection_generated.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
#include "nlohmann/json.hpp"
#include <foxglove/websocket/server.hpp>
@@ -24,9 +25,9 @@
#include "aos/time/time.h"
#include "aos/util/mcap_logger.h"
-DEFINE_uint32(sorting_buffer_ms, 100,
- "Amount of time to buffer messages to sort them before sending "
- "them to foxglove.");
+ABSL_FLAG(uint32_t, sorting_buffer_ms, 100,
+ "Amount of time to buffer messages to sort them before sending "
+ "them to foxglove.");
namespace {
// Period at which to poll the fetchers for all the channels.
@@ -117,7 +118,7 @@
// out.
const aos::monotonic_clock::time_point sort_until =
event_loop_->monotonic_now() -
- std::chrono::milliseconds(FLAGS_sorting_buffer_ms);
+ std::chrono::milliseconds(absl::GetFlag(FLAGS_sorting_buffer_ms));
// Pair of <send_time, channel id>.
absl::btree_set<std::pair<aos::monotonic_clock::time_point, ChannelId>>
diff --git a/aos/util/generate_test_log.cc b/aos/util/generate_test_log.cc
index 106e972..c028df7 100644
--- a/aos/util/generate_test_log.cc
+++ b/aos/util/generate_test_log.cc
@@ -1,7 +1,7 @@
#include <chrono>
#include <memory>
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
#include "aos/configuration.h"
#include "aos/events/event_loop.h"
@@ -13,8 +13,8 @@
#include "aos/init.h"
#include "aos/testing/path.h"
-DEFINE_string(output_folder, "",
- "Name of folder to write the generated logfile to.");
+ABSL_FLAG(std::string, output_folder, "",
+ "Name of folder to write the generated logfile to.");
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
@@ -38,7 +38,7 @@
std::unique_ptr<aos::EventLoop> log_writer_event_loop =
event_loop_factory.MakeEventLoop("log_writer");
aos::logger::Logger writer(log_writer_event_loop.get());
- writer.StartLoggingOnRun(FLAGS_output_folder);
+ writer.StartLoggingOnRun(absl::GetFlag(FLAGS_output_folder));
event_loop_factory.RunFor(std::chrono::seconds(10));
return 0;
diff --git a/aos/util/log_to_mcap.cc b/aos/util/log_to_mcap.cc
index 11b7940..9dc9cdb 100644
--- a/aos/util/log_to_mcap.cc
+++ b/aos/util/log_to_mcap.cc
@@ -6,9 +6,10 @@
#include <string>
#include <vector>
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "flatbuffers/reflection_generated.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
#include "aos/configuration.h"
#include "aos/events/event_loop.h"
@@ -21,23 +22,23 @@
#include "aos/util/clock_timepoints_schema.h"
#include "aos/util/mcap_logger.h"
-DEFINE_string(node, "", "Node to replay from the perspective of.");
-DEFINE_string(output_path, "/tmp/log.mcap", "Log to output.");
-DEFINE_string(mode, "flatbuffer", "json or flatbuffer serialization.");
-DEFINE_bool(
- canonical_channel_names, false,
+ABSL_FLAG(std::string, node, "", "Node to replay from the perspective of.");
+ABSL_FLAG(std::string, output_path, "/tmp/log.mcap", "Log to output.");
+ABSL_FLAG(std::string, mode, "flatbuffer", "json or flatbuffer serialization.");
+ABSL_FLAG(
+ bool, canonical_channel_names, false,
"If set, use full channel names; by default, will shorten names to be the "
"shortest possible version of the name (e.g., /aos instead of /pi/aos).");
-DEFINE_bool(compress, true, "Whether to use LZ4 compression in MCAP file.");
-DEFINE_bool(include_clocks, true,
- "Whether to add a /clocks channel that publishes all nodes' clock "
- "offsets.");
-DEFINE_bool(include_pre_start_messages, false,
- "If set, *all* messages in the logfile will be included, including "
- "any that may have occurred prior to the start of the log. This "
- "can be used to see additional data, but given that data may be "
- "incomplete prior to the start of the log, you should be careful "
- "about interpretting data flow when using this flag.");
+ABSL_FLAG(bool, compress, true, "Whether to use LZ4 compression in MCAP file.");
+ABSL_FLAG(bool, include_clocks, true,
+ "Whether to add a /clocks channel that publishes all nodes' clock "
+ "offsets.");
+ABSL_FLAG(bool, include_pre_start_messages, false,
+ "If set, *all* messages in the logfile will be included, including "
+ "any that may have occurred prior to the start of the log. This "
+ "can be used to see additional data, but given that data may be "
+ "incomplete prior to the start of the log, you should be careful "
+ "about interpretting data flow when using this flag.");
// Converts an AOS log to an MCAP log that can be fed into Foxglove. To try this
// out, run:
@@ -55,7 +56,7 @@
const std::set<std::string> logger_nodes = aos::logger::LoggerNodes(logfiles);
CHECK_LT(0u, logger_nodes.size());
const std::string logger_node = *logger_nodes.begin();
- std::string replay_node = FLAGS_node;
+ std::string replay_node = absl::GetFlag(FLAGS_node);
if (replay_node.empty()) {
if (logger_nodes.size() == 1u) {
LOG(INFO) << "Guessing \"" << logger_node
@@ -69,7 +70,7 @@
std::optional<aos::FlatbufferDetachedBuffer<aos::Configuration>> config;
- if (FLAGS_include_clocks) {
+ if (absl::GetFlag(FLAGS_include_clocks)) {
aos::logger::LogReader config_reader(logfiles);
if (aos::configuration::MultiNode(config_reader.configuration())) {
@@ -103,7 +104,7 @@
std::unique_ptr<aos::ClockPublisher> clock_publisher;
std::unique_ptr<aos::EventLoop> mcap_event_loop;
- CHECK(!FLAGS_output_path.empty());
+ CHECK(!absl::GetFlag(FLAGS_output_path).empty());
std::unique_ptr<aos::McapLogger> relogger;
auto startup_handler = [&relogger, &mcap_event_loop, &reader,
&clock_event_loop, &clock_publisher, &factory,
@@ -112,22 +113,23 @@
"files from multi-boot logs.";
mcap_event_loop = reader.event_loop_factory()->MakeEventLoop("mcap", node);
relogger = std::make_unique<aos::McapLogger>(
- mcap_event_loop.get(), FLAGS_output_path,
- FLAGS_mode == "flatbuffer" ? aos::McapLogger::Serialization::kFlatbuffer
- : aos::McapLogger::Serialization::kJson,
- FLAGS_canonical_channel_names
+ mcap_event_loop.get(), absl::GetFlag(FLAGS_output_path),
+ absl::GetFlag(FLAGS_mode) == "flatbuffer"
+ ? aos::McapLogger::Serialization::kFlatbuffer
+ : aos::McapLogger::Serialization::kJson,
+ absl::GetFlag(FLAGS_canonical_channel_names)
? aos::McapLogger::CanonicalChannelNames::kCanonical
: aos::McapLogger::CanonicalChannelNames::kShortened,
- FLAGS_compress ? aos::McapLogger::Compression::kLz4
- : aos::McapLogger::Compression::kNone);
- if (FLAGS_include_clocks) {
+ absl::GetFlag(FLAGS_compress) ? aos::McapLogger::Compression::kLz4
+ : aos::McapLogger::Compression::kNone);
+ if (absl::GetFlag(FLAGS_include_clocks)) {
clock_event_loop =
reader.event_loop_factory()->MakeEventLoop("clock", node);
clock_publisher = std::make_unique<aos::ClockPublisher>(
&factory, clock_event_loop.get());
}
};
- if (FLAGS_include_pre_start_messages) {
+ if (absl::GetFlag(FLAGS_include_pre_start_messages)) {
// Note: This condition is subtly different from just using --fetch from
// mcap_logger.cc. Namely, if there is >1 message on a given channel prior
// to the logfile start, then fetching in the reader OnStart() is
diff --git a/aos/util/mcap_logger.cc b/aos/util/mcap_logger.cc
index a70da62..47f8298 100644
--- a/aos/util/mcap_logger.cc
+++ b/aos/util/mcap_logger.cc
@@ -6,6 +6,9 @@
#include <ostream>
#include <set>
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/types/span.h"
#include "flatbuffers/buffer.h"
@@ -15,9 +18,6 @@
#include "flatbuffers/reflection_generated.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-#include "glog/vlog_is_on.h"
#include "lz4/lz4frame.h"
#include "nlohmann/json.hpp"
@@ -26,14 +26,14 @@
#include "aos/flatbuffer_merge.h"
#include "aos/json_to_flatbuffer.h"
-DEFINE_uint64(mcap_chunk_size, 10'000'000,
- "Size, in bytes, of individual MCAP chunks");
-DEFINE_bool(fetch, false,
- "Whether to fetch most recent messages at start of logfile. Turn "
- "this on if there are, e.g., one-time messages sent before the "
- "start of the logfile that you need access to. Turn it off if you "
- "don't want to deal with having messages that have timestamps that "
- "may be arbitrarily far before any other interesting messages.");
+ABSL_FLAG(uint64_t, mcap_chunk_size, 10'000'000,
+ "Size, in bytes, of individual MCAP chunks");
+ABSL_FLAG(bool, fetch, false,
+ "Whether to fetch most recent messages at start of logfile. Turn "
+ "this on if there are, e.g., one-time messages sent before the "
+ "start of the logfile that you need access to. Turn it off if you "
+ "don't want to deal with having messages that have timestamps that "
+ "may be arbitrarily far before any other interesting messages.");
namespace aos {
@@ -246,13 +246,13 @@
ChunkStatus *chunk = ¤t_chunks_[id];
WriteMessage(id, channel, context, chunk);
if (static_cast<uint64_t>(chunk->data.tellp()) >
- FLAGS_mcap_chunk_size) {
+ absl::GetFlag(FLAGS_mcap_chunk_size)) {
WriteChunk(chunk);
}
});
fetchers_[id] = event_loop_->MakeRawFetcher(channel);
event_loop_->OnRun([this, id, channel]() {
- if (FLAGS_fetch && fetchers_[id]->Fetch()) {
+ if (absl::GetFlag(FLAGS_fetch) && fetchers_[id]->Fetch()) {
WriteMessage(id, channel, fetchers_[id]->context(),
¤t_chunks_[id]);
}
diff --git a/aos/util/phased_loop.cc b/aos/util/phased_loop.cc
index 5f87bd0..92bda13 100644
--- a/aos/util/phased_loop.cc
+++ b/aos/util/phased_loop.cc
@@ -3,7 +3,8 @@
#include <compare>
#include <ratio>
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
namespace aos::time {
diff --git a/aos/util/scoped_pipe.cc b/aos/util/scoped_pipe.cc
index d178c0d..7983f7b 100644
--- a/aos/util/scoped_pipe.cc
+++ b/aos/util/scoped_pipe.cc
@@ -6,7 +6,8 @@
#include <ostream>
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
namespace aos::util {
diff --git a/aos/util/status.cc b/aos/util/status.cc
index dbcd4af..e608ed5 100644
--- a/aos/util/status.cc
+++ b/aos/util/status.cc
@@ -1,5 +1,9 @@
#include "aos/util/status.h"
+#include "absl/log/log.h"
+
+#include "aos/containers/inlined_vector.h"
+
namespace aos {
namespace {
// Constructs a string view from the provided buffer if it has data and
diff --git a/aos/util/status.h b/aos/util/status.h
index fa2f4f0..9880fc7 100644
--- a/aos/util/status.h
+++ b/aos/util/status.h
@@ -4,8 +4,8 @@
#include <source_location>
#include <string_view>
+#include "absl/log/log.h"
#include "absl/strings/str_format.h"
-#include "glog/logging.h"
#include "tl/expected.hpp"
#include "aos/containers/inlined_vector.h"
diff --git a/aos/util/status_test.cc b/aos/util/status_test.cc
index b838636..fe77c61 100644
--- a/aos/util/status_test.cc
+++ b/aos/util/status_test.cc
@@ -8,8 +8,6 @@
#include "aos/realtime.h"
#include "aos/testing/path.h"
-DECLARE_bool(die_on_malloc);
-
namespace aos::testing {
class ErrorTest : public ::testing::Test {
protected:
diff --git a/aos/util/threaded_consumer.h b/aos/util/threaded_consumer.h
index 471f6e1..05508a8 100644
--- a/aos/util/threaded_consumer.h
+++ b/aos/util/threaded_consumer.h
@@ -5,7 +5,8 @@
#include <optional>
#include <thread>
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "aos/condition.h"
#include "aos/containers/ring_buffer.h"
diff --git a/aos/util/top.cc b/aos/util/top.cc
index 8a78609..28b4e69 100644
--- a/aos/util/top.cc
+++ b/aos/util/top.cc
@@ -15,6 +15,8 @@
#include <string_view>
#include <vector>
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/numeric/int128.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
@@ -22,7 +24,6 @@
#include "absl/strings/str_split.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "glog/logging.h"
#define PF_KTHREAD 0x00200000
@@ -225,9 +226,8 @@
// Verify we can open the directory.
DIR *dir = opendir(task_dir.c_str());
if (dir == nullptr) {
- LOG_EVERY_T(WARNING, 10) << "Unable to open directory: " << task_dir
- << ", error: " << strerror(errno);
- ;
+ LOG_EVERY_N_SEC(WARNING, 10) << "Unable to open directory: " << task_dir
+ << ", error: " << strerror(errno);
return;
}
diff --git a/aos/util/top_test.cc b/aos/util/top_test.cc
index 7d9d2bb..9dc9c8c 100644
--- a/aos/util/top_test.cc
+++ b/aos/util/top_test.cc
@@ -13,10 +13,12 @@
#include <thread>
#include <vector>
+#include "absl/flags/flag.h"
+#include "absl/flags/reflection.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "flatbuffers/string.h"
#include "flatbuffers/vector.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
#include "gtest/gtest.h"
#include <gmock/gmock.h>
@@ -40,7 +42,7 @@
class TopTest : public ::testing::Test {
protected:
TopTest()
- : shm_dir_(aos::testing::TestTmpDir() + "/aos"),
+ : shm_dir_(aos::testing::TestTmpDir()),
cpu_consumer_([this]() {
SetThreadName(std::string(kTestCPUConsumer));
while (!stop_flag_.load()) {
@@ -50,18 +52,18 @@
aos::testing::ArtifactPath("aos/events/pingpong_config.json")),
config_(aos::configuration::ReadConfig(config_file_)),
event_loop_(&config_.message()) {
- FLAGS_shm_base = shm_dir_;
+ aos::testing::SetShmBase(shm_dir_);
// Nuke the shm dir, to ensure we aren't being affected by any preexisting
// tests.
- aos::util::UnlinkRecursive(shm_dir_);
+ aos::util::UnlinkRecursive(shm_dir_ + "/aos");
}
~TopTest() {
stop_flag_ = true;
cpu_consumer_.join();
}
- gflags::FlagSaver flag_saver_;
+ absl::FlagSaver flag_saver_;
std::string shm_dir_;
std::thread cpu_consumer_;
diff --git a/aos/util/trapezoid_profile.cc b/aos/util/trapezoid_profile.cc
index be61889..4bd65fa 100644
--- a/aos/util/trapezoid_profile.cc
+++ b/aos/util/trapezoid_profile.cc
@@ -6,7 +6,8 @@
#include <cstdlib>
#include <ostream>
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "aos/time/time.h"