MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / Init

Method Init

simcore/framework/perf/test_module.cc:16–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14class PerfModule final : public SimModule {
15 public:
16 void Init(InitHelper& h) override {
17 std::string v = h.GetParameter("sub_topics");
18 if (!v.empty()) {
19 boost::split(subs_, v, boost::is_any_of(","));
20 for (const std::string& s : subs_) h.Subscribe(s);
21 }
22 v = h.GetParameter("pub_topics");
23 if (!v.empty()) {
24 boost::split(pubs_, v, boost::is_any_of(","));
25 for (const std::string& p : pubs_) h.Publish(p);
26 }
27 if (subs_.empty() && pubs_.empty()) throw std::invalid_argument("at least one sub_topics/pub_topics provided.");
28
29 msg_size_ = std::stoi(h.GetParameter("msg_size"));
30 pub_payload_.assign(msg_size_, 's');
31 }
32
33 void Reset(ResetHelper& h) override {
34 last_step_time_ = total_step_calling_period_ = max_step_calling_period_ = total_step_execution_time_ =

Callers

nothing calls this directly

Calls 6

splitFunction · 0.85
GetParameterMethod · 0.45
emptyMethod · 0.45
SubscribeMethod · 0.45
PublishMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected