Add GetCallbackInvocationThread() for AsyncTaskMananager
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / update-status-logger.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/system/common/update-status-logger.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/core.h>
23 #include <string>
24
25 // INTERNAL INCLUDES
26 #include <dali/internal/system/common/environment-options.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace Adaptor
33 {
34 UpdateStatusLogger::UpdateStatusLogger(const EnvironmentOptions& environmentOptions)
35 : mStatusLogInterval(environmentOptions.GetUpdateStatusLoggingFrequency()),
36   mStatusLogCount(0u)
37 {
38 }
39
40 UpdateStatusLogger::~UpdateStatusLogger()
41 {
42 }
43
44 void UpdateStatusLogger::Log(unsigned int keepUpdatingStatus)
45 {
46   if(mStatusLogInterval)
47   {
48     std::string oss;
49
50     if(!(++mStatusLogCount % mStatusLogInterval))
51     {
52       oss = "UpdateStatusLogging keepUpdating: ";
53       oss += (keepUpdatingStatus ? "true" : "false");
54
55       if(keepUpdatingStatus)
56       {
57         oss += " because: ";
58       }
59
60       if(keepUpdatingStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING)
61       {
62         oss += "<Stage::KeepRendering() used> ";
63       }
64
65       if(keepUpdatingStatus & Integration::KeepUpdating::ANIMATIONS_RUNNING)
66       {
67         oss += "<Animations running> ";
68       }
69
70       if(keepUpdatingStatus & Integration::KeepUpdating::MONITORING_PERFORMANCE)
71       {
72         oss += "<Monitoring performance> ";
73       }
74
75       if(keepUpdatingStatus & Integration::KeepUpdating::RENDER_TASK_SYNC)
76       {
77         oss += "<Render task waiting for completion> ";
78       }
79
80       DALI_LOG_UPDATE_STATUS("%s\n", oss.c_str());
81     }
82   }
83 }
84
85 } // namespace Adaptor
86
87 } // namespace Internal
88
89 } // namespace Dali