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 <ArmarXCore/interface/statechart/StatechartIce.h>
28 
29 #include <memory>
30 #include <string>
31 
32 #include <unistd.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  * @class LoggingStrategy
45  * @ingroup Profiling
46  * @brief A brief description
47  *
48  * Detailed Description
49  */
51  {
52  public:
54  id("")
55  {
56  }
57 
58  virtual ~LoggingStrategy()
59  {
60  }
61 
62  void setId(const std::string& id)
63  {
64  this->id = id;
65  }
66 
67  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)
68  {
69  // empty implementation
70  }
71 
72  virtual void logStatechartTransition(const ProfilerStatechartTransition& transition)
73  {
74  // empty implementation
75  }
76 
77  virtual void logStatechartInputParameters(pid_t processId, uint64_t timestamp, const std::string& stateIdentifier, const armarx::StateParameterMap& inputParameterMap)
78  {
79  // empty implementation
80  }
81 
82  virtual void logStatechartLocalParameters(pid_t processId, uint64_t timestamp, const std::string& stateIdentifier, const armarx::StateParameterMap& localParameterMap)
83  {
84  // empty implementation
85  }
86 
87  virtual void logStatechartOutputParameters(pid_t processId, uint64_t timestamp, const std::string& stateIdentifier, const armarx::StateParameterMap& outputParameterMap)
88  {
89  // empty implementation
90  }
91 
92  virtual void logStatechartTransitionWithParameters(pid_t processId, uint64_t timestamp, const TransitionIceBase& transition)
93  {
94  // empty implementation
95  }
96 
97 
98 
99  virtual void logProcessCpuUsage(pid_t processId, uint64_t timestamp, float cpuUsage)
100  {
101  // empty implementation
102  }
103 
104  virtual void logProcessMemoryUsage(pid_t processId, uint64_t timestamp, int memoryUsage)
105  {
106  // empty implementation
107  }
108 
109  protected:
110  std::string id;
111  };
112 }
armarx::Profiler::LoggingStrategy::logProcessCpuUsage
virtual void logProcessCpuUsage(pid_t processId, uint64_t timestamp, float cpuUsage)
Definition: LoggingStrategy.h:99
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:67
armarx::Profiler
Definition: ManagedIceObject.h:72
armarx::Profiler::LoggingStrategy
A brief description.
Definition: LoggingStrategy.h:50
armarx::Profiler::LoggingStrategy::setId
void setId(const std::string &id)
Definition: LoggingStrategy.h:62
armarx::Profiler::LoggingStrategyPtr
std::shared_ptr< LoggingStrategy > LoggingStrategyPtr
Definition: LoggingStrategy.h:42
armarx::Profiler::LoggingStrategy::LoggingStrategy
LoggingStrategy()
Definition: LoggingStrategy.h:53
armarx::Profiler::LoggingStrategy::logStatechartLocalParameters
virtual void logStatechartLocalParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &localParameterMap)
Definition: LoggingStrategy.h:82
armarx::Profiler::LoggingStrategy::logStatechartInputParameters
virtual void logStatechartInputParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &inputParameterMap)
Definition: LoggingStrategy.h:77
armarx::statechartmodel::StateParameterMap
QMap< QString, StateParameterPtr > StateParameterMap
Definition: StateParameter.h:46
armarx::Profiler::LoggingStrategy::id
std::string id
Definition: LoggingStrategy.h:110
armarx::Profiler::LoggingStrategy::logStatechartOutputParameters
virtual void logStatechartOutputParameters(pid_t processId, uint64_t timestamp, const std::string &stateIdentifier, const armarx::StateParameterMap &outputParameterMap)
Definition: LoggingStrategy.h:87
armarx::Profiler::LoggingStrategy::logStatechartTransition
virtual void logStatechartTransition(const ProfilerStatechartTransition &transition)
Definition: LoggingStrategy.h:72
armarx::Profiler::LoggingStrategy::logStatechartTransitionWithParameters
virtual void logStatechartTransitionWithParameters(pid_t processId, uint64_t timestamp, const TransitionIceBase &transition)
Definition: LoggingStrategy.h:92
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:28
armarx::Profiler::LoggingStrategy::logProcessMemoryUsage
virtual void logProcessMemoryUsage(pid_t processId, uint64_t timestamp, int memoryUsage)
Definition: LoggingStrategy.h:104