LoggingStrategy.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4  * This file is part of ArmarX.
5  *
6  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
7  *
8  * ArmarX is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * ArmarX is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * @package ArmarXCore::core::services::profiler
21  * @author Manfred Kroehnert ( manfred dot kroehnert at dot kit dot edu )
22  * @date 2015
23  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
24  * GNU General Public License
25  */
26 
27 #include <memory>
28 #include <string>
29 
30 #include <unistd.h>
31 
32 #include <ArmarXCore/interface/statechart/StatechartIce.h>
33 
34 namespace armarx
35 {
36  struct ProfilerStatechartTransition;
37 }
38 
39 namespace armarx::Profiler
40 {
41  class LoggingStrategy;
42  using LoggingStrategyPtr = std::shared_ptr<LoggingStrategy>;
43 
44  /**
45  * @class LoggingStrategy
46  * @ingroup Profiling
47  * @brief A brief description
48  *
49  * Detailed Description
50  */
52  {
53  public:
55  {
56  }
57 
58  virtual ~LoggingStrategy()
59  {
60  }
61 
62  void
63  setId(const std::string& id)
64  {
65  this->id = id;
66  }
67 
68  virtual void
69  logEvent(pid_t processId,
70  uint64_t timestamp,
71  const std::string& executableName,
72  const std::string& timestampUnit,
73  const std::string& eventName,
74  const std::string& parentName,
75  const std::string& functionName)
76  {
77  // empty implementation
78  }
79 
80  virtual void
81  logStatechartTransition(const ProfilerStatechartTransition& transition)
82  {
83  // empty implementation
84  }
85 
86  virtual void
88  uint64_t timestamp,
89  const std::string& stateIdentifier,
90  const armarx::StateParameterMap& inputParameterMap)
91  {
92  // empty implementation
93  }
94 
95  virtual void
97  uint64_t timestamp,
98  const std::string& stateIdentifier,
99  const armarx::StateParameterMap& localParameterMap)
100  {
101  // empty implementation
102  }
103 
104  virtual void
106  uint64_t timestamp,
107  const std::string& stateIdentifier,
108  const armarx::StateParameterMap& outputParameterMap)
109  {
110  // empty implementation
111  }
112 
113  virtual void
115  uint64_t timestamp,
116  const TransitionIceBase& transition)
117  {
118  // empty implementation
119  }
120 
121  virtual void
122  logProcessCpuUsage(pid_t processId, uint64_t timestamp, float cpuUsage)
123  {
124  // empty implementation
125  }
126 
127  virtual void
128  logProcessMemoryUsage(pid_t processId, uint64_t timestamp, int memoryUsage)
129  {
130  // empty implementation
131  }
132 
133  protected:
134  std::string id;
135  };
136 } // namespace armarx::Profiler
armarx::Profiler::LoggingStrategy::logProcessCpuUsage
virtual void logProcessCpuUsage(pid_t processId, uint64_t timestamp, float cpuUsage)
Definition: LoggingStrategy.h:122
armarx::Profiler::LoggingStrategy::logEvent
virtual void logEvent(pid_t processId, uint64_t timestamp, const std::string &executableName, const std::string &timestampUnit, const std::string &eventName, const std::string &parentName, const std::string &functionName)
Definition: LoggingStrategy.h:69
armarx::Profiler
Definition: ManagedIceObject.h:71
armarx::Profiler::LoggingStrategy
A brief description.
Definition: LoggingStrategy.h:51
armarx::Profiler::LoggingStrategy::setId
void setId(const std::string &id)
Definition: LoggingStrategy.h:63
armarx::Profiler::LoggingStrategyPtr
std::shared_ptr< LoggingStrategy > LoggingStrategyPtr
Definition: LoggingStrategy.h:42
armarx::Profiler::LoggingStrategy::LoggingStrategy
LoggingStrategy()
Definition: LoggingStrategy.h:54
armarx::Profiler::LoggingStrategy::logStatechartLocalParameters
virtual void logStatechartLocalParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &localParameterMap)
Definition: LoggingStrategy.h:96
armarx::Profiler::LoggingStrategy::logStatechartInputParameters
virtual void logStatechartInputParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &inputParameterMap)
Definition: LoggingStrategy.h:87
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
armarx::Profiler::LoggingStrategy::id
std::string id
Definition: LoggingStrategy.h:134
armarx::Profiler::LoggingStrategy::logStatechartOutputParameters
virtual void logStatechartOutputParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &outputParameterMap)
Definition: LoggingStrategy.h:105
armarx::Profiler::LoggingStrategy::logStatechartTransition
virtual void logStatechartTransition(const ProfilerStatechartTransition &transition)
Definition: LoggingStrategy.h:81
armarx::Profiler::LoggingStrategy::logStatechartTransitionWithParameters
virtual void logStatechartTransitionWithParameters(pid_t processId, uint64_t timestamp, const TransitionIceBase &transition)
Definition: LoggingStrategy.h:114
armarx::Profiler::LoggingStrategy::~LoggingStrategy
virtual ~LoggingStrategy()
Definition: LoggingStrategy.h:58
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::Profiler::LoggingStrategy::logProcessMemoryUsage
virtual void logProcessMemoryUsage(pid_t processId, uint64_t timestamp, int memoryUsage)
Definition: LoggingStrategy.h:128