fix prevent violation
[framework/system/dynamic-analysis-probe.git] / probe_badaapi / bada_sync.cpp
1 /*
2  *  DA probe
3  *
4  * Copyright 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Woojin Jung <woojin2.jung@samsung.com>
9  * Jaewon Lim <jaewon81.lim@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  *
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  *
29  */
30
31 #include <FBaseResult.h>
32 #include <FBaseString.h>
33 #include <FBaseRtTypes.h>
34
35 #include <string.h>
36 #include "daprobe.h"
37 #include "probeinfo.h"
38 #include "dahelper.h"
39
40 static enum DaOptions _sopt = OPT_THREAD;
41
42 namespace Tizen {
43 namespace Base {
44 namespace Runtime {
45
46 class Mutex {
47 public:
48         result Create(void);
49         result Create(const Tizen::Base::String& name);
50         result Release(void);
51         result Acquire(void);
52         result TryToAcquire(void);
53
54 //      Mutex(void);
55 //      virtual ~Mutex(void);
56
57 //private:
58 //      Mutex(const Mutex& value);
59 //      Mutex& opereator =(const Mutex& value);
60
61 //private:
62 //      friend class _MutexImpl;
63 //      class _MutexImpl * __pMutexImpl;
64 };
65
66 class Semaphore {
67 public:
68         result Create(int count = 1);
69         result Create(const Tizen::Base::String& name, int count = 1);
70         result Acquire(long timeout = INFINITE);
71         result TryToAcquire(void);
72         result Release(void);
73
74 //      Semaphore(void);
75 //      virtual ~Semaphore(void);
76
77 //private:
78 //      Semaphore(const Semaphore& rhs);
79 //      Semaphore& operator =(const Semaphore& rhs);
80
81 //private:
82 //      friend class _SemaphoreImpl;
83 //      class _SemaphoreImpl * __pSemaphoreImpl;
84 };
85
86 class Monitor {
87 public:
88         result Construct(void);
89         result Enter(void);
90         result Exit(void);
91         result Wait(void);
92         result Notify(void);
93         result NotifyAll(void);
94
95 //      Monitor(void);
96 //      virtual ~Monitor(void);
97
98 //private:
99 //      Monitor(const Monitor& rhs);
100 //      Monitor& operator =(const Monitor& rhs);
101
102 //private:
103 //      friend class _MonitorImpl;
104 //      class _MonitorImpl * __pMonitorImpl;
105 };
106
107
108 result Mutex::Create(void) {
109         typedef result
110                 (Mutex::*methodType)(void);
111         static methodType Createp = 0;
112         result ret;
113         probeInfo_t probeInfo;
114         log_t log;
115         int blockresult;
116         bool bfiltering = true;
117         void *tmpPtr;
118
119         if (!Createp) {
120                 probeBlockStart();
121                 if(lib_handle[LIBOSP_APPFW] == NULL) {
122                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
123                         if (lib_handle[LIBOSP_APPFW] == NULL) {
124                                 perror("dlopen failed : libosp-appfw.so");
125                                 exit(0);
126                         }
127                 }
128                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateEv");
129
130                 if (tmpPtr == NULL || dlerror() != NULL) {
131                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
132                         exit(0);
133                 }
134
135                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
136
137                 probeBlockEnd();
138         }
139
140         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
141                 setProbePoint(&probeInfo);
142                 preBlockEnd();
143         }
144         //
145         ret = (this->*Createp)();
146         //
147         if (postBlockBegin(blockresult)) {
148                 log.type = 0;
149                 log.length = 0;
150                 log.data[0] = '\0';
151                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
152                                 probeInfo.eventIndex, "Mutex::Create",
153                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
154                 //Input,ret
155                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
156                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
157                 log.length += sprintf(log.data + log.length,
158                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
159                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_NEW);
160                 //callstack
161                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
162                 getBacktraceString(&log, 4096 - log.length - 17);
163                 log.length += sprintf(log.data + log.length, "`,callstack_end");
164
165                 printLog(&log, MSG_LOG);
166                 postBlockEnd();
167         }
168         return ret;
169 }
170
171 result Mutex::Create(const Tizen::Base::String& name) {
172         typedef result 
173                 (Mutex::*methodType)(const Tizen::Base::String& name);
174         static methodType Createp = 0;
175         result ret;
176         probeInfo_t probeInfo;
177         log_t log;
178         int blockresult;
179         bool bfiltering = true;
180         void *tmpPtr;
181         char temp[50];
182
183         if (!Createp) {
184                 probeBlockStart();
185                 if(lib_handle[LIBOSP_APPFW] == NULL) {
186                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
187                         if (lib_handle[LIBOSP_APPFW] == NULL) {
188                                 perror("dlopen failed : libosp-appfw.so");
189                                 exit(0);
190                         }
191                 }
192                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateERKNS0_6StringE");
193
194                 if (tmpPtr == NULL || dlerror() != NULL) {
195                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
196                         exit(0);
197                 }
198
199                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
200
201                 probeBlockEnd();
202         }
203
204         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
205                 setProbePoint(&probeInfo);
206                 preBlockEnd();
207         }
208         //
209         ret = (this->*Createp)(name);
210         //
211         if (postBlockBegin(blockresult)) {
212                 log.type = 0;
213                 log.length = 0;
214                 log.data[0] = '\0';
215                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
216                                 probeInfo.eventIndex, "Mutex::Create",
217                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
218                 //Input,ret
219                 WcharToChar(temp, name.GetPointer());
220                 log.length += sprintf(log.data + log.length, "`,%s`,%ld", temp, ret);
221                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
222                 log.length += sprintf(log.data + log.length,
223                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
224                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_NEW);
225                 //callstack
226                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
227                 getBacktraceString(&log, 4096 - log.length - 17);
228                 log.length += sprintf(log.data + log.length, "`,callstack_end");
229
230                 printLog(&log, MSG_LOG);
231                 postBlockEnd();
232         }
233         return ret;
234 }
235
236 result Mutex::Release(void) {
237         typedef result 
238                 (Mutex::*methodType)(void);
239         static methodType Releasep = 0;
240         result ret;
241         probeInfo_t probeInfo;
242         log_t log;
243         int blockresult;
244         bool bfiltering = true;
245         void *tmpPtr;
246
247         if (!Releasep) {
248                 probeBlockStart();
249                 if(lib_handle[LIBOSP_APPFW] == NULL) {
250                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
251                         if (lib_handle[LIBOSP_APPFW] == NULL) {
252                                 perror("dlopen failed : libosp-appfw.so");
253                                 exit(0);
254                         }
255                 }
256                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7ReleaseEv");
257
258                 if (tmpPtr == NULL || dlerror() != NULL) {
259                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Release");
260                         exit(0);
261                 }
262
263                 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
264
265                 probeBlockEnd();
266         }
267
268         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
269                 setProbePoint(&probeInfo);
270                 preBlockEnd();
271         }
272         //
273         ret = (this->*Releasep)();
274         //
275         if (postBlockBegin(blockresult)) {
276                 log.type = 0;
277                 log.length = 0;
278                 log.data[0] = '\0';
279                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
280                                 probeInfo.eventIndex, "Mutex::Release",
281                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
282                 //Input,ret
283                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
284                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
285                 log.length += sprintf(log.data + log.length,
286                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
287                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_RELEASE);
288                 //callstack
289                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
290                 getBacktraceString(&log, 4096 - log.length - 17);
291                 log.length += sprintf(log.data + log.length, "`,callstack_end");
292
293                 printLog(&log, MSG_LOG);
294                 postBlockEnd();
295         }
296         return ret;
297 }
298
299 result Mutex::Acquire(void) {
300         typedef result
301                 (Mutex::*methodType)(void);
302         static methodType Acquirep = 0;
303         result ret;
304         probeInfo_t probeInfo;
305         log_t log;
306         int blockresult;
307         bool bfiltering = true;
308         void *tmpPtr;
309
310         if (!Acquirep) {
311                 probeBlockStart();
312                 if(lib_handle[LIBOSP_APPFW] == NULL) {
313                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
314                         if (lib_handle[LIBOSP_APPFW] == NULL) {
315                                 perror("dlopen failed : libosp-appfw.so");
316                                 exit(0);
317                         }
318                 }
319                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7AcquireEv");
320
321                 if (tmpPtr == NULL || dlerror() != NULL) {
322                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Acquire");
323                         exit(0);
324                 }
325
326                 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
327
328                 probeBlockEnd();
329         }
330
331         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
332                 setProbePoint(&probeInfo);
333                 log.type = 0;
334                 log.length = 0;
335                 log.data[0] = '\0';
336                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
337                                 probeInfo.eventIndex, "Mutex::Acquire",
338                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
339                 //Input,ret
340                 log.length += sprintf(log.data + log.length, "`,`,");
341                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
342                 log.length += sprintf(log.data + log.length,
343                                 "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
344                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_ACQUIRE_WAIT_START);
345                 //callstack
346                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
347                 getBacktraceString(&log, 4096 - log.length - 17);
348                 log.length += sprintf(log.data + log.length, "`,callstack_end");
349
350                 printLog(&log, MSG_LOG);
351                 preBlockEnd();
352         }
353         //
354         ret = (this->*Acquirep)();
355         //
356         if (postBlockBegin(blockresult)) {
357                 setProbePoint(&probeInfo);
358                 log.type = 0;
359                 log.length = 0;
360                 log.data[0] = '\0';
361                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
362                                 probeInfo.eventIndex, "Mutex::Acquire",
363                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
364                 //Input,ret
365                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
366                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
367                 log.length += sprintf(log.data + log.length,
368                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
369                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_ACQUIRE_WAIT_END);
370                 //callstack
371                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
372                 getBacktraceString(&log, 4096 - log.length - 17);
373                 log.length += sprintf(log.data + log.length, "`,callstack_end");
374
375                 printLog(&log, MSG_LOG);
376                 postBlockEnd();
377         }
378         return ret;
379 }
380
381 result Mutex::TryToAcquire(void) {
382         typedef result 
383                 (Mutex::*methodType)(void);
384         static methodType TryToAcquirep = 0;
385         result ret;
386         probeInfo_t probeInfo;
387         log_t log;
388         int blockresult;
389         bool bfiltering = true;
390         void *tmpPtr;
391
392         if (!TryToAcquirep) {
393                 probeBlockStart();
394                 if(lib_handle[LIBOSP_APPFW] == NULL) {
395                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
396                         if (lib_handle[LIBOSP_APPFW] == NULL) {
397                                 perror("dlopen failed : libosp-appfw.so");
398                                 exit(0);
399                         }
400                 }
401                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex12TryToAcquireEv");
402
403                 if (tmpPtr == NULL || dlerror() != NULL) {
404                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::TryToAcquire");
405                         exit(0);
406                 }
407
408                 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
409
410                 probeBlockEnd();
411         }
412
413         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
414                 setProbePoint(&probeInfo);
415                 preBlockEnd();
416         }
417         //
418         ret = (this->*TryToAcquirep)();
419         //
420         if (postBlockBegin(blockresult)) {
421                 log.type = 0;
422                 log.length = 0;
423                 log.data[0] = '\0';
424                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
425                                 probeInfo.eventIndex, "Mutex::TryToAcquire",
426                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
427                 //Input,ret
428                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
429                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
430                 log.length += sprintf(log.data + log.length,
431                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
432                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MUTEX, SYNC_API_TRY_ACQUIRE);
433                 //callstack
434                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
435                 getBacktraceString(&log, 4096 - log.length - 17);
436                 log.length += sprintf(log.data + log.length, "`,callstack_end");
437
438                 printLog(&log, MSG_LOG);
439                 postBlockEnd();
440         }
441         return ret;
442 }
443
444
445 result Semaphore::Create(int count) {
446         typedef result 
447                 (Semaphore::*methodType)(int count);
448         static methodType Createp = 0;
449         result ret;
450         probeInfo_t probeInfo;
451         log_t log;
452         int blockresult;
453         bool bfiltering = true;
454         void *tmpPtr;
455
456         if (!Createp) {
457                 probeBlockStart();
458                 if(lib_handle[LIBOSP_APPFW] == NULL) {
459                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
460                         if (lib_handle[LIBOSP_APPFW] == NULL) {
461                                 perror("dlopen failed : libosp-appfw.so");
462                                 exit(0);
463                         }
464                 }
465                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateEi");
466
467                 if (tmpPtr == NULL || dlerror() != NULL) {
468                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
469                         exit(0);
470                 }
471
472                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
473
474                 probeBlockEnd();
475         }
476
477         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
478                 setProbePoint(&probeInfo);
479                 preBlockEnd();
480         }
481         //
482         ret = (this->*Createp)(count);
483         //
484         if (postBlockBegin(blockresult)) {
485                 log.type = 0;
486                 log.length = 0;
487                 log.data[0] = '\0';
488                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
489                                 probeInfo.eventIndex, "Semaphore::Create",
490                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
491                 //Input,ret
492                 log.length += sprintf(log.data + log.length, "`,%d`,%ld", count, ret);
493                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
494                 log.length += sprintf(log.data + log.length,
495                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
496                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_NEW);
497                 //callstack
498                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
499                 getBacktraceString(&log, 4096 - log.length - 17);
500                 log.length += sprintf(log.data + log.length, "`,callstack_end");
501
502                 printLog(&log, MSG_LOG);
503                 postBlockEnd();
504         }
505         return ret;
506 }
507
508 result Semaphore::Create(const Tizen::Base::String& name, int count) {
509         typedef result 
510                 (Semaphore::*methodType)(const Tizen::Base::String& name, int count);
511         static methodType Createp = 0;
512         result ret;
513         probeInfo_t probeInfo;
514         log_t log;
515         int blockresult;
516         bool bfiltering = true;
517         void *tmpPtr;
518         char temp[50];
519
520         if (!Createp) {
521                 probeBlockStart();
522                 if(lib_handle[LIBOSP_APPFW] == NULL) {
523                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
524                         if (lib_handle[LIBOSP_APPFW] == NULL) {
525                                 perror("dlopen failed : libosp-appfw.so");
526                                 exit(0);
527                         }
528                 }
529                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateERKNS0_6StringEi");
530
531                 if (tmpPtr == NULL || dlerror() != NULL) {
532                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
533                         exit(0);
534                 }
535
536                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
537
538                 probeBlockEnd();
539         }
540
541         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
542                 setProbePoint(&probeInfo);
543                 preBlockEnd();
544         }
545         //
546         ret = (this->*Createp)(name, count);
547         //
548         if (postBlockBegin(blockresult)) {
549                 log.type = 0;
550                 log.length = 0;
551                 log.data[0] = '\0';
552                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
553                                 probeInfo.eventIndex, "Semaphore::Create",
554                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
555                 //Input,ret
556                 WcharToChar(temp, name.GetPointer());
557                 log.length += sprintf(log.data + log.length, "`,%s,%d`,%ld", temp, count, ret);
558                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
559                 log.length += sprintf(log.data + log.length,
560                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
561                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_NEW);
562                 //callstack
563                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
564                 getBacktraceString(&log, 4096 - log.length - 17);
565                 log.length += sprintf(log.data + log.length, "`,callstack_end");
566
567                 printLog(&log, MSG_LOG);
568                 postBlockEnd();
569         }
570         return ret;
571
572 }
573
574 result Semaphore::Acquire(long timeout) {
575         typedef result
576                 (Semaphore::*methodType)(long timeout);
577         static methodType Acquirep = 0;
578         result ret;
579         probeInfo_t probeInfo;
580         log_t log;
581         int blockresult;
582         bool bfiltering = true;
583         void *tmpPtr;
584
585         if (!Acquirep) {
586                 probeBlockStart();
587                 if(lib_handle[LIBOSP_APPFW] == NULL) {
588                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
589                         if (lib_handle[LIBOSP_APPFW] == NULL) {
590                                 perror("dlopen failed : libosp-appfw.so");
591                                 exit(0);
592                         }
593                 }
594                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7AcquireEl");
595
596                 if (tmpPtr == NULL || dlerror() != NULL) {
597                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Acquire");
598                         exit(0);
599                 }
600
601                 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
602
603                 probeBlockEnd();
604         }
605
606         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
607                 setProbePoint(&probeInfo);
608                 log.type = 0;
609                 log.length = 0;
610                 log.data[0] = '\0';
611                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
612                                 probeInfo.eventIndex, "Semaphore::Acquire",
613                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
614                 //Input,ret
615                 log.length += sprintf(log.data + log.length, "`,%ld`,", timeout);
616                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
617                 log.length += sprintf(log.data + log.length,
618                                 "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
619                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_START);
620                 //callstack
621                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
622                 getBacktraceString(&log, 4096 - log.length - 17);
623                 log.length += sprintf(log.data + log.length, "`,callstack_end");
624
625                 printLog(&log, MSG_LOG);
626                 preBlockEnd();
627         }
628         //
629         ret = (this->*Acquirep)(timeout);
630         //
631         if (postBlockBegin(blockresult)) {
632                 setProbePoint(&probeInfo);
633                 log.type = 0;
634                 log.length = 0;
635                 log.data[0] = '\0';
636                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
637                                 probeInfo.eventIndex, "Semaphore::Acquire",
638                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
639                 //Input,ret
640                 log.length += sprintf(log.data + log.length, "`,%ld`,%ld", timeout, ret);
641                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
642                 log.length += sprintf(log.data + log.length,
643                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
644                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_END);
645                 //callstack
646                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
647                 getBacktraceString(&log, 4096 - log.length - 17);
648                 log.length += sprintf(log.data + log.length, "`,callstack_end");
649
650                 printLog(&log, MSG_LOG);
651                 postBlockEnd();
652         }
653         return ret;
654 }
655
656 result Semaphore::TryToAcquire(void) {
657         typedef result 
658                 (Semaphore::*methodType)(void);
659         static methodType TryToAcquirep = 0;
660         result ret;
661         probeInfo_t probeInfo;
662         log_t log;
663         int blockresult;
664         bool bfiltering = true;
665         void *tmpPtr;
666
667         if (!TryToAcquirep) {
668                 probeBlockStart();
669                 if(lib_handle[LIBOSP_APPFW] == NULL) {
670                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
671                         if (lib_handle[LIBOSP_APPFW] == NULL) {
672                                 perror("dlopen failed : libosp-appfw.so");
673                                 exit(0);
674                         }
675                 }
676                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore12TryToAcquireEv");
677
678                 if (tmpPtr == NULL || dlerror() != NULL) {
679                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::TryToAcquire");
680                         exit(0);
681                 }
682
683                 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
684
685                 probeBlockEnd();
686         }
687
688         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
689                 setProbePoint(&probeInfo);
690                 preBlockEnd();
691         }
692         //
693         ret = (this->*TryToAcquirep)();
694         //
695         if (postBlockBegin(blockresult)) {
696                 log.type = 0;
697                 log.length = 0;
698                 log.data[0] = '\0';
699                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
700                                 probeInfo.eventIndex, "Semaphore::TryToAcquire",
701                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
702                 //Input,ret
703                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
704                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
705                 log.length += sprintf(log.data + log.length,
706                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
707                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_TRY_ACQUIRE);
708                 //callstack
709                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
710                 getBacktraceString(&log, 4096 - log.length - 17);
711                 log.length += sprintf(log.data + log.length, "`,callstack_end");
712
713                 printLog(&log, MSG_LOG);
714                 postBlockEnd();
715         }
716         return ret;
717 }
718
719 result Semaphore::Release(void) {
720         typedef result 
721                 (Semaphore::*methodType)(void);
722         static methodType Releasep = 0;
723         result ret;
724         probeInfo_t probeInfo;
725         log_t log;
726         int blockresult;
727         bool bfiltering = true;
728         void *tmpPtr;
729
730         if (!Releasep) {
731                 probeBlockStart();
732                 if(lib_handle[LIBOSP_APPFW] == NULL) {
733                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
734                         if (lib_handle[LIBOSP_APPFW] == NULL) {
735                                 perror("dlopen failed : libosp-appfw.so");
736                                 exit(0);
737                         }
738                 }
739                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7ReleaseEv");
740
741                 if (tmpPtr == NULL || dlerror() != NULL) {
742                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Release");
743                         exit(0);
744                 }
745
746                 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
747
748                 probeBlockEnd();
749         }
750
751         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
752                 setProbePoint(&probeInfo);
753                 preBlockEnd();
754         }
755         //
756         ret = (this->*Releasep)();
757         //
758         if (postBlockBegin(blockresult)) {
759                 log.type = 0;
760                 log.length = 0;
761                 log.data[0] = '\0';
762                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
763                                 probeInfo.eventIndex, "Semaphore::Release",
764                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
765                 //Input,ret
766                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
767                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
768                 log.length += sprintf(log.data + log.length,
769                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
770                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_SEMAPHORE, SYNC_API_RELEASE);
771                 //callstack
772                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
773                 getBacktraceString(&log, 4096 - log.length - 17);
774                 log.length += sprintf(log.data + log.length, "`,callstack_end");
775
776                 printLog(&log, MSG_LOG);
777                 postBlockEnd();
778         }
779         return ret;
780 }
781
782
783 result Monitor::Construct(void) {
784         typedef result 
785                 (Monitor::*methodType)(void);
786         static methodType Constructp = 0;
787         result ret;
788         probeInfo_t probeInfo;
789         log_t log;
790         int blockresult;
791         bool bfiltering = true;
792         void *tmpPtr;
793
794         if (!Constructp) {
795                 probeBlockStart();
796                 if(lib_handle[LIBOSP_APPFW] == NULL) {
797                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
798                         if (lib_handle[LIBOSP_APPFW] == NULL) {
799                                 perror("dlopen failed : libosp-appfw.so");
800                                 exit(0);
801                         }
802                 }
803                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9ConstructEv");
804
805                 if (tmpPtr == NULL || dlerror() != NULL) {
806                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Construct");
807                         exit(0);
808                 }
809
810                 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
811                 probeBlockEnd();
812         }
813
814         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
815                 setProbePoint(&probeInfo);
816                 preBlockEnd();
817         }
818         //
819         ret = (this->*Constructp)();
820         //
821         if (postBlockBegin(blockresult)) {
822                 log.type = 0;
823                 log.length = 0;
824                 log.data[0] = '\0';
825                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
826                                 probeInfo.eventIndex, "Monitor::Construct",
827                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
828                 //Input,ret
829                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
830                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
831                 log.length += sprintf(log.data + log.length,
832                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
833                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NEW);
834                 //callstack
835                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
836                 getBacktraceString(&log, 4096 - log.length - 17);
837                 log.length += sprintf(log.data + log.length, "`,callstack_end");
838
839                 printLog(&log, MSG_LOG);
840                 postBlockEnd();
841         }
842         return ret;
843 }
844
845 result Monitor::Enter(void) {
846         typedef result
847                 (Monitor::*methodType)(void);
848         static methodType Enterp = 0;
849         result ret;
850         probeInfo_t probeInfo;
851         log_t log;
852         int blockresult;
853         bool bfiltering = true;
854         void *tmpPtr;
855
856         if (!Enterp) {
857                 probeBlockStart();
858                 if(lib_handle[LIBOSP_APPFW] == NULL) {
859                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
860                         if (lib_handle[LIBOSP_APPFW] == NULL) {
861                                 perror("dlopen failed : libosp-appfw.so");
862                                 exit(0);
863                         }
864                 }
865                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor5EnterEv");
866
867                 if (tmpPtr == NULL || dlerror() != NULL) {
868                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Enter");
869                         exit(0);
870                 }
871
872                 memcpy(&Enterp, &tmpPtr, sizeof(tmpPtr));
873
874                 probeBlockEnd();
875         }
876
877         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
878                 setProbePoint(&probeInfo);
879                 log.type = 0;
880                 log.length = 0;
881                 log.data[0] = '\0';
882                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
883                                 probeInfo.eventIndex, "Monitor::Enter",
884                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
885                 //Input,ret
886                 log.length += sprintf(log.data + log.length, "`,`,");
887                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
888                 log.length += sprintf(log.data + log.length,
889                                 "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
890                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_ACQUIRE_WAIT_START);
891                 //callstack
892                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
893                 getBacktraceString(&log, 4096 - log.length - 17);
894                 log.length += sprintf(log.data + log.length, "`,callstack_end");
895
896                 printLog(&log, MSG_LOG);
897                 preBlockEnd();
898         }
899         //
900         ret = (this->*Enterp)();
901         //
902         if (postBlockBegin(blockresult)) {
903                 setProbePoint(&probeInfo);
904                 log.type = 0;
905                 log.length = 0;
906                 log.data[0] = '\0';
907                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
908                                 probeInfo.eventIndex, "Monitor::Enter",
909                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
910                 //Input,ret
911                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
912                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
913                 log.length += sprintf(log.data + log.length,
914                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
915                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_ACQUIRE_WAIT_END);
916                 //callstack
917                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
918                 getBacktraceString(&log, 4096 - log.length - 17);
919                 log.length += sprintf(log.data + log.length, "`,callstack_end");
920
921                 printLog(&log, MSG_LOG);
922                 postBlockEnd();
923         }
924         return ret;
925 }
926
927 result Monitor::Exit(void) {
928         typedef result 
929                 (Monitor::*methodType)(void);
930         static methodType Exitp = 0;
931         result ret;
932         probeInfo_t probeInfo;
933         log_t log;
934         int blockresult;
935         bool bfiltering = true;
936         void *tmpPtr;
937
938         if (!Exitp) {
939                 probeBlockStart();
940                 if(lib_handle[LIBOSP_APPFW] == NULL) {
941                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
942                         if (lib_handle[LIBOSP_APPFW] == NULL) {
943                                 perror("dlopen failed : libosp-appfw.so");
944                                 exit(0);
945                         }
946                 }
947                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4ExitEv");
948
949                 if (tmpPtr == NULL || dlerror() != NULL) {
950                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Exit");
951                         exit(0);
952                 }
953
954                 memcpy(&Exitp, &tmpPtr, sizeof(tmpPtr));
955
956                 probeBlockEnd();
957         }
958
959         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
960                 setProbePoint(&probeInfo);
961                 preBlockEnd();
962         }
963         //
964         ret = (this->*Exitp)();
965         //
966         if (postBlockBegin(blockresult)) {
967                 log.type = 0;
968                 log.length = 0;
969                 log.data[0] = '\0';
970                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
971                                 probeInfo.eventIndex, "Monitor::Exit",
972                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
973                 //Input,ret
974                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
975                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
976                 log.length += sprintf(log.data + log.length,
977                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
978                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_RELEASE);
979                 //callstack
980                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
981                 getBacktraceString(&log, 4096 - log.length - 17);
982                 log.length += sprintf(log.data + log.length, "`,callstack_end");
983
984                 printLog(&log, MSG_LOG);
985                 postBlockEnd();
986         }
987         return ret;
988 }
989
990 result Monitor::Wait(void) {
991         typedef result
992                 (Monitor::*methodType)(void);
993         static methodType Waitp = 0;
994         result ret;
995         probeInfo_t probeInfo;
996         log_t log;
997         int blockresult;
998         bool bfiltering = true;
999         void *tmpPtr;
1000
1001         if (!Waitp) {
1002                 probeBlockStart();
1003                 if(lib_handle[LIBOSP_APPFW] == NULL) {
1004                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
1005                         if (lib_handle[LIBOSP_APPFW] == NULL) {
1006                                 perror("dlopen failed : libosp-appfw.so");
1007                                 exit(0);
1008                         }
1009                 }
1010                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4WaitEv");
1011
1012                 if (tmpPtr == NULL || dlerror() != NULL) {
1013                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Wait");
1014                         exit(0);
1015                 }
1016
1017                 memcpy(&Waitp, &tmpPtr, sizeof(tmpPtr));
1018
1019                 probeBlockEnd();
1020         }
1021
1022         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1023                 setProbePoint(&probeInfo);
1024                 log.type = 0;
1025                 log.length = 0;
1026                 log.data[0] = '\0';
1027                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
1028                                 probeInfo.eventIndex, "Monitor::Wait",
1029                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
1030                 //Input,ret
1031                 log.length += sprintf(log.data + log.length, "`,`,");
1032                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
1033                 log.length += sprintf(log.data + log.length,
1034                                 "`,0`,0`,%d`,%u`,0x%x`,%d`,%d",blockresult,
1035                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_COND_WAIT_START);
1036                 //callstack
1037                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
1038                 getBacktraceString(&log, 4096 - log.length - 17);
1039                 log.length += sprintf(log.data + log.length, "`,callstack_end");
1040
1041                 printLog(&log, MSG_LOG);
1042                 preBlockEnd();
1043         }
1044         //
1045         ret = (this->*Waitp)();
1046         //
1047         if (postBlockBegin(blockresult)) {
1048                 setProbePoint(&probeInfo);
1049                 log.type = 0;
1050                 log.length = 0;
1051                 log.data[0] = '\0';
1052                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
1053                                 probeInfo.eventIndex, "Monitor::Wait",
1054                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
1055                 //Input,ret
1056                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
1057                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
1058                 log.length += sprintf(log.data + log.length,
1059                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
1060                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_COND_WAIT_END);
1061                 //callstack
1062                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
1063                 getBacktraceString(&log, 4096 - log.length - 17);
1064                 log.length += sprintf(log.data + log.length, "`,callstack_end");
1065
1066                 printLog(&log, MSG_LOG);
1067                 postBlockEnd();
1068         }
1069         return ret;
1070 }
1071
1072 result Monitor::Notify(void) {
1073         typedef result 
1074                 (Monitor::*methodType)(void);
1075         static methodType Notifyp = 0;
1076         result ret;
1077         probeInfo_t probeInfo;
1078         log_t log;
1079         int blockresult;
1080         bool bfiltering = true;
1081         void *tmpPtr;
1082
1083         if (!Notifyp) {
1084                 probeBlockStart();
1085                 if(lib_handle[LIBOSP_APPFW] == NULL) {
1086                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
1087                         if (lib_handle[LIBOSP_APPFW] == NULL) {
1088                                 perror("dlopen failed : libosp-appfw.so");
1089                                 exit(0);
1090                         }
1091                 }
1092                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor6NotifyEv");
1093
1094                 if (tmpPtr == NULL || dlerror() != NULL) {
1095                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Notify");
1096                         exit(0);
1097                 }
1098
1099                 memcpy(&Notifyp, &tmpPtr, sizeof(tmpPtr));
1100
1101                 probeBlockEnd();
1102         }
1103
1104         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1105                 setProbePoint(&probeInfo);
1106                 preBlockEnd();
1107         }
1108         //
1109         ret = (this->*Notifyp)();
1110         //
1111         if (postBlockBegin(blockresult)) {
1112                 log.type = 0;
1113                 log.length = 0;
1114                 log.data[0] = '\0';
1115                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
1116                                 probeInfo.eventIndex, "Monitor::Notify",
1117                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
1118                 //Input,ret
1119                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
1120                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
1121                 log.length += sprintf(log.data + log.length,
1122                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
1123                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NOTIFY);
1124                 //callstack
1125                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
1126                 getBacktraceString(&log, 4096 - log.length - 17);
1127                 log.length += sprintf(log.data + log.length, "`,callstack_end");
1128
1129                 printLog(&log, MSG_LOG);
1130                 postBlockEnd();
1131         }
1132         return ret;
1133 }
1134
1135 result Monitor::NotifyAll(void) {
1136         typedef result 
1137                 (Monitor::*methodType)(void);
1138         static methodType NotifyAllp = 0;
1139         result ret;
1140         probeInfo_t probeInfo;
1141         log_t log;
1142         int blockresult;
1143         bool bfiltering = true;
1144         void *tmpPtr;
1145
1146         if (!NotifyAllp) {
1147                 probeBlockStart();
1148                 if(lib_handle[LIBOSP_APPFW] == NULL) {
1149                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
1150                         if (lib_handle[LIBOSP_APPFW] == NULL) {
1151                                 perror("dlopen failed : libosp-appfw.so");
1152                                 exit(0);
1153                         }
1154                 }
1155                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9NotifyAllEv");
1156
1157                 if (tmpPtr == NULL || dlerror() != NULL) {
1158                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::NotifyAll");
1159                         exit(0);
1160                 }
1161
1162                 memcpy(&NotifyAllp, &tmpPtr, sizeof(tmpPtr));
1163
1164                 probeBlockEnd();
1165         }
1166
1167         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1168                 setProbePoint(&probeInfo);
1169                 preBlockEnd();
1170         }
1171         //
1172         ret = (this->*NotifyAllp)();
1173         //
1174         if (postBlockBegin(blockresult)) {
1175                 log.type = 0;
1176                 log.length = 0;
1177                 log.data[0] = '\0';
1178                 log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", LC_SYNC,
1179                                 probeInfo.eventIndex, "Monitor::NotifyAll",
1180                                 probeInfo.currentTime, probeInfo.pID, probeInfo.tID);
1181                 //Input,ret
1182                 log.length += sprintf(log.data + log.length, "`,`,%ld", ret);
1183                 //PCAddr,errno,InternalCall,CallerPCAddr,SyncVal,SyncType,ApiType
1184                 log.length += sprintf(log.data + log.length,
1185                                 "`,0`,%lu`,%d`,%u`,0x%x`,%d`,%d", ret, blockresult,
1186                                 (unsigned int)CALLER_ADDRESS, (unsigned int) this, SYNC_OSP_MONITOR, SYNC_API_NOTIFY_ALL);
1187                 //callstack
1188                 log.length += sprintf(log.data + log.length, "`,\ncallstack_start`,");
1189                 getBacktraceString(&log, 4096 - log.length - 17);
1190                 log.length += sprintf(log.data + log.length, "`,callstack_end");
1191
1192                 printLog(&log, MSG_LOG);
1193                 postBlockEnd();
1194         }
1195         return ret;
1196 }
1197
1198 }
1199 }
1200 }