ProfilerStorage.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package MemoryX::component::ProfilerStorage
19 * @author haass ( tobias dot haass at student dot kit dot edu )
20 * @author Manfred Kroehnert ( manfred dot kroehnert at kit dot edu )
21 * @date 2013
22 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
23 * GNU General Public License
24 */
25
26#pragma once
27
30
33#include <MemoryX/interface/components/CommonStorageInterface.h>
34#include <MemoryX/interface/components/LongtermMemoryInterface.h>
35#include <MemoryX/interface/components/ProfilerStorageInterface.h>
36#include <MemoryX/interface/components/WorkingMemoryInterface.h>
37
38namespace memoryx
39{
45
46 /**
47 * @class ProfilerStorage
48 * @brief A brief description
49 *
50 * Detailed Description
51 */
53 virtual public armarx::Component,
54 virtual public ProfilerStorageInterface
55 {
56 public:
57 /**
58 * @see armarx::ManagedIceObject::getDefaultName()
59 */
60 std::string getDefaultName() const override;
61 static std::string GetDefaultName();
62
63 /**
64 * @see PropertyUser::createPropertyDefinitions()
65 */
67
69 CreateProfilerMemorySnapshot(const std::string& stateName,
70 const WorkingMemoryInterfacePrx& workingMemoryProxy);
71
72 protected:
73 /**
74 * @see armarx::ManagedIceObject::onInitComponent()
75 */
76 void onInitComponent() override;
77
78 /**
79 * @see armarx::ManagedIceObject::onConnectComponent()
80 */
81 void onConnectComponent() override;
82
83 /**
84 * @see armarx::ManagedIceObject::onDisconnectComponent()
85 */
86 void onDisconnectComponent() override;
87
88 /**
89 * @see armarx::ManagedIceObject::onExitComponent()
90 */
91 void onExitComponent() override;
92
93 std::string getCommonStorageName();
94
95 std::string getWorkingMemoryName();
96
97 std::string getLongtermMemoryName();
98
99 /**
100 * @brief reportNetworkTraffic
101 * @param context
102 */
103 void reportNetworkTraffic(const std::string&,
104 const std::string&,
105 Ice::Int,
106 Ice::Int,
107 const Ice::Current& context = Ice::emptyCurrent) override;
108 void reportEvent(const armarx::ProfilerEvent& profilerEvent,
109 const Ice::Current& context = Ice::emptyCurrent) override;
110
111 void reportStatechartTransition(const armarx::ProfilerStatechartTransition& transition,
112 const ::Ice::Current& context = Ice::emptyCurrent) override;
113 void
114 reportStatechartInputParameters(const armarx::ProfilerStatechartParameters& inputParameters,
115 const Ice::Current& = Ice::emptyCurrent) override;
116 void
117 reportStatechartLocalParameters(const armarx::ProfilerStatechartParameters& localParameters,
118 const Ice::Current& = Ice::emptyCurrent) override;
120 const armarx::ProfilerStatechartParameters& outputParameters,
121 const Ice::Current& = Ice::emptyCurrent) override;
122
123 void reportProcessCpuUsage(const armarx::ProfilerProcessCpuUsage& process,
124 const Ice::Current& context = Ice::emptyCurrent) override;
125 void reportProcessMemoryUsage(const armarx::ProfilerProcessMemoryUsage& memoryUsage,
126 const Ice::Current& context = Ice::emptyCurrent) override;
127
128
129 void reportEventList(const armarx::ProfilerEventList& events,
130 const Ice::Current& = Ice::emptyCurrent) override;
131
132 void
133 reportStatechartTransitionList(const armarx::ProfilerStatechartTransitionList& transitions,
134 const Ice::Current& = Ice::emptyCurrent) override;
136 const armarx::ProfilerStatechartParametersList& inputParametersList,
137 const Ice::Current& = Ice::emptyCurrent) override;
139 const armarx::ProfilerStatechartParametersList& localParametesList,
140 const Ice::Current& = Ice::emptyCurrent) override;
142 const armarx::ProfilerStatechartParametersList& outputParametersList,
143 const Ice::Current& = Ice::emptyCurrent) override;
144
145 void reportProcessCpuUsageList(const armarx::ProfilerProcessCpuUsageList& processes,
146 const Ice::Current& = Ice::emptyCurrent) override;
147 void
148 reportProcessMemoryUsageList(const armarx::ProfilerProcessMemoryUsageList& memoryUsages,
149 const Ice::Current& = Ice::emptyCurrent) override;
150
152 const armarx::ProfilerStatechartTransitionWithParameters& transition,
153 const ::Ice::Current& context = Ice::emptyCurrent) override;
155 const armarx::ProfilerStatechartTransitionWithParametersList& transitions,
156 const Ice::Current& = Ice::emptyCurrent) override;
157
158 private:
159 void saveToLongtermMemory();
160 void saveTransitionsToLongtermMemory();
161
162 struct TransitionSnapshot
163 {
164 armarx::ProfilerStatechartTransition transition;
165 ProfilerMemorySnapshotPtr sourceStateMemorySnapshot;
166 ProfilerMemorySnapshotPtr targetStateMemorySnapshot;
167 };
168
169 using TransitionSnapshotList = std::vector<TransitionSnapshot>;
170
171 CommonStorageInterfacePrx commonStoragePrx;
172 WorkingMemoryInterfacePrx workingMemoryPrx;
173 LongtermMemoryInterfacePrx longtermMemoryPrx;
174 PersistentProfilerDataSegmentBasePrx profilerDataSegmentPrx;
175
177 armarx::RunningTask<ProfilerStorage>::pointer_type saveTransitionsToLongtermMemoryTask;
178
179 std::mutex entityLogMutex;
180 memoryx::EntityBaseList entityLog;
181 std::mutex transitionSnapshotListMutex;
182 TransitionSnapshotList transitionSnapshotList;
183
184 ProfilerMemorySnapshotPtr memorySnapshot;
185
186 bool enabled;
187 int saveTimeout;
188 };
189} // namespace memoryx
Default component property definition container.
Definition Component.h:70
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
A brief description.
void reportProcessCpuUsage(const armarx::ProfilerProcessCpuUsage &process, const Ice::Current &context=Ice::emptyCurrent) override
void reportStatechartOutputParametersList(const armarx::ProfilerStatechartParametersList &outputParametersList, const Ice::Current &=Ice::emptyCurrent) override
void onInitComponent() override
void reportStatechartTransitionWithParameters(const armarx::ProfilerStatechartTransitionWithParameters &transition, const ::Ice::Current &context=Ice::emptyCurrent) override
void reportProcessMemoryUsage(const armarx::ProfilerProcessMemoryUsage &memoryUsage, const Ice::Current &context=Ice::emptyCurrent) override
void reportStatechartTransitionWithParametersList(const armarx::ProfilerStatechartTransitionWithParametersList &transitions, const Ice::Current &=Ice::emptyCurrent) override
void onDisconnectComponent() override
void reportStatechartInputParametersList(const armarx::ProfilerStatechartParametersList &inputParametersList, const Ice::Current &=Ice::emptyCurrent) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void reportStatechartOutputParameters(const armarx::ProfilerStatechartParameters &outputParameters, const Ice::Current &=Ice::emptyCurrent) override
void reportStatechartTransitionList(const armarx::ProfilerStatechartTransitionList &transitions, const Ice::Current &=Ice::emptyCurrent) override
void reportStatechartLocalParametersList(const armarx::ProfilerStatechartParametersList &localParametesList, const Ice::Current &=Ice::emptyCurrent) override
void reportStatechartTransition(const armarx::ProfilerStatechartTransition &transition, const ::Ice::Current &context=Ice::emptyCurrent) override
void reportNetworkTraffic(const std::string &, const std::string &, Ice::Int, Ice::Int, const Ice::Current &context=Ice::emptyCurrent) override
reportNetworkTraffic
void reportEventList(const armarx::ProfilerEventList &events, const Ice::Current &=Ice::emptyCurrent) override
void onConnectComponent() override
static std::string GetDefaultName()
static ProfilerMemorySnapshotPtr CreateProfilerMemorySnapshot(const std::string &stateName, const WorkingMemoryInterfacePrx &workingMemoryProxy)
void reportProcessMemoryUsageList(const armarx::ProfilerProcessMemoryUsageList &memoryUsages, const Ice::Current &=Ice::emptyCurrent) override
void reportEvent(const armarx::ProfilerEvent &profilerEvent, const Ice::Current &context=Ice::emptyCurrent) override
void reportStatechartInputParameters(const armarx::ProfilerStatechartParameters &inputParameters, const Ice::Current &=Ice::emptyCurrent) override
void reportStatechartLocalParameters(const armarx::ProfilerStatechartParameters &localParameters, const Ice::Current &=Ice::emptyCurrent) override
void reportProcessCpuUsageList(const armarx::ProfilerProcessCpuUsageList &processes, const Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.
IceInternal::Handle< ProfilerMemorySnapshot > ProfilerMemorySnapshotPtr