blob: ab7ca722295cfcdce89cc7efa496c0f1be153701 [file] [log] [blame]
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -05001#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
9namespace phosphor
10{
11namespace dump
12{
13namespace system
14{
15
16using namespace phosphor::logging;
17
18void 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