/*
- * 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.
delete mCore;
}
-void TestApplication::LogContext(bool start, const char* tag)
+void TestApplication::LogContext(bool start, const char* tag, const char* message)
{
if(start)
{
- fprintf(stderr, "INFO: Trace Start: %s\n", tag);
+ fprintf(stderr, "INFO: Trace Start: %s %s\n", tag, message ? message : "");
}
else
{
- fprintf(stderr, "INFO: Trace End: %s\n", tag);
+ fprintf(stderr, "INFO: Trace End: %s %s\n", tag, message ? message : "");
}
}
#define DALI_TEST_APPLICATION_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.
void InitializeCore();
~TestApplication() override;
static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
- static void LogContext(bool start, const char* tag);
+ static void LogContext(bool start, const char* tag, const char* message);
Dali::Integration::Core& GetCore();
TestPlatformAbstraction& GetPlatform();
TestRenderController& GetRenderController();
/*
- * 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.
gThreadLocalLogContextFunction = logContextFunction;
}
-void LogContext(bool start, const char* tag)
+void LogContext(bool start, const char* tag, const char* message)
{
if(!gThreadLocalLogContextFunction)
{
return;
}
- gThreadLocalLogContextFunction(start, tag);
+ gThreadLocalLogContextFunction(start, tag, message);
}
#ifdef TRACE_ENABLED
*/
void Filter::BeginTrace(const char* tagName)
{
- Dali::Integration::Trace::LogContext(true, tagName);
+ Dali::Integration::Trace::LogContext(true, tagName, nullptr);
+}
+
+void Filter::BeginTrace(const char* tagName, const char* message)
+{
+ Dali::Integration::Trace::LogContext(true, tagName, message);
}
/**
*/
void Filter::EndTrace(const char* tagName)
{
- Dali::Integration::Trace::LogContext(false, tagName);
+ Dali::Integration::Trace::LogContext(false, tagName, nullptr);
+}
+
+void Filter::EndTrace(const char* tagName, const char* message)
+{
+ Dali::Integration::Trace::LogContext(false, tagName, message);
}
/**
#define DALI_INTEGRATION_TRACE_H
/*
- * Copyright (c) 2020 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.
{
/**
* Used by tracing macros to log a context message
- * @param start a bool to indicate start (true) or end (false) of the tracing / logging
- * @param tag a unique event tag name
+ * @param[in] start a bool to indicate start (true) or end (false) of the tracing / logging
+ * @param[in] tag a unique event tag name
+ * @param[in] message an additional message for this trace. Ignore if it is nullptr
*/
-DALI_CORE_API void LogContext(bool start, const char* tag);
+DALI_CORE_API void LogContext(bool start, const char* tag, const char* message = nullptr);
/**
* typedef for the LogContextFunction function.
*/
-using LogContextFunction = void (*)(bool, const char*);
+using LogContextFunction = void (*)(bool, const char*, const char*);
/**
* A LogContextFunction function has to be installed for every thread that wants to use tracing.
void BeginTrace(const char* tagName);
/**
+ * Begin trace.
+ * @param[in] tagName - a unique event tag name.
+ * @param[in] message - an additional message for this trace if needs.
+ */
+ void BeginTrace(const char* tagName, const char* message);
+
+ /**
* End trace.
* @param[in] tagName - a unique event tag name.
*/
void EndTrace(const char* tagName);
/**
+ * End trace.
+ * @param[in] tagName - a unique event tag name.
+ * @param[in] message - an additional message for this trace if needs.
+ */
+ void EndTrace(const char* tagName, const char* message);
+
+ /**
* Enable trace on all filters.
*/
static void EnableGlobalTrace();
filter->BeginTrace(tag); \
}
+#define DALI_TRACE_BEGIN_WITH_MESSAGE(filter, tag, message) \
+ if(filter && filter->IsTraceEnabled()) \
+ { \
+ filter->BeginTrace(tag, message); \
+ }
+
/**
* End of tracing
*/
filter->EndTrace(tag); \
}
+#define DALI_TRACE_END_WITH_MESSAGE(filter, tag, message) \
+ if(filter && filter->IsTraceEnabled()) \
+ { \
+ filter->EndTrace(tag, message); \
+ }
+
/**
* Used for function tracing. It logs tracing of the fuction from start to end.
*/
#define DALI_INIT_TRACE_FILTER(name, tag, enable)
#define DALI_TRACE_BEGIN(filter, tag)
+#define DALI_TRACE_BEGIN_WITH_MESSAGE(filter, tag, message)
#define DALI_TRACE_END(filter, tag)
+#define DALI_TRACE_END_WITH_MESSAGE(filter, tag, message)
#define DALI_TRACE_FUNCTION(filter)
#define DALI_TRACE_SCOPE(filter, tag)
/*
- * 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.
// CLASS HEADER
#include <dali/internal/event/events/key-event-processor.h>
+// EXTERNAL INCLUDES
+#ifdef TRACE_ENABLED
+#include <sstream> ///< for std::ostringstream
+#endif
+
// INTERNAL INCLUDES
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/trace.h>
namespace
{
DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
+#ifdef TRACE_ENABLED
+const char* KEY_EVENT_STATES[Dali::KeyEvent::State::UP + 1] =
+ {
+ "DOWN",
+ "UP",
+};
+#endif
} // namespace
KeyEventProcessor::KeyEventProcessor(Scene& scene)
KeyEventPtr keyEvent(new KeyEvent(event.keyName, event.logicalKey, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state), event.compose, event.deviceName, event.deviceClass, event.deviceSubclass));
Dali::KeyEvent keyEventHandle(keyEvent.Get());
- DALI_TRACE_SCOPE(gTraceFilter, "DALI_PROCESS_KEY_EVENT");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream stream;
+ stream << "[name:" << event.keyName << ", code:" << event.keyCode << ", state:" << KEY_EVENT_STATES[event.state] << ", time:" << event.time << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_PROCESS_KEY_EVENT", stream.str().c_str());
+ }
+#endif
// Emit the key event signal from the scene.
bool consumed = mScene.EmitInterceptKeyEventSignal(keyEventHandle);
{
mScene.EmitKeyEventSignal(keyEventHandle);
}
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ DALI_TRACE_END(gTraceFilter, "DALI_PROCESS_KEY_EVENT");
+ }
+#endif
}
} // namespace Internal