Let we make ttrace can trace worker threads if we want.
And also, let we make AsyncTaskManager's thread can use trace.
Change-Id: I4a04a1d480f0cf96541f380d46513258d85deee0
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
#define DALI_INTEGRATION_ADAPTOR_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/dali-adaptor-common.h>
const LogFactoryInterface& GetLogFactory();
/**
+ * @brief The trace factory allows installation of a trace function in worker threads.
+ * @return An interface to a tracing factory
+ */
+ const TraceFactoryInterface& GetTraceFactory();
+
+ /**
* @brief Register a processor implementing the Integration::Processor interface with dali-core.
* @param[in] processor the Processor to register
* @param[in] postProcessor set this processor required to be called after size negotiation. Default is false.
--- /dev/null
+#ifndef DALI_ADAPTOR_TRACE_FACTORY_INTERFACE_H
+#define DALI_ADAPTOR_TRACE_FACTORY_INTERFACE_H
+
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Dali
+{
+class TraceFactoryInterface
+{
+public:
+ /**
+ * @brief Install a trace function for this thread.
+ *
+ * Only need to use once per thread, before any processing occurs.
+ */
+ virtual void InstallTraceFunction() const = 0;
+};
+
+} // namespace Dali
+
+#endif //DALI_ADAPTOR_TRACE_FACTORY_INTERFACE_H
${adaptor_integration_api_dir}/adaptor-framework/scene-holder.h
${adaptor_integration_api_dir}/adaptor-framework/scene-holder-impl.h
${adaptor_integration_api_dir}/adaptor-framework/thread-synchronization-interface.h
+ ${adaptor_integration_api_dir}/adaptor-framework/trace-factory-interface.h
${adaptor_integration_api_dir}/adaptor-framework/trigger-event-interface.h
${adaptor_integration_api_dir}/adaptor-framework/trigger-event-factory.h
${adaptor_integration_api_dir}/adaptor-framework/native-image-surface.h
return *mEnvironmentOptions;
}
+const TraceFactoryInterface& Adaptor::GetTraceFactory()
+{
+ return *mEnvironmentOptions;
+}
+
void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
{
GetCore().RegisterProcessor(processor, postProcessor);
const LogFactoryInterface& GetLogFactory();
/**
+ * @copydoc Dali::Adaptor::GetTraceFactory
+ */
+ const TraceFactoryInterface& GetTraceFactory();
+
+ /**
* @copydoc Dali::Adaptor::RegisterProcessor
*/
void RegisterProcessor(Integration::Processor& processor, bool postProcessor);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return mImpl->GetLogFactory();
}
+const TraceFactoryInterface& Adaptor::GetTraceFactory()
+{
+ return mImpl->GetTraceFactory();
+}
+
void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
{
mImpl->RegisterProcessor(processor, postProcessor);
: mConditionalWait(),
mAsyncTaskManager(asyncTaskManager),
mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+ mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
mDestroyThread(false),
mIsThreadStarted(false),
mIsThreadIdle(true)
SetThreadName("AsyncTaskThread");
#endif
mLogFactory.InstallLogFunction();
+ mTraceFactory.InstallTraceFunction();
while(!mDestroyThread)
{
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/public-api/common/list-wrapper.h>
#include <dali/public-api/object/base-object.h>
AsyncTaskThread& operator=(const AsyncTaskThread& thread) = delete;
private:
- ConditionalWait mConditionalWait;
- AsyncTaskManager& mAsyncTaskManager;
- const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
- bool mDestroyThread;
- bool mIsThreadStarted;
- bool mIsThreadIdle;
+ ConditionalWait mConditionalWait;
+ AsyncTaskManager& mAsyncTaskManager;
+ const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
+ const Dali::TraceFactoryInterface& mTraceFactory; ///< The trace factory
+ bool mDestroyThread;
+ bool mIsThreadStarted;
+ bool mIsThreadIdle;
};
/**
#define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
#include <dali/internal/adaptor/common/threading-mode.h>
namespace Dali
* the ability to install a log function.
*
*/
-class EnvironmentOptions : public Dali::LogFactoryInterface
+class EnvironmentOptions : public Dali::LogFactoryInterface, public Dali::TraceFactoryInterface
{
public:
/**
void CreateTraceManager(PerformanceInterface* performanceInterface);
/**
- * Initialize TraceManager by installing Trace function.
+ * Install the TraceManager's trace function for the current thread.
*/
- void InstallTraceFunction() const;
+ void InstallTraceFunction() const override;
/**
* @param logFunction logging function
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mWindowBase(nullptr),
mWindowRotationTrigger(),
mLogFactory(Dali::Adaptor::Get().GetLogFactory()),
+ mTraceFactory(Dali::Adaptor::Get().GetTraceFactory()),
mPositionSize(positionSize),
mColorDepth(colorDepth),
mGLInitCallback(),
{
Dali::SetThreadName("GlWindowRenderThread");
mLogFactory.InstallLogFunction();
+ mTraceFactory.InstallTraceFunction();
int renderFrameResult = 0;
unsigned int isSurfaceChanged = 0;
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_RENDER_THREAD_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/thread.h>
+#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
// INTERNAL INCLUDES
#include <dali/internal/graphics/gles/egl-graphics.h>
WindowBase* mWindowBase;
std::unique_ptr<TriggerEventInterface> mWindowRotationTrigger;
- const Dali::LogFactoryInterface& mLogFactory;
+ const Dali::LogFactoryInterface& mLogFactory;
+ const Dali::TraceFactoryInterface& mTraceFactory;
PositionSize mPositionSize; ///< Position
ColorDepth mColorDepth;