xref: /aosp_15_r20/external/armnn/profiling/common/src/PacketVersionResolver.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <common/include/PacketVersionResolver.hpp>
7 
8 namespace arm
9 {
10 
11 namespace pipe
12 {
13 
operator <(const PacketKey & rhs) const14 bool PacketKey::operator<(const PacketKey& rhs) const
15 {
16     bool result = true;
17     if (m_FamilyId == rhs.m_FamilyId)
18     {
19             result = m_PacketId < rhs.m_PacketId;
20     }
21     else if (m_FamilyId > rhs.m_FamilyId)
22     {
23         result = false;
24     }
25     return result;
26 }
27 
operator >(const PacketKey & rhs) const28 bool PacketKey::operator>(const PacketKey& rhs) const
29 {
30     return rhs < *this;
31 }
32 
operator <=(const PacketKey & rhs) const33 bool PacketKey::operator<=(const PacketKey& rhs) const
34 {
35     return !(*this > rhs);
36 }
37 
operator >=(const PacketKey & rhs) const38 bool PacketKey::operator>=(const PacketKey& rhs) const
39 {
40     return !(*this < rhs);
41 }
42 
operator ==(const PacketKey & rhs) const43 bool PacketKey::operator==(const PacketKey& rhs) const
44 {
45     return m_FamilyId == rhs.m_FamilyId && m_PacketId == rhs.m_PacketId;
46 }
47 
operator !=(const PacketKey & rhs) const48 bool PacketKey::operator!=(const PacketKey& rhs) const
49 {
50     return !(*this == rhs);
51 }
52 
ResolvePacketVersion(uint32_t familyId,uint32_t packetId) const53 Version PacketVersionResolver::ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
54 {
55     const PacketKey packetKey(familyId, packetId);
56 
57     if( packetKey == ActivateTimeLinePacket )
58     {
59         return Version(1, 1, 0);
60     }
61     if( packetKey == DeactivateTimeLinePacket )
62     {
63         return Version(1, 1, 0);
64     }
65 
66     return Version(1, 0, 0);
67 }
68 
69 } // namespace pipe
70 
71 } // namespace arm
72