4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35 #include <pthread.h> // for pthread_mutex_t
45 #define MAX_PATH_LENGTH 256
46 #define MAX_STACK_DEPTH 128
47 #define TRIM_STACK_DEPTH 2
50 #define WIN_RENDER_POST 0
51 #define CONTROLBAR_RENDER_POST 1
52 #define NAVIFRAME_RENDER_POST 2
53 #define PAGER_RENDER_POST 3
54 #define RENDER_POST_COUNT 4
56 #define SNAPSHOT_WAIT_TIME_MAX 10000
59 #define TS_NONE 0x0000
60 #define TS_PROBE 0x0001
61 #define TS_INIT 0x0002
62 #define TS_FINIT 0x0004
63 #define TS_ENTER_PROBE_BLOCK 0x0008
64 #define TS_SET_PROBE_POINT 0x0010
65 #define TS_PRINT_LOG 0x0020
66 #define TS_PRINT_SAMPLE_LOG 0x0040
67 #define TS_APPEND_TYPE_LOG 0x0080
68 #define TS_BACKTRACE 0x0100
69 #define TS_HASHFUNC 0x0200
70 #define TS_PROFIL_THREAD 0x0400
71 #define TS_PROFIL_COUNT 0x0800
72 #define TS_DETECT_TOUCH 0x1000
73 #define TS_REGIST_SCREEN_CHANGE 0x2000
74 #define TS_POSSIBLE_CAPTURE 0x4000
75 #define TRACE_STATE_SET(value) ((gSTrace) |= (value))
76 #define TRACE_STATE_UNSET(value) ((gSTrace) &= (~value))
78 #define ENABLE_INTERNAL_MALLOC 0x0001
79 #define ENABLE_SNAPSHOT 0x0002
81 #define SCREENSHOT_LOCK() \
84 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
85 old = gTraceInfo.screenshot.state; \
86 gTraceInfo.screenshot.state = -1; \
87 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
89 if(isOptionEnabled(OPT_SNAPSHOT)) \
94 #define SCREENSHOT_UNLOCK() \
96 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
97 gTraceInfo.screenshot.state = 1; \
98 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
101 #define SCREENSHOT_SET() \
104 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
105 old = gTraceInfo.screenshot.state; \
106 if(gTraceInfo.screenshot.state >= 0) \
107 gTraceInfo.screenshot.state = 1; \
108 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
110 if(isOptionEnabled(OPT_SNAPSHOT)) \
115 #define SCREENSHOT_UNSET() \
117 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
118 if(gTraceInfo.screenshot.state >= 0) \
119 gTraceInfo.screenshot.state = 0; \
120 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
123 #define SCREENSHOT_DONE() \
126 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
127 old = gTraceInfo.screenshot.state; \
128 if(gTraceInfo.screenshot.state == 1) { \
129 gTraceInfo.screenshot.state = 2; \
130 } else if(gTraceInfo.screenshot.state == 2) { \
131 gTraceInfo.screenshot.state = 0; \
134 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
136 activateCaptureTimer(); \
137 } else if(old == 2) { \
138 if(isOptionEnabled(OPT_SNAPSHOT)) \
143 #define NUM_ORIGINAL_LIBRARY 9
153 LIBECORE_INPUT_EVAS = 6,
155 LIBCAPI_APPFW_APPLICATION = 8
158 extern char *lib_string[NUM_ORIGINAL_LIBRARY];
159 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
161 // type definition for global variable
165 pthread_mutex_t eventMutex;
171 pthread_mutex_t sockMutex;
177 unsigned int startTime;
183 pthread_mutex_t ssMutex;
197 __screenshotInfo screenshot;
201 int custom_chart_callback_count;
202 unsigned long optionflag;
205 extern __thread unsigned long gSTrace;
206 extern __traceInfo gTraceInfo;
208 char** da_backtrace_symbols (void* const* array, int size);
209 char** cached_backtrace_symbols (void* const* array, int size);
212 int __profil(int mode);
215 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
217 // screen capture functions
218 int initialize_screencapture();
219 int finalize_screencapture();
221 int activateCaptureTimer();
222 void _cb_render_post(void* data, Evas* e, void* eventinfo);
224 // event related functions
225 int initialize_event();
226 int finalize_event();
227 int getOrientation();
228 void orientationEnabled();
229 void on_orientation_changed(int angle, bool capi);
231 int remove_indir(const char* dirname);
234 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
240 #endif // _DAHELPER_H_