From a9cb674aa6b0279598fd9cfcb422ad78589048b1 Mon Sep 17 00:00:00 2001 From: woojin Date: Wed, 24 Apr 2013 18:29:00 +0900 Subject: [PATCH] fix bug of runtime configuration for function profiling Change-Id: I6775f217e63a2692b508daa657a78deb03f0ff2e --- probe_userfunc/libdauserfunc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/probe_userfunc/libdauserfunc.c b/probe_userfunc/libdauserfunc.c index a856ac3..6869d97 100755 --- a/probe_userfunc/libdauserfunc.c +++ b/probe_userfunc/libdauserfunc.c @@ -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"); -- 2.7.4