| 90 | } |
| 91 | |
| 92 | void TimelineModel::HandleLabelLink(const arm::pipe::ITimelineDecoder::Relationship& relationship) |
| 93 | { |
| 94 | Entity* entity = FindEntity(relationship.m_HeadGuid); |
| 95 | // we have a label attribute of an entity |
| 96 | std::string* value = nullptr; |
| 97 | std::string* attribute = nullptr; |
| 98 | value = FindLabel(relationship.m_TailGuid); |
| 99 | if (value == nullptr) |
| 100 | { |
| 101 | //report an error |
| 102 | std::stringstream ss; |
| 103 | ss << "could not find label link [" << relationship.m_Guid << |
| 104 | "] value [" << relationship.m_TailGuid << "]"; |
| 105 | m_Errors.push_back(arm::pipe::ProfilingException(ss.str())); |
| 106 | } |
| 107 | if (relationship.m_AttributeGuid != 0) |
| 108 | { |
| 109 | attribute = FindLabel(relationship.m_AttributeGuid); |
| 110 | if (attribute == nullptr) |
| 111 | { |
| 112 | //report an error |
| 113 | std::stringstream ss; |
| 114 | ss << "could not find label link [" << relationship.m_Guid << |
| 115 | "] attribute [" << relationship.m_AttributeGuid << "]"; |
| 116 | m_Errors.push_back(arm::pipe::ProfilingException(ss.str())); |
| 117 | } |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | //report an error |
| 122 | std::stringstream ss; |
| 123 | ss << "label link [" << relationship.m_Guid << "] has a zero attribute guid"; |
| 124 | m_Errors.push_back(arm::pipe::ProfilingException(ss.str())); |
| 125 | } |
| 126 | if (entity != nullptr && attribute != nullptr && value != nullptr) |
| 127 | { |
| 128 | entity->AddAttribute(*attribute, *value); |
| 129 | // if the attribute is 'type' and the value is 'inference' |
| 130 | // we need to cache the entity guid as an inference |
| 131 | if (LabelsAndEventClasses::TYPE_LABEL.compare(*attribute) == 0 && |
| 132 | LabelsAndEventClasses::INFERENCE.compare(*value) == 0) |
| 133 | { |
| 134 | m_InferenceGuids.push_back(relationship.m_HeadGuid); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | if (entity == nullptr) |
| 139 | { |
| 140 | //report an error |
| 141 | std::stringstream ss; |
| 142 | ss << "could not find label link [" << relationship.m_Guid << |
| 143 | "] entity [" << relationship.m_HeadGuid << "] "; |
| 144 | if (value != nullptr) |
| 145 | { |
| 146 | ss << "value [" << *value << "] "; |
| 147 | } |
| 148 | if (attribute != nullptr) |
| 149 | { |
nothing calls this directly
no test coverage detected