34 static constexpr auto NAME =
"simdb-reports";
40 static void defineSchema(simdb::Schema&);
42 void createPipeline(simdb::pipeline::PipelineManager* pipeline_mgr)
override;
44 void setScheduler(
const Scheduler* scheduler);
49 bool must_exist =
true)
const;
52 const report::format::ReportHeader& header);
55 const std::string& key,
56 const std::string& value);
62 void postInit(
int argc,
char** argv)
override;
67 const std::string& annotation);
69 void postTeardown()
override;
76 std::unordered_set<std::string>& visited_stats,
77 int parent_report_id);
79 using Descriptor = std::tuple<std::string, std::string, std::string, std::string>;
80 std::vector<std::pair<const ReportDescriptor*, Descriptor>> descriptors_;
81 std::unordered_map<const ReportDescriptor*, int> descriptor_ids_;
82 std::unordered_map<const ReportDescriptor*, const report::format::ReportHeader*> descriptor_headers_;
83 std::unordered_map<const ReportDescriptor*, std::vector<int>> descriptor_report_ids_;
84 std::unordered_map<const ReportDescriptor*, std::vector<int>> descriptor_report_style_ids_;
85 std::unordered_map<const ReportDescriptor*, std::vector<int>> descriptor_report_meta_ids_;
86 std::unordered_map<const ReportDescriptor*, std::vector<const StatisticInstance*>> simdb_stats_;
87 std::unordered_map<const ReportDescriptor*, uint64_t> report_start_times_;
88 std::unordered_map<const ReportDescriptor*, uint64_t> report_end_times_;
89 std::unordered_map<const ReportDescriptor*, std::map<std::string, std::string>> report_metadata_;
90 std::unordered_map<const ReportDescriptor*, std::vector<std::pair<uint64_t, std::string>>> report_skip_annotations_;
92 simdb::DatabaseManager* db_mgr_ =
nullptr;
98 : descriptor_(descriptor)
103 ReportAtTick() =
default;
110 uint64_t getTick()
const
120 class ReportStatsAtTick :
public ReportAtTick
125 std::vector<double>&& stats)
126 : ReportAtTick(descriptor, tick)
127 , stats_(std::move(stats))
131 ReportStatsAtTick() =
default;
133 std::vector<char> compress()
const;
136 std::vector<double> stats_;
139 class CompressedReportStatsAtTick :
public ReportAtTick
142 CompressedReportStatsAtTick(ReportStatsAtTick&& uncompressed)
143 : ReportAtTick(uncompressed.getDescriptor(), uncompressed.getTick())
144 , bytes_(uncompressed.compress())
148 CompressedReportStatsAtTick() =
default;
150 const std::vector<char>& getBytes()
const
156 std::vector<char> bytes_;
159 simdb::ConcurrentQueue<ReportStatsAtTick>* pipeline_queue_ =
nullptr;