Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 1 | // |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 2 | // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Jim Flynn | 2776183 | 2022-03-20 21:52:17 +0000 | [diff] [blame] | 8 | #include <client/include/IProfilingService.hpp> |
| 9 | #include <client/include/ISendTimelinePacket.hpp> |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 10 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 11 | namespace arm |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 12 | { |
| 13 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 14 | namespace pipe |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 15 | { |
| 16 | |
| 17 | class TimelineUtilityMethods |
| 18 | { |
| 19 | public: |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 20 | |
| 21 | // static factory method which will return a pointer to a timelie utility methods |
| 22 | // object if profiling is enabled. Otherwise will return a null unique_ptr |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 23 | static std::unique_ptr<TimelineUtilityMethods> GetTimelineUtils(IProfilingService& profilingService); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 24 | |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 25 | TimelineUtilityMethods( |
Sadik Armagan | 0a35667 | 2020-03-20 11:11:01 +0000 | [diff] [blame] | 26 | std::unique_ptr<ISendTimelinePacket>& sendTimelinePacket) |
| 27 | : m_SendTimelinePacket(std::move(sendTimelinePacket)) {} |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 28 | |
| 29 | TimelineUtilityMethods(TimelineUtilityMethods&& other) |
Sadik Armagan | 0a35667 | 2020-03-20 11:11:01 +0000 | [diff] [blame] | 30 | : m_SendTimelinePacket(std::move(other.m_SendTimelinePacket)) {} |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 31 | |
| 32 | TimelineUtilityMethods(const TimelineUtilityMethods& other) = delete; |
| 33 | |
| 34 | TimelineUtilityMethods& operator=(const TimelineUtilityMethods& other) = delete; |
| 35 | |
| 36 | TimelineUtilityMethods& operator=(TimelineUtilityMethods&& other) = default; |
| 37 | |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 38 | ~TimelineUtilityMethods() = default; |
| 39 | |
Finn Williams | cf2ad55 | 2020-03-20 15:10:59 +0000 | [diff] [blame] | 40 | static void SendWellKnownLabelsAndEventClasses(ISendTimelinePacket& timelinePacket); |
Matteo Martincigh | 102cdbd | 2019-10-28 11:42:50 +0000 | [diff] [blame] | 41 | |
Narumol Prangnawarat | d034e08 | 2019-10-30 12:48:31 +0000 | [diff] [blame] | 42 | ProfilingDynamicGuid CreateNamedTypedEntity(const std::string& name, const std::string& type); |
| 43 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 44 | void CreateNamedTypedEntity(ProfilingGuid entityGuid, const std::string& name, const std::string& type); |
Narumol Prangnawarat | 234d525 | 2019-11-19 15:49:18 +0000 | [diff] [blame] | 45 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 46 | void CreateNamedTypedEntity(ProfilingGuid entityGuid, const std::string& name, ProfilingStaticGuid typeGuid); |
| 47 | |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 48 | void MarkEntityWithLabel(ProfilingGuid entityGuid, const std::string& labelName, ProfilingStaticGuid labelLinkGuid); |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 49 | |
Narumol Prangnawarat | d034e08 | 2019-10-30 12:48:31 +0000 | [diff] [blame] | 50 | ProfilingStaticGuid DeclareLabel(const std::string& labelName); |
| 51 | |
| 52 | void NameEntity(ProfilingGuid entityGuid, const std::string& name); |
| 53 | |
| 54 | void TypeEntity(ProfilingGuid entityGuid, const std::string& type); |
| 55 | |
Narumol Prangnawarat | 94a3088 | 2019-10-30 12:48:31 +0000 | [diff] [blame] | 56 | ProfilingDynamicGuid CreateNamedTypedChildEntity(ProfilingGuid parentEntityGuid, |
| 57 | const std::string& entityName, |
| 58 | const std::string& entityType); |
| 59 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 60 | void CreateNamedTypedChildEntity(ProfilingGuid entityGuid, |
Narumol Prangnawarat | 234d525 | 2019-11-19 15:49:18 +0000 | [diff] [blame] | 61 | ProfilingGuid parentEntityGuid, |
| 62 | const std::string& entityName, |
| 63 | const std::string& entityType); |
| 64 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 65 | void CreateNamedTypedChildEntity(ProfilingGuid entityGuid, |
| 66 | ProfilingGuid parentEntityGuid, |
| 67 | const std::string& entityName, |
| 68 | ProfilingStaticGuid typeGuid); |
| 69 | |
| 70 | ProfilingDynamicGuid CreateRelationship(ProfilingRelationshipType relationshipType, |
| 71 | ProfilingGuid headGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 72 | ProfilingGuid tailGuid, |
| 73 | ProfilingGuid relationshipCategory); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 74 | |
| 75 | ProfilingDynamicGuid CreateConnectionRelationship(ProfilingRelationshipType relationshipType, |
| 76 | ProfilingGuid headGuid, |
| 77 | ProfilingGuid tailGuid); |
| 78 | |
| 79 | void CreateTypedEntity(ProfilingGuid entityGuid, ProfilingStaticGuid typeGuid); |
| 80 | |
| 81 | void MarkEntityWithType(ProfilingGuid entityGuid, ProfilingStaticGuid typeNameGuid); |
| 82 | |
Matteo Martincigh | 5dc816e | 2019-11-04 14:05:28 +0000 | [diff] [blame] | 83 | ProfilingDynamicGuid RecordEvent(ProfilingGuid entityGuid, ProfilingStaticGuid eventClassGuid); |
| 84 | |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 85 | ProfilingDynamicGuid RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid, |
| 86 | ProfilingGuid inferenceGuid); |
| 87 | |
| 88 | void RecordEndOfLifeEvent(ProfilingGuid entityGuid); |
| 89 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 90 | void Commit() { m_SendTimelinePacket->Commit(); } |
| 91 | |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 92 | private: |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 93 | std::unique_ptr<ISendTimelinePacket> m_SendTimelinePacket; |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 94 | }; |
| 95 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 96 | } // namespace pipe |
Matteo Martincigh | 830101c | 2019-10-22 11:07:45 +0100 | [diff] [blame] | 97 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 98 | } // namespace arm |