print the time of tbm_bufmgr_init 76/91376/2
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 7 Oct 2016 07:35:13 +0000 (16:35 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 11 Oct 2016 06:13:10 +0000 (23:13 -0700)
default disabled

Change-Id: I4c18fda4c2c50a4fb0cddb3cd4bab9702ef1d067

src/tbm_bufmgr.c
src/tbm_bufmgr_int.h

index 26b09d6..b27b6d3 100644 (file)
@@ -57,6 +57,8 @@ static __thread tbm_error_e tbm_last_error = TBM_ERROR_NONE;
 
 static void _tbm_bufmgr_mutex_unlock(void);
 
+//#define TBM_BUFMGR_INIT_TIME
+
 #define PREFIX_LIB    "libtbm_"
 #define SUFFIX_LIB    ".so"
 #define DEFAULT_LIB   PREFIX_LIB"default"SUFFIX_LIB
@@ -564,8 +566,17 @@ tbm_bufmgr_init(int fd)
 {
        char *env;
 
+#ifdef TBM_BUFMGR_INIT_TIME
+       struct timeval start_tv, end_tv;
+#endif
+
        pthread_mutex_lock(&gLock);
 
+#ifdef TBM_BUFMGR_INIT_TIME
+       /* get the start tv */
+       gettimeofday(&start_tv, NULL);
+#endif
+
        /* LCOV_EXCL_START */
 #ifdef HAVE_DLOG
        env = getenv("TBM_DLOG");
@@ -668,6 +679,12 @@ tbm_bufmgr_init(int fd)
        /* intialize debug_key_list */
        LIST_INITHEAD(&gBufMgr->debug_key_list);
 
+#ifdef TBM_BUFMGR_INIT_TIME
+       /* get the end tv */
+       gettimeofday(&end_tv, NULL);
+       TBM_LOG_I("tbm_bufmgr_init time: %ld ms", ((end_tv.tv_sec * 1000 + end_tv.tv_usec / 1000) - (start_tv.tv_sec * 1000 + start_tv.tv_usec / 1000)));
+#endif
+
        pthread_mutex_unlock(&gLock);
 
        return gBufMgr;
index f78bee3..94b7019 100644 (file)
@@ -32,10 +32,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef _TBM_BUFMGR_INT_H_
 #define _TBM_BUFMGR_INT_H_
 
+#include <sys/time.h>
 #include <unistd.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>