[PROTO] opengl probes: elapsed time in nsec (8 bytes)
authorNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 19 Sep 2013 15:50:08 +0000 (19:50 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Thu, 19 Sep 2013 15:50:08 +0000 (19:50 +0400)
Change-Id: Iae78d19f6996f8f7b6ef250d75a951ad82d2e931
Signed-off-by: Nikita Kalyazin <n.kalyazin@samsung.com>
helper/libdaprobe.c
include/daprobe.h
probe_graphics/da_gles20.h

index 903c9f0..d4620c6 100755 (executable)
@@ -41,6 +41,7 @@
 #include <unistd.h>                    // for write, alarm function, syscall
 #include <pthread.h>           // for pthread_mutex_lock
 #include <signal.h>
+#include <stdint.h>
 
 #include <sys/syscall.h>       // for syscall
 #include <sys/time.h>          // for gettimeofday
@@ -743,6 +744,13 @@ unsigned int getCurrentEventIndex()
        return gTraceInfo.index.eventIndex;
 }
 
+uint64_t get_current_nsec(void)
+{
+       struct timeval tv;
+       gettimeofday(&tv, NULL);
+       return (uint64_t)tv.tv_sec * 1000 * 1000 * 1000 + tv.tv_usec * 1000;
+}
+
 /************************************************************************
  * probe functions
  ************************************************************************/
index 4c56cc6..f45245f 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <dlfcn.h>
+#include <stdint.h>
 #include "probeinfo.h"
 
 #ifdef __cplusplus
@@ -108,6 +109,7 @@ void postBlockEnd();
 
 unsigned int getCurrentEventIndex();
 unsigned long getCurrentTime();
+uint64_t get_current_nsec(void);
 bool setProbePoint(probeInfo_t * iProbe);
 int update_heap_memory_size(bool isAdd, size_t size);
 
index de21fa4..7e7d6fe 100644 (file)
@@ -50,7 +50,7 @@ char contextValue[256];
 #define PACK_GL_ADD(GL_api_type, GL_elapsed_time, GL_context_value)            \
        do {                                                    \
                BUF_PTR = pack_int32(BUF_PTR, (uint32_t)GL_api_type);   \
-               BUF_PTR = pack_int32(BUF_PTR, (uint32_t)GL_elapsed_time);       \
+               BUF_PTR = pack_int64(BUF_PTR, (uint64_t)GL_elapsed_time); \
                BUF_PTR = pack_string(BUF_PTR, GL_context_value);       \
        } while (0)
 
@@ -61,7 +61,7 @@ char contextValue[256];
        static methodType FUNCNAME ## p = 0;                            \
        void* tmpPtr = 0;                                               \
        int32_t vAPI_ID = API_ID_ ## FUNCNAME;                          \
-       long startTime = getCurrentTime();                              \
+       uint64_t start_nsec = get_current_nsec();                               \
        if(!FUNCNAME##p) {                                              \
                probeBlockStart();                                      \
                if (lib_handle[LIBGLES20] == ((void *) 0)) {            \
@@ -94,7 +94,7 @@ char contextValue[256];
        static methodType FUNCNAME ## p = 0;                    \
        void* tmpPtr = 0;                                       \
        int32_t vAPI_ID = API_ID_ ## FUNCNAME;                  \
-       long startTime = getCurrentTime();                      \
+       uint64_t start_nsec = get_current_nsec();                       \
        if(!FUNCNAME##p) {                                              \
                probeBlockStart();                                      \
                if (lib_handle[LIBEGL] == ((void *) 0)) {               \
@@ -125,7 +125,7 @@ char contextValue[256];
        static methodType FUNCNAME ## p = 0;                    \
        void* tmpPtr = 0;                                       \
        int32_t vAPI_ID = API_ID_ ## FUNCNAME;                  \
-       long startTime = getCurrentTime();                      \
+       uint64_t start_nsec = get_current_nsec();                               \
        PREPARE_LOCAL_BUF();                                    \
        if(!FUNCNAME##p) {                                              \
                probeBlockStart();                                      \
@@ -156,7 +156,7 @@ char contextValue[256];
        PREPARE_LOCAL_BUF();                                                    \
        PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, INPUTFORMAT, __VA_ARGS__);\
        PACK_COMMON_END(RET_VAL, error, blockresult);                                   \
-       PACK_GL_ADD(APITYPE, getCurrentTime()-startTime, CONTEXT_VAL);          \
+       PACK_GL_ADD(APITYPE, get_current_nsec() - start_nsec, CONTEXT_VAL);     \
        FLUSH_LOCAL_BUF();                                                      \
        POST_PACK_PROBEBLOCK_END()