| 9 | using namespace cg; |
| 10 | |
| 11 | void StaticMemRecorder::dump_to_json() { |
| 12 | VisableDataSet writer(m_log_dir); |
| 13 | for (auto&& i : m_memory_chunk_recorder) { |
| 14 | // static mem chunk |
| 15 | if (i.id < m_weight_chunk_id) { |
| 16 | std::string overwrite_dest_id = |
| 17 | i.is_overwrite ? std::to_string(i.overwrite_dest_id) : "-1"; |
| 18 | Chunk c(std::to_string(i.id), Chunk::static_mem, |
| 19 | std::to_string(i.time_begin), std::to_string(i.time_end), |
| 20 | std::to_string(i.addr_begin), std::to_string(i.addr_end), |
| 21 | overwrite_dest_id); |
| 22 | writer.dump_info(c); |
| 23 | } else { |
| 24 | // weight mem chunk |
| 25 | Chunk c(std::to_string(i.id), Chunk::weight_mem, |
| 26 | std::to_string(i.time_begin), std::to_string(i.time_end), |
| 27 | std::to_string(i.addr_begin), std::to_string(i.addr_end), "-1"); |
| 28 | writer.dump_info(c); |
| 29 | } |
| 30 | } |
| 31 | for (auto&& i : m_opr_seq_recorder) { |
| 32 | OprSeq o(std::to_string(i.id), i.name); |
| 33 | writer.dump_info(o); |
| 34 | } |
| 35 | writer.write_to_file(); |
| 36 | } |
| 37 | #endif |
| 38 | #endif |
no test coverage detected