1 #ifndef DALI_PERFORMANCE_LOGGER_H
2 #define DALI_PERFORMANCE_LOGGER_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/dali-adaptor-common.h>
29 namespace Internal DALI_INTERNAL
33 class PerformanceLogger;
35 } // namespace DALI_INTERNAL
38 * @brief Performance logger class
40 class DALI_ADAPTOR_API PerformanceLogger : public BaseHandle
44 * Enum for events that can be logged
48 START_EVENT, ///< The start of timing
49 END_EVENT ///< The end of timing
53 * @brief Constructor, creates an uninitialized logger.
55 * Call New to fully construct a logger.
60 * @brief Create a new logger
62 * @param[in] name The name of the logger. This needs to be a compile-time literal and alive for the whole lifetime of the performance logger.
63 * @return a new logger
65 static PerformanceLogger New(const char* name);
68 * @brief Copy constructor.
70 * @param[in] logger The handle to copy. The copied handle will point at the same implementation
72 PerformanceLogger(const PerformanceLogger& logger);
75 * @brief Assignment operator.
77 * @param[in] logger The handle to copy. This handle will point at the same implementation
78 * as the copied handle.
79 * @return Reference to this logger handle
81 PerformanceLogger& operator=(const PerformanceLogger& logger);
86 * This is non-virtual since derived Handle types must not contain data or virtual methods.
91 * @brief Downcast an Object handle to PerformanceLogger handle.
93 * If handle points to a PerformanceLogger object the downcast produces a valid
94 * handle. If not the returned handle is left uninitialized.
96 * @param[in] handle to An object
97 * @return handle to a PerformanceLogger object or an uninitialized handle
99 static PerformanceLogger DownCast(BaseHandle handle);
102 * Add a performance marker
104 * @param markerType Performance marker type
106 void AddMarker(Marker markerType);
109 * Set the logging frequency
111 * @param logFrequency how often to log out in seconds
113 void SetLoggingFrequency(unsigned int logFrequency);
116 * Set logging on or off for this logger
118 * @param[in] enable Enable logging or not
120 void EnableLogging(bool enable);
122 // Not intended for application developers
125 * Creates a new handle from the implementation.
126 * @param[in] impl A pointer to the object.
128 explicit DALI_INTERNAL PerformanceLogger(Internal::Adaptor::PerformanceLogger* impl);
133 #endif // DALI_PERFORMANCE_LOGGER_H