Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame^] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "dump_manager_system.hpp" |
| 4 | |
| 5 | #include "system_dump_entry.hpp" |
| 6 | |
| 7 | #include <phosphor-logging/elog.hpp> |
| 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace dump |
| 12 | { |
| 13 | namespace system |
| 14 | { |
| 15 | |
| 16 | using namespace phosphor::logging; |
| 17 | |
| 18 | void Manager::notify(NewDump::DumpType dumpType, uint32_t dumpId, uint64_t size) |
| 19 | { |
| 20 | |
| 21 | if (dumpType != NewDump::DumpType::System) |
| 22 | { |
| 23 | log<level::ERR>("Only system dump is supported", |
| 24 | entry("DUMPTYPE=%d", dumpType)); |
| 25 | return; |
| 26 | } |
| 27 | // Get the timestamp |
| 28 | auto ms = std::chrono::duration_cast<std::chrono::milliseconds>( |
| 29 | std::chrono::system_clock::now().time_since_epoch()) |
| 30 | .count(); |
| 31 | // Get the id |
| 32 | auto id = lastEntryId + 1; |
| 33 | auto idString = std::to_string(id); |
| 34 | auto objPath = fs::path(baseEntryPath) / idString; |
| 35 | entries.insert(std::make_pair( |
| 36 | id, std::make_unique<system::Entry>(bus, objPath.c_str(), id, ms, size, |
| 37 | dumpId, *this))); |
| 38 | lastEntryId++; |
| 39 | } |
| 40 | |
| 41 | } // namespace system |
| 42 | } // namespace dump |
| 43 | } // namespace phosphor |