1*89c4ff92SAndroid Build Coastguard Worker // 2*89c4ff92SAndroid Build Coastguard Worker // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. 3*89c4ff92SAndroid Build Coastguard Worker // SPDX-License-Identifier: MIT 4*89c4ff92SAndroid Build Coastguard Worker // 5*89c4ff92SAndroid Build Coastguard Worker 6*89c4ff92SAndroid Build Coastguard Worker #pragma once 7*89c4ff92SAndroid Build Coastguard Worker 8*89c4ff92SAndroid Build Coastguard Worker #include <client/include/IProfilingService.hpp> 9*89c4ff92SAndroid Build Coastguard Worker #include <client/include/ISendTimelinePacket.hpp> 10*89c4ff92SAndroid Build Coastguard Worker 11*89c4ff92SAndroid Build Coastguard Worker namespace arm 12*89c4ff92SAndroid Build Coastguard Worker { 13*89c4ff92SAndroid Build Coastguard Worker 14*89c4ff92SAndroid Build Coastguard Worker namespace pipe 15*89c4ff92SAndroid Build Coastguard Worker { 16*89c4ff92SAndroid Build Coastguard Worker 17*89c4ff92SAndroid Build Coastguard Worker class TimelineUtilityMethods 18*89c4ff92SAndroid Build Coastguard Worker { 19*89c4ff92SAndroid Build Coastguard Worker public: 20*89c4ff92SAndroid Build Coastguard Worker 21*89c4ff92SAndroid Build Coastguard Worker // static factory method which will return a pointer to a timelie utility methods 22*89c4ff92SAndroid Build Coastguard Worker // object if profiling is enabled. Otherwise will return a null unique_ptr 23*89c4ff92SAndroid Build Coastguard Worker static std::unique_ptr<TimelineUtilityMethods> GetTimelineUtils(IProfilingService& profilingService); 24*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods(std::unique_ptr<ISendTimelinePacket> & sendTimelinePacket)25*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods( 26*89c4ff92SAndroid Build Coastguard Worker std::unique_ptr<ISendTimelinePacket>& sendTimelinePacket) 27*89c4ff92SAndroid Build Coastguard Worker : m_SendTimelinePacket(std::move(sendTimelinePacket)) {} 28*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods(TimelineUtilityMethods && other)29*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods(TimelineUtilityMethods&& other) 30*89c4ff92SAndroid Build Coastguard Worker : m_SendTimelinePacket(std::move(other.m_SendTimelinePacket)) {} 31*89c4ff92SAndroid Build Coastguard Worker 32*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods(const TimelineUtilityMethods& other) = delete; 33*89c4ff92SAndroid Build Coastguard Worker 34*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods& operator=(const TimelineUtilityMethods& other) = delete; 35*89c4ff92SAndroid Build Coastguard Worker 36*89c4ff92SAndroid Build Coastguard Worker TimelineUtilityMethods& operator=(TimelineUtilityMethods&& other) = default; 37*89c4ff92SAndroid Build Coastguard Worker 38*89c4ff92SAndroid Build Coastguard Worker ~TimelineUtilityMethods() = default; 39*89c4ff92SAndroid Build Coastguard Worker 40*89c4ff92SAndroid Build Coastguard Worker static void SendWellKnownLabelsAndEventClasses(ISendTimelinePacket& timelinePacket); 41*89c4ff92SAndroid Build Coastguard Worker 42*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid CreateNamedTypedEntity(const std::string& name, const std::string& type); 43*89c4ff92SAndroid Build Coastguard Worker 44*89c4ff92SAndroid Build Coastguard Worker void CreateNamedTypedEntity(ProfilingGuid entityGuid, const std::string& name, const std::string& type); 45*89c4ff92SAndroid Build Coastguard Worker 46*89c4ff92SAndroid Build Coastguard Worker void CreateNamedTypedEntity(ProfilingGuid entityGuid, const std::string& name, ProfilingStaticGuid typeGuid); 47*89c4ff92SAndroid Build Coastguard Worker 48*89c4ff92SAndroid Build Coastguard Worker void MarkEntityWithLabel(ProfilingGuid entityGuid, const std::string& labelName, ProfilingStaticGuid labelLinkGuid); 49*89c4ff92SAndroid Build Coastguard Worker 50*89c4ff92SAndroid Build Coastguard Worker ProfilingStaticGuid DeclareLabel(const std::string& labelName); 51*89c4ff92SAndroid Build Coastguard Worker 52*89c4ff92SAndroid Build Coastguard Worker void NameEntity(ProfilingGuid entityGuid, const std::string& name); 53*89c4ff92SAndroid Build Coastguard Worker 54*89c4ff92SAndroid Build Coastguard Worker void TypeEntity(ProfilingGuid entityGuid, const std::string& type); 55*89c4ff92SAndroid Build Coastguard Worker 56*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid CreateNamedTypedChildEntity(ProfilingGuid parentEntityGuid, 57*89c4ff92SAndroid Build Coastguard Worker const std::string& entityName, 58*89c4ff92SAndroid Build Coastguard Worker const std::string& entityType); 59*89c4ff92SAndroid Build Coastguard Worker 60*89c4ff92SAndroid Build Coastguard Worker void CreateNamedTypedChildEntity(ProfilingGuid entityGuid, 61*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid parentEntityGuid, 62*89c4ff92SAndroid Build Coastguard Worker const std::string& entityName, 63*89c4ff92SAndroid Build Coastguard Worker const std::string& entityType); 64*89c4ff92SAndroid Build Coastguard Worker 65*89c4ff92SAndroid Build Coastguard Worker void CreateNamedTypedChildEntity(ProfilingGuid entityGuid, 66*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid parentEntityGuid, 67*89c4ff92SAndroid Build Coastguard Worker const std::string& entityName, 68*89c4ff92SAndroid Build Coastguard Worker ProfilingStaticGuid typeGuid); 69*89c4ff92SAndroid Build Coastguard Worker 70*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid CreateRelationship(ProfilingRelationshipType relationshipType, 71*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid headGuid, 72*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid tailGuid, 73*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid relationshipCategory); 74*89c4ff92SAndroid Build Coastguard Worker 75*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid CreateConnectionRelationship(ProfilingRelationshipType relationshipType, 76*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid headGuid, 77*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid tailGuid); 78*89c4ff92SAndroid Build Coastguard Worker 79*89c4ff92SAndroid Build Coastguard Worker void CreateTypedEntity(ProfilingGuid entityGuid, ProfilingStaticGuid typeGuid); 80*89c4ff92SAndroid Build Coastguard Worker 81*89c4ff92SAndroid Build Coastguard Worker void MarkEntityWithType(ProfilingGuid entityGuid, ProfilingStaticGuid typeNameGuid); 82*89c4ff92SAndroid Build Coastguard Worker 83*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid RecordEvent(ProfilingGuid entityGuid, ProfilingStaticGuid eventClassGuid); 84*89c4ff92SAndroid Build Coastguard Worker 85*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid, 86*89c4ff92SAndroid Build Coastguard Worker ProfilingGuid inferenceGuid); 87*89c4ff92SAndroid Build Coastguard Worker 88*89c4ff92SAndroid Build Coastguard Worker void RecordEndOfLifeEvent(ProfilingGuid entityGuid); 89*89c4ff92SAndroid Build Coastguard Worker Commit()90*89c4ff92SAndroid Build Coastguard Worker void Commit() { m_SendTimelinePacket->Commit(); } 91*89c4ff92SAndroid Build Coastguard Worker 92*89c4ff92SAndroid Build Coastguard Worker private: 93*89c4ff92SAndroid Build Coastguard Worker std::unique_ptr<ISendTimelinePacket> m_SendTimelinePacket; 94*89c4ff92SAndroid Build Coastguard Worker }; 95*89c4ff92SAndroid Build Coastguard Worker 96*89c4ff92SAndroid Build Coastguard Worker } // namespace pipe 97*89c4ff92SAndroid Build Coastguard Worker 98*89c4ff92SAndroid Build Coastguard Worker } // namespace arm 99