75 O2_SIGNPOST_START(topology, sid,
"expendableDataDeps",
"Checking if %s depends on %s",
a.name.c_str(),
b.name.c_str());
76 if (
a.name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos &&
77 b.name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos) {
78 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. Dummy sink never depends on itself.");
82 if (
b.name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos) {
83 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. %s is dummy sink and it nothing can depend on it.",
b.name.c_str());
86 if (
a.name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos) {
87 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"true. %s is dummy sink and it nothing can depend on it.",
a.name.c_str());
92 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"true. %s has a data dependency on %s",
a.name.c_str(),
b.name.c_str());
99 if (
label.value ==
"expendable") {
106 if (
label.value ==
"resilient") {
111 bool isBExpendable = std::find_if(
b.labels.begin(),
b.labels.end(), checkExpendable) !=
b.labels.end();
112 bool isAExpendable = std::find_if(
a.labels.begin(),
a.labels.end(), checkExpendable) !=
a.labels.end();
113 bool bResilient = std::find_if(
b.labels.begin(),
b.labels.end(), checkResilient) !=
b.labels.end();
116 if (!isAExpendable && !isBExpendable) {
117 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. Neither %s nor %s are expendable. No dependency beyond data deps.",
118 a.name.c_str(),
b.name.c_str());
122 if (isAExpendable && isBExpendable) {
123 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. Both %s and %s are expendable. No dependency.",
124 a.name.c_str(),
b.name.c_str());
129 if (isAExpendable && bResilient) {
130 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. %s is expendable but %s is resilient, no need to add an unneeded dependency",
131 a.name.c_str(),
b.name.c_str());
138 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"%s is expendable. %s from %s to %s => %s.",
139 a.name.c_str(), hasDependency ?
"There is however an inverse dependency" :
"No inverse dependency",
b.name.c_str(),
a.name.c_str(),
140 !hasDependency ?
"true" :
"false");
141 return !hasDependency;
144 O2_SIGNPOST_END(topology, sid,
"expendableDataDeps",
"false. %s is expendable but %s is not. No need to add an unneeded dependency.",
145 b.name.c_str(),
a.name.c_str());
160 O2_SIGNPOST_START(topology, sid,
"alwaysDependent",
"Checking if %s depends on %s", dependent.
name.c_str(), ancestor.name.c_str());
161 if (dependent.
name == ancestor.name) {
162 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"false. %s and %s are the same.", dependent.
name.c_str(), ancestor.name.c_str());
165 if (ancestor.name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos) {
166 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"false. Nothing can depend on %s by policy.", ancestor.name.c_str());
170 if (dependent.
name.find(
"internal-dpl-injected-dummy-sink") != std::string::npos) {
171 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"true. %s is always last.", ancestor.name.c_str());
174 const std::regex matcher(
".*output-proxy.*");
177 bool isAncestorOutputProxy = std::regex_match(ancestor.name.data(),
m, matcher);
179 assert(std::regex_match(dependent.
name.data(),
m, matcher));
180 bool isAncestorExpendable = std::find_if(ancestor.labels.begin(), ancestor.labels.end(), [](
DataProcessorLabel const&
label) {
181 return label.value ==
"expendable";
182 }) != ancestor.labels.end();
185 return label.value ==
"resilient";
186 }) != dependent.
labels.end();
187 bool isAncestorResilient = std::find_if(ancestor.labels.begin(), ancestor.labels.end(), [](
DataProcessorLabel const&
label) {
188 return label.value ==
"resilient";
189 }) != ancestor.labels.end();
191 if (!isDependentResilient && isAncestorExpendable) {
192 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"false. Ancestor %s is expendable while %s is non-resilient output proxy (dependent).",
193 ancestor.name.c_str(), dependent.
name.c_str());
197 if (isAncestorOutputProxy || (!isDependentResilient && isAncestorResilient)) {
198 bool hasDependency =
dataDeps(dependent, ancestor);
199 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"%s. Dependent %s %s a dependency on ancestor %s.",
200 hasDependency ?
"true" :
"false", dependent.
name.c_str(), hasDependency ?
"has" :
"has not", ancestor.name.c_str());
201 return hasDependency;
203 O2_SIGNPOST_END(topology, sid,
"alwaysDependent",
"true by default. Ancestor %s is not an output proxy.", ancestor.name.c_str());
#define O2_DECLARE_DYNAMIC_LOG(name)
#define O2_SIGNPOST_END(log, id, name, format,...)
#define O2_SIGNPOST_ID_GENERATE(name, log)
#define O2_SIGNPOST_START(log, id, name, format,...)