mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 19:33:49 +08:00
Put journal and nvme stats in bootlog (#22849)
* Run commands and put output in bootlog * log nvme * fix indent * cereal without event * use regular array
This commit is contained in:
@@ -5,7 +5,14 @@
|
||||
#include "selfdrive/common/swaglog.h"
|
||||
#include "selfdrive/loggerd/logger.h"
|
||||
|
||||
|
||||
static kj::Array<capnp::word> build_boot_log() {
|
||||
std::vector<std::string> bootlog_commands;
|
||||
if (Hardware::TICI()) {
|
||||
bootlog_commands.push_back("journalctl");
|
||||
bootlog_commands.push_back("sudo nvme smart-log --output-format=json /dev/nvme0");
|
||||
}
|
||||
|
||||
MessageBuilder msg;
|
||||
auto boot = msg.initEvent().initBoot();
|
||||
|
||||
@@ -30,6 +37,20 @@ static kj::Array<capnp::word> build_boot_log() {
|
||||
}
|
||||
}
|
||||
|
||||
// Gather output of commands
|
||||
i = 0;
|
||||
auto commands = boot.initCommands().initEntries(bootlog_commands.size());
|
||||
for (auto &command : bootlog_commands) {
|
||||
auto lentry = commands[i];
|
||||
|
||||
lentry.setKey(command);
|
||||
|
||||
const std::string result = util::check_output(command);
|
||||
lentry.setValue(capnp::Data::Reader((const kj::byte*)result.data(), result.size()));
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
boot.setLaunchLog(util::read_file("/tmp/launch_log"));
|
||||
return capnp::messageToFlatArray(msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user