7 #include "nlohmann/json.hpp"
18 namespace module_identification
25 std::map<const BaseCandidate*, std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, u64>>>>>
m_data;
35 m_data.insert({bc, std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, u64>>>>()});
38 for (
const auto& [processing_step, entries] : oc.
m_timings)
40 for (
const auto& [
type, entry] : entries)
42 for (
const auto& [category, metrics] : entry)
44 for (
const auto& [
name, value] : metrics)
56 void add_stat(
const BaseCandidate* bc,
const std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, u64>>>>& stats)
63 m_data.insert({bc, std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, u64>>>>()});
66 for (
const auto& [processing_step, entries] : stats)
68 for (
const auto& [
type, entry] : entries)
70 for (
const auto& [category, metrics] : entry)
72 for (
const auto& [
name, value] : metrics)
86 std::cout <<
to_json() << std::endl;
91 std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, u64>>>>> m_json_data;
92 for (
const auto& [bc, stats] :
m_data)
94 const auto bc_str = bc->m_gates.front()->get_name() +
" - " + std::to_string(
reinterpret_cast<std::uintptr_t
>(bc));
95 for (
const auto& [processing_step, entries] : stats)
97 for (
const auto& [
type, entry] : entries)
99 for (
const auto& [category, metrics] : entry)
101 for (
const auto& [
name, value] : metrics)
103 m_json_data[bc_str][processing_step][
type][category][
name] = value;
104 m_json_data[bc_str][processing_step][
"TOTAL"][category][
name] += value;
105 m_json_data[
"TOTAL"][processing_step][
type][category][
name] += value;
106 m_json_data[
"TOTAL"][processing_step][
"TOTAL"][category][
name] += value;
113 nlohmann::json j = {m_json_data};
115 return j.dump(indent);
This file contains the definition of the BaseCandidate class, which represents a base candidate in th...
This file contains the enumeration and constants for the candidate types used in the module identific...
Represents a base candidate in the module identification process.
Represents a functional candidate derived from structural candidates.
std::map< std::string, std::map< std::string, std::map< std::string, std::map< std::string, u64 > > > > m_timings
This file contains the class and functions for handling functional candidates within the module ident...
void add_stat(const BaseCandidate *bc, const FunctionalCandidate &oc)
std::string to_json(const u32 indent=0)
std::map< const BaseCandidate *, std::map< std::string, std::map< std::string, std::map< std::string, std::map< std::string, u64 > > > > > m_data
void add_stat(const BaseCandidate *bc, const std::map< std::string, std::map< std::string, std::map< std::string, std::map< std::string, u64 >>>> &stats)