[FEATURE] Osp: total remove
[platform/core/system/swap-probe.git] / include / dahelper.h
index a25814a..feceba5 100755 (executable)
@@ -3,17 +3,17 @@
  *
  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
- * Contact: 
+ * Contact:
  *
  * Jaewon Lim <jaewon81.lim@samsung.com>
  * Woojin Jung <woojin2.jung@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
- * 
+ *
  * This library is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the
  * Free Software Foundation; either version 2.1 of the License, or (at your option)
  * any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
@@ -25,7 +25,7 @@
  *
  * Contributors:
  * - S-Core Co., Ltd
- * 
+ *
  */
 
 #ifndef _DAHELPER_H_
@@ -42,6 +42,8 @@
 extern "C"{
 #endif
 
+extern int app_efl_main_flg;
+
 #define MAX_PATH_LENGTH                256
 #define MAX_STACK_DEPTH                128
 #define TRIM_STACK_DEPTH       2
@@ -56,30 +58,16 @@ extern "C"{
 #define SNAPSHOT_WAIT_TIME_MAX 10000
 */
 
-#define TS_NONE                                                0x00000000
-#define TS_PROBE                                       0x00000001
-#define TS_INIT                                                0x00000002
-#define TS_FINIT                                       0x00000004
-#define TS_ENTER_PROBE_BLOCK           0x00000008
-#define TS_SET_PROBE_POINT                     0x00000010
-#define TS_PRINT_LOG                           0x00000020
-#define TS_PRINT_SAMPLE_LOG                    0x00000040
-#define TS_APPEND_TYPE_LOG                     0x00000080
-#define TS_BACKTRACE                           0x00000100
-#define TS_HASHFUNC                                    0x00000200
-#define TS_PROFIL_THREAD                       0x00000400
-#define TS_PROFIL_COUNT                                0x00000800
-#define TS_DETECT_TOUCH                                0x00001000
-#define TS_REGIST_SCREEN_CHANGE                0x00002000
-#define TS_POSSIBLE_CAPTURE                    0x00004000
-#define TS_RECV_THREAD                         0x00008000
-#define TS_CUSTOM_CHART_THREAD         0x00010000
-#define TRACE_STATE_SET(value)         ((gSTrace) |= (value))
-#define TRACE_STATE_UNSET(value)       ((gSTrace) &= (~value))
-
 #define ENABLE_INTERNAL_MALLOC         0x0001
 #define ENABLE_SNAPSHOT                                0x0002
 
+#define LOG(FORMAT, ...)                                       \
+       do {                                                                    \
+               char buf[128];                                          \
+               sprintf(buf, FORMAT, __VA_ARGS__);      \
+               PRINTMSG(buf);                                          \
+       } while(0)                                                              \
+
 #define SCREENSHOT_LOCK()                                                                              \
        do {                                                                                                            \
                int old;                                                                                                \
@@ -96,7 +84,8 @@ extern "C"{
 #define SCREENSHOT_UNLOCK()                                                                            \
        do {                                                                                                            \
                pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
-               gTraceInfo.screenshot.state = 1;                                                \
+               if(gTraceInfo.screenshot.state < 0)                                             \
+                       gTraceInfo.screenshot.state = 1;                                        \
                pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
        } while(0)
 
@@ -127,16 +116,23 @@ extern "C"{
                int old;                                                                                                \
                pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
                old = gTraceInfo.screenshot.state;                                              \
-               if(gTraceInfo.screenshot.state == 1) {                                  \
+               if(gTraceInfo.screenshot.state == 1)                                    \
                        gTraceInfo.screenshot.state = 2;                                        \
-               } else if(gTraceInfo.screenshot.state == 2) {                   \
-                       gTraceInfo.screenshot.state = 0;                                        \
-               } else {                                                                                                \
-               }                                                                                                               \
                pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
                if(old == 1) {                                                                                  \
                        activateCaptureTimer();                                                         \
-               } else if(old == 2) {                                                                   \
+               }                                                                                                               \
+       } while(0)
+
+#define SCREENSHOT_TIMEOUT()                                                                   \
+       do {                                                                                                            \
+               int old;                                                                                                \
+               pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex));   \
+               old = gTraceInfo.screenshot.state;                                              \
+               if(gTraceInfo.screenshot.state == 2)                                    \
+                       gTraceInfo.screenshot.state = 0;                                        \
+               pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
+               if(old == 2) {                                                                                  \
                        if(isOptionEnabled(OPT_SNAPSHOT))                                       \
                                captureScreen();                                                                \
                }                                                                                                               \
@@ -149,15 +145,15 @@ typedef enum
        LIBC = 0,
        LIBPTHREAD = 1,
        LIBELEMENTARY = 2,
-       LIBOSP_UIFW = 3,
-       LIBOSP_APPFW = 4,
-       LIBOSP_WEB = 5,
-       LIBECORE_INPUT_EVAS = 6,
-       LIBDAEMON = 7,
-       LIBCAPI_APPFW_APPLICATION = 8
+       LIBECORE_INPUT_EVAS = 3,
+       LIBDAEMON = 4,
+       LIBCAPI_APPFW_APPLICATION = 5,
+       LIBGLES20 = 6,
+       LIBEGL = 7,
+       LIBSELF = 8
 } ORIGINAL_LIBRARY;
 
-extern char *lib_string[NUM_ORIGINAL_LIBRARY];
+extern const char *lib_string[NUM_ORIGINAL_LIBRARY];
 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
 
 // type definition for global variable
@@ -176,7 +172,7 @@ typedef struct
 typedef struct
 {
        char appName[128];
-       unsigned int startTime;
+       uint64_t startTime;
 } __appInfo;
 
 typedef struct
@@ -201,10 +197,9 @@ typedef struct
        int                                     stateTouch;
        int                                     init_complete;
        int                                     custom_chart_callback_count;
-       unsigned long           optionflag;
+       uint64_t                optionflag;
 } __traceInfo;
 
-extern __thread unsigned long  gSTrace;
 extern __traceInfo gTraceInfo;
 
 int get_map_address(void* symbol, void** map_start, void** map_end);
@@ -216,6 +211,8 @@ int __profil(int mode);
 
 //wchar_t* -> char*
 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
+char *absolutize_filepath(char buf[PATH_MAX], const char *fname);
+void application_exit();
 
 // screen capture functions
 int initialize_screencapture();
@@ -228,7 +225,6 @@ void _cb_render_post(void* data, Evas* e, void* eventinfo);
 int initialize_event();
 int finalize_event();
 int getOrientation();
-void orientationEnabled();
 void on_orientation_changed(int angle, bool capi);
 
 int remove_indir(const char* dirname);