Render to Frame Buffer Object.
[platform/core/uifw/dali-adaptor.git] / adaptors / base / 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 "update-status-logger.h"
20
21 // EXTERNAL INCLUDES
22 #include <string>
23 #include <dali/integration-api/core.h>
24
25 // INTERNAL INCLUDES
26 #include <base/environment-options.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 UpdateStatusLogger::UpdateStatusLogger( const EnvironmentOptions& environmentOptions )
38 : mStatusLogInterval( environmentOptions.GetUpdateStatusLoggingFrequency() ),
39   mStatusLogCount( 0u )
40 {
41 }
42
43 UpdateStatusLogger::~UpdateStatusLogger()
44 {
45 }
46
47 void UpdateStatusLogger::Log( unsigned int keepUpdatingStatus )
48 {
49   if ( mStatusLogInterval )
50   {
51     std::string oss;
52
53     if ( !(++mStatusLogCount % mStatusLogInterval) )
54     {
55       oss = "UpdateStatusLogging keepUpdating: ";
56       oss += (keepUpdatingStatus ? "true":"false");
57
58       if ( keepUpdatingStatus )
59       {
60         oss += " because: ";
61       }
62
63       if ( keepUpdatingStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING )
64       {
65         oss += "<Stage::KeepRendering() used> ";
66       }
67
68       if ( keepUpdatingStatus & Integration::KeepUpdating::ANIMATIONS_RUNNING )
69       {
70         oss  +=  "<Animations running> ";
71       }
72
73       if ( keepUpdatingStatus & Integration::KeepUpdating::MONITORING_PERFORMANCE )
74       {
75         oss += "<Monitoring performance> ";
76       }
77
78       if ( keepUpdatingStatus & Integration::KeepUpdating::RENDER_TASK_SYNC )
79       {
80         oss += "<Render task waiting for completion> ";
81       }
82
83       DALI_LOG_UPDATE_STATUS( "%s\n", oss.c_str());
84     }
85   }
86 }
87
88 } // namespace Adaptor
89
90 } // namespace Internal
91
92 } // namespace Dali