27 #include "../entity/profiler/ProfilerMemorySnapshot.h"
32 CollectionInterfacePrx entityCollection,
35 PersistentEntitySegment(entityCollection,
ic, useMongoIds),
36 PersistentProfilerDataSegmentBase()
40 ProfilerEntityBaseList
41 PersistentProfilerDataSegment::getProfilerDataEntities(
const Ice::Current&)
const
43 ProfilerEntityBaseList entities;
45 for (
const auto& entity : getAllEntities())
47 if (entity->ice_isA(ProfilerEntityBase::ice_staticId()))
49 entities.push_back(ProfilerEntityBasePtr::dynamicCast(entity));
59 ProfilerEventBaseList entities;
63 if (entity->ice_isA(ProfilerEventBase::ice_staticId()))
65 entities.push_back(ProfilerEventBasePtr::dynamicCast(entity));
72 ProfilerTransitionBaseList
75 ProfilerTransitionBaseList entities;
77 for (
const auto& entity : getAllEntities())
79 if (entity->ice_isA(ProfilerTransitionBase::ice_staticId()))
81 entities.push_back(ProfilerTransitionBasePtr::dynamicCast(entity));
87 ProfilerMemorySnapshotBaseList
90 ProfilerMemorySnapshotBaseList entities;
94 if (entity->ice_isA(ProfilerMemorySnapshotBase::ice_staticId()))
96 entities.push_back(ProfilerMemorySnapshotBasePtr::dynamicCast(entity));
103 ProfilerProcessBaseList
106 ProfilerProcessBaseList entities;
110 if (entity->ice_isA(ProfilerProcessBase::ice_staticId()))
112 entities.push_back(ProfilerProcessBasePtr::dynamicCast(entity));
119 ProfilerMemoryUsageBaseList
122 ProfilerMemoryUsageBaseList entities;
126 if (entity->ice_isA(ProfilerMemoryUsageBase::ice_staticId()))
128 entities.push_back(ProfilerMemoryUsageBasePtr::dynamicCast(entity));
137 const ProfilerMemorySnapshotBasePtr& memorySnapshot,
143 std::string entityId = PersistentProfilerDataSegment::GetEntityIdFromList<EntityBasePtr>(
144 memorySnapshot, entities);
146 if (entityId.empty())
155 const ProfilerTransitionBasePtr& transition,
160 std::string entityId =
161 PersistentProfilerDataSegment::GetEntityIdFromList<ProfilerTransitionBasePtr>(
162 transition, transitionEntities);
163 if (entityId.empty())
171 ProfilerTransitionBasePtr entity =
172 ProfilerTransitionBasePtr::dynamicCast(
getEntityById(entityId));
173 entity->setCount(entity->getCount() + 1);
179 template <
typename T>
182 const std::vector<T>& entities)
184 std::string entityId(
"");
185 if (entities.empty())
190 auto entityIterator = std::find_if(entities.begin(),
192 [&entity](EntityBasePtr current)
193 { return entity->equalsAttributes(current); });
194 if (entityIterator != entities.end())
196 entityId = (*entityIterator)->getId();