fix bug of runtime configuration for function profiling
authorwoojin <woojin2.jung@samsung.com>
Wed, 24 Apr 2013 09:29:00 +0000 (18:29 +0900)
committerwoojin <woojin2.jung@samsung.com>
Wed, 24 Apr 2013 09:29:00 +0000 (18:29 +0900)
Change-Id: I6775f217e63a2692b508daa657a78deb03f0ff2e

probe_userfunc/libdauserfunc.c

index a856ac3..6869d97 100755 (executable)
@@ -68,7 +68,7 @@ void *custom_cb_addr = (void*)-1;
 
 extern __thread unsigned long gSTrace;
 
-int is_profil_allowed = 0;
+int profil_option = 0;
 volatile int profil_turned_on = 0;
 volatile int profil_thread_on = 0;
 u_long low_pc, high_pc;
@@ -493,8 +493,11 @@ int __profil(int mode)
        static struct sigaction oact;
        static struct itimerval otimer;
 
-       if(is_profil_allowed != 1)
+       if(profil_thread_on != 1)
+       {
+               profil_option = mode;
                return 0;
+       }
 
        if(mode == 0)
        {
@@ -539,11 +542,11 @@ void __monstartup(u_long lowpc, u_long highpc)
 {
        low_pc = lowpc;
        high_pc = highpc;
-       is_profil_allowed = 1;
 
        pthread_mutex_init(&profil_log_mutex, NULL);
        probeBlockStart();
        profil_thread_on = 1;
+       __profil(profil_option);
        if(pthread_create(&profil_log_thread, NULL, &profil_log_func, NULL) < 0)
        {
                perror("Fail to create profil_log thread");