a6cd9775c38f96b0c797ad1cb5f59f3476a7f0d6
[platform/core/system/swap-probe.git] / probe_tizenapi / tizen_sync.cpp
1 /*
2  *  DA probe
3  *
4  * Copyright 2000 - 2013 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  * Anastasia Lyupa <a.lyupa@samsung.com>
12  *
13  * This library is free software; you can redistribute it and/or modify it under
14  * the terms of the GNU Lesser General Public License as published by the
15  * Free Software Foundation; either version 2.1 of the License, or (at your option)
16  * any later version.
17  *
18  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21  * License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this library; if not, write to the Free Software Foundation, Inc., 51
25  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26  *
27  * Contributors:
28  * - S-Core Co., Ltd
29  * - Samsung RnD Institute Russia
30  *
31  */
32
33 #include <FBase.h>
34 #include <string.h>
35 #include "daprobe.h"
36 #include "probeinfo.h"
37 #include "dahelper.h"
38
39 #include "binproto.h"
40
41 static enum DaOptions _sopt = OPT_THREAD;
42
43 namespace Tizen {
44 namespace Base {
45 namespace Runtime {
46
47 result Mutex::Create(void) {
48         typedef result
49                 (Mutex::*methodType)(void);
50         static methodType Createp = 0;
51         result ret;
52         probeInfo_t probeInfo;
53         int blockresult;
54         bool bfiltering = true;
55         void *tmpPtr;
56
57         if (!Createp) {
58                 probeBlockStart();
59                 if(lib_handle[LIBOSP_APPFW] == NULL) {
60                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
61                         if (lib_handle[LIBOSP_APPFW] == NULL) {
62                                 perror("dlopen failed : libosp-appfw.so");
63                                 exit(0);
64                         }
65                 }
66                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateEv");
67
68                 if (tmpPtr == NULL || dlerror() != NULL) {
69                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
70                         exit(0);
71                 }
72
73                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
74
75                 probeBlockEnd();
76         }
77
78         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
79                 setProbePoint(&probeInfo);
80                 preBlockEnd();
81         }
82         //
83         ret = (this->*Createp)();
84         //
85         if (postBlockBegin(blockresult)) {
86
87                 PREPARE_LOCAL_BUF();
88                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
89                                   API_ID_result_Mutex__Create_void_,
90                                   "", 0);
91                 PACK_COMMON_END('x', ret, ret, blockresult);
92                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_NEW);
93                 FLUSH_LOCAL_BUF();
94
95                 postBlockEnd();
96         }
97         return ret;
98 }
99
100 result Mutex::Create(const Tizen::Base::String& name) {
101         typedef result
102                 (Mutex::*methodType)(const Tizen::Base::String& name);
103         static methodType Createp = 0;
104         result ret;
105         probeInfo_t probeInfo;
106         int blockresult;
107         bool bfiltering = true;
108         void *tmpPtr;
109         char temp[50];
110
111         if (!Createp) {
112                 probeBlockStart();
113                 if(lib_handle[LIBOSP_APPFW] == NULL) {
114                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
115                         if (lib_handle[LIBOSP_APPFW] == NULL) {
116                                 perror("dlopen failed : libosp-appfw.so");
117                                 exit(0);
118                         }
119                 }
120                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateERKNS0_6StringE");
121
122                 if (tmpPtr == NULL || dlerror() != NULL) {
123                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
124                         exit(0);
125                 }
126
127                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
128
129                 probeBlockEnd();
130         }
131
132         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
133                 setProbePoint(&probeInfo);
134                 preBlockEnd();
135         }
136         //
137         ret = (this->*Createp)(name);
138         //
139         if (postBlockBegin(blockresult)) {
140
141                 WcharToChar(temp, name.GetPointer());
142
143                 PREPARE_LOCAL_BUF();
144                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
145                                   API_ID_result_Mutex__Create_const_Tizen__Base__String__name_,
146                                   "s", temp);
147                 PACK_COMMON_END('x', ret, ret, blockresult);
148                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_NEW);
149                 FLUSH_LOCAL_BUF();
150
151                 postBlockEnd();
152         }
153         return ret;
154 }
155
156 result Mutex::Release(void) {
157         typedef result
158                 (Mutex::*methodType)(void);
159         static methodType Releasep = 0;
160         result ret;
161         probeInfo_t probeInfo;
162         int blockresult;
163         bool bfiltering = true;
164         void *tmpPtr;
165
166         if (!Releasep) {
167                 probeBlockStart();
168                 if(lib_handle[LIBOSP_APPFW] == NULL) {
169                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
170                         if (lib_handle[LIBOSP_APPFW] == NULL) {
171                                 perror("dlopen failed : libosp-appfw.so");
172                                 exit(0);
173                         }
174                 }
175                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7ReleaseEv");
176
177                 if (tmpPtr == NULL || dlerror() != NULL) {
178                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Release");
179                         exit(0);
180                 }
181
182                 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
183
184                 probeBlockEnd();
185         }
186
187         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
188                 setProbePoint(&probeInfo);
189                 preBlockEnd();
190         }
191         //
192         ret = (this->*Releasep)();
193         //
194         if (postBlockBegin(blockresult)) {
195
196                 PREPARE_LOCAL_BUF();
197                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
198                                   API_ID_result_Mutex__Release_void_,
199                                   "", 0);
200                 PACK_COMMON_END('x', ret, ret, blockresult);
201                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_RELEASE);
202                 FLUSH_LOCAL_BUF();
203
204                 postBlockEnd();
205         }
206         return ret;
207 }
208
209 result Mutex::Acquire(void) {
210         typedef result
211                 (Mutex::*methodType)(void);
212         static methodType Acquirep = 0;
213         result ret;
214         probeInfo_t probeInfo;
215         int blockresult;
216         bool bfiltering = true;
217         void *tmpPtr;
218
219         if (!Acquirep) {
220                 probeBlockStart();
221                 if(lib_handle[LIBOSP_APPFW] == NULL) {
222                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
223                         if (lib_handle[LIBOSP_APPFW] == NULL) {
224                                 perror("dlopen failed : libosp-appfw.so");
225                                 exit(0);
226                         }
227                 }
228                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7AcquireEv");
229
230                 if (tmpPtr == NULL || dlerror() != NULL) {
231                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::Acquire");
232                         exit(0);
233                 }
234
235                 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
236
237                 probeBlockEnd();
238         }
239
240         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
241                 setProbePoint(&probeInfo);
242
243                 PREPARE_LOCAL_BUF();
244                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
245                                   API_ID_result_Mutex__Acquire_void_,
246                                   "", 0);
247                 PACK_COMMON_END('x', 0, 0, blockresult);
248                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_ACQUIRE_WAIT_START);
249                 FLUSH_LOCAL_BUF();
250
251                 preBlockEnd();
252         }
253         //
254         ret = (this->*Acquirep)();
255         //
256         if (postBlockBegin(blockresult)) {
257                 setProbePoint(&probeInfo);
258
259                 PREPARE_LOCAL_BUF();
260                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
261                                   API_ID_result_Mutex__Acquire_void_,
262                                   "", 0);
263                 PACK_COMMON_END('x', ret, ret, blockresult);
264                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_ACQUIRE_WAIT_END);
265                 FLUSH_LOCAL_BUF();
266
267                 postBlockEnd();
268         }
269         return ret;
270 }
271
272 result Mutex::TryToAcquire(void) {
273         typedef result
274                 (Mutex::*methodType)(void);
275         static methodType TryToAcquirep = 0;
276         result ret;
277         probeInfo_t probeInfo;
278         int blockresult;
279         bool bfiltering = true;
280         void *tmpPtr;
281
282         if (!TryToAcquirep) {
283                 probeBlockStart();
284                 if(lib_handle[LIBOSP_APPFW] == NULL) {
285                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
286                         if (lib_handle[LIBOSP_APPFW] == NULL) {
287                                 perror("dlopen failed : libosp-appfw.so");
288                                 exit(0);
289                         }
290                 }
291                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex12TryToAcquireEv");
292
293                 if (tmpPtr == NULL || dlerror() != NULL) {
294                         perror("dlsym failed : Tizen::Base::Runtime::Mutex::TryToAcquire");
295                         exit(0);
296                 }
297
298                 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
299
300                 probeBlockEnd();
301         }
302
303         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
304                 setProbePoint(&probeInfo);
305                 preBlockEnd();
306         }
307         //
308         ret = (this->*TryToAcquirep)();
309         //
310         if (postBlockBegin(blockresult)) {
311
312                 PREPARE_LOCAL_BUF();
313                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
314                                   API_ID_result_Mutex__TryToAcquire_void_,
315                                   "", 0);
316                 PACK_COMMON_END('x', ret, ret, blockresult);
317                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MUTEX, SYNC_API_TRY_ACQUIRE);
318                 FLUSH_LOCAL_BUF();
319
320                 postBlockEnd();
321         }
322         return ret;
323 }
324
325
326 result Semaphore::Create(int count) {
327         typedef result
328                 (Semaphore::*methodType)(int count);
329         static methodType Createp = 0;
330         result ret;
331         probeInfo_t probeInfo;
332         int blockresult;
333         bool bfiltering = true;
334         void *tmpPtr;
335
336         if (!Createp) {
337                 probeBlockStart();
338                 if(lib_handle[LIBOSP_APPFW] == NULL) {
339                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
340                         if (lib_handle[LIBOSP_APPFW] == NULL) {
341                                 perror("dlopen failed : libosp-appfw.so");
342                                 exit(0);
343                         }
344                 }
345                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateEi");
346
347                 if (tmpPtr == NULL || dlerror() != NULL) {
348                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
349                         exit(0);
350                 }
351
352                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
353
354                 probeBlockEnd();
355         }
356
357         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
358                 setProbePoint(&probeInfo);
359                 preBlockEnd();
360         }
361         //
362         ret = (this->*Createp)(count);
363         //
364         if (postBlockBegin(blockresult)) {
365
366                 PREPARE_LOCAL_BUF();
367                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
368                                   API_ID_result_Semaphore__Create_int_count_,
369                                   "d", count);
370                 PACK_COMMON_END('x', ret, ret, blockresult);
371                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_NEW);
372                 FLUSH_LOCAL_BUF();
373
374                 postBlockEnd();
375         }
376         return ret;
377 }
378
379 result Semaphore::Create(const Tizen::Base::String& name, int count) {
380         typedef result
381                 (Semaphore::*methodType)(const Tizen::Base::String& name, int count);
382         static methodType Createp = 0;
383         result ret;
384         probeInfo_t probeInfo;
385         int blockresult;
386         bool bfiltering = true;
387         void *tmpPtr;
388         char temp[50];
389
390         if (!Createp) {
391                 probeBlockStart();
392                 if(lib_handle[LIBOSP_APPFW] == NULL) {
393                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
394                         if (lib_handle[LIBOSP_APPFW] == NULL) {
395                                 perror("dlopen failed : libosp-appfw.so");
396                                 exit(0);
397                         }
398                 }
399                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateERKNS0_6StringEi");
400
401                 if (tmpPtr == NULL || dlerror() != NULL) {
402                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
403                         exit(0);
404                 }
405
406                 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
407
408                 probeBlockEnd();
409         }
410
411         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
412                 setProbePoint(&probeInfo);
413                 preBlockEnd();
414         }
415         //
416         ret = (this->*Createp)(name, count);
417         //
418         if (postBlockBegin(blockresult)) {
419
420                 WcharToChar(temp, name.GetPointer());
421
422                 PREPARE_LOCAL_BUF();
423                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
424                                   API_ID_result_Semaphore__Create_const_Tizen__Base__String__name__int_count_,
425                                   "sd", temp, count);
426                 PACK_COMMON_END('x', ret, ret, blockresult);
427                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_NEW);
428                 FLUSH_LOCAL_BUF();
429
430                 postBlockEnd();
431         }
432         return ret;
433
434 }
435
436 result Semaphore::Acquire(long timeout) {
437         typedef result
438                 (Semaphore::*methodType)(long timeout);
439         static methodType Acquirep = 0;
440         result ret;
441         probeInfo_t probeInfo;
442         int blockresult;
443         bool bfiltering = true;
444         void *tmpPtr;
445
446         if (!Acquirep) {
447                 probeBlockStart();
448                 if(lib_handle[LIBOSP_APPFW] == NULL) {
449                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
450                         if (lib_handle[LIBOSP_APPFW] == NULL) {
451                                 perror("dlopen failed : libosp-appfw.so");
452                                 exit(0);
453                         }
454                 }
455                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7AcquireEl");
456
457                 if (tmpPtr == NULL || dlerror() != NULL) {
458                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Acquire");
459                         exit(0);
460                 }
461
462                 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
463
464                 probeBlockEnd();
465         }
466
467         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
468                 setProbePoint(&probeInfo);
469
470                 PREPARE_LOCAL_BUF();
471                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
472                                   API_ID_result_Semaphore__Acquire_long_timeout_,
473                                   "x", (uint64_t)(timeout));
474                 PACK_COMMON_END('x', 0, 0, blockresult);
475                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_START);
476                 FLUSH_LOCAL_BUF();
477
478                 preBlockEnd();
479         }
480         //
481         ret = (this->*Acquirep)(timeout);
482         //
483         if (postBlockBegin(blockresult)) {
484                 setProbePoint(&probeInfo);
485
486                 PREPARE_LOCAL_BUF();
487                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
488                                   API_ID_result_Semaphore__Acquire_long_timeout_,
489                                   "x", (uint64_t)(timeout));
490                 PACK_COMMON_END('x', ret, ret, blockresult);
491                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_ACQUIRE_WAIT_END);
492                 FLUSH_LOCAL_BUF();
493
494                 postBlockEnd();
495         }
496         return ret;
497 }
498
499 result Semaphore::TryToAcquire(void) {
500         typedef result
501                 (Semaphore::*methodType)(void);
502         static methodType TryToAcquirep = 0;
503         result ret;
504         probeInfo_t probeInfo;
505         int blockresult;
506         bool bfiltering = true;
507         void *tmpPtr;
508
509         if (!TryToAcquirep) {
510                 probeBlockStart();
511                 if(lib_handle[LIBOSP_APPFW] == NULL) {
512                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
513                         if (lib_handle[LIBOSP_APPFW] == NULL) {
514                                 perror("dlopen failed : libosp-appfw.so");
515                                 exit(0);
516                         }
517                 }
518                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore12TryToAcquireEv");
519
520                 if (tmpPtr == NULL || dlerror() != NULL) {
521                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::TryToAcquire");
522                         exit(0);
523                 }
524
525                 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
526
527                 probeBlockEnd();
528         }
529
530         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
531                 setProbePoint(&probeInfo);
532                 preBlockEnd();
533         }
534         //
535         ret = (this->*TryToAcquirep)();
536         //
537         if (postBlockBegin(blockresult)) {
538
539                 PREPARE_LOCAL_BUF();
540                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
541                                   API_ID_result_Semaphore__TryToAcquire_void_,
542                                   "", 0);
543                 PACK_COMMON_END('x', ret, ret, blockresult);
544                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_TRY_ACQUIRE);
545                 FLUSH_LOCAL_BUF();
546
547                 postBlockEnd();
548         }
549         return ret;
550 }
551
552 result Semaphore::Release(void) {
553         typedef result
554                 (Semaphore::*methodType)(void);
555         static methodType Releasep = 0;
556         result ret;
557         probeInfo_t probeInfo;
558         int blockresult;
559         bool bfiltering = true;
560         void *tmpPtr;
561
562         if (!Releasep) {
563                 probeBlockStart();
564                 if(lib_handle[LIBOSP_APPFW] == NULL) {
565                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
566                         if (lib_handle[LIBOSP_APPFW] == NULL) {
567                                 perror("dlopen failed : libosp-appfw.so");
568                                 exit(0);
569                         }
570                 }
571                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7ReleaseEv");
572
573                 if (tmpPtr == NULL || dlerror() != NULL) {
574                         perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Release");
575                         exit(0);
576                 }
577
578                 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
579
580                 probeBlockEnd();
581         }
582
583         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
584                 setProbePoint(&probeInfo);
585                 preBlockEnd();
586         }
587         //
588         ret = (this->*Releasep)();
589         //
590         if (postBlockBegin(blockresult)) {
591
592                 PREPARE_LOCAL_BUF();
593                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
594                                   API_ID_result_Semaphore__Release_void_,
595                                   "", 0);
596                 PACK_COMMON_END('x', ret, ret, blockresult);
597                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_SEMAPHORE, SYNC_API_RELEASE);
598                 FLUSH_LOCAL_BUF();
599
600                 postBlockEnd();
601         }
602         return ret;
603 }
604
605
606 result Monitor::Construct(void) {
607         typedef result
608                 (Monitor::*methodType)(void);
609         static methodType Constructp = 0;
610         result ret;
611         probeInfo_t probeInfo;
612         int blockresult;
613         bool bfiltering = true;
614         void *tmpPtr;
615
616         if (!Constructp) {
617                 probeBlockStart();
618                 if(lib_handle[LIBOSP_APPFW] == NULL) {
619                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
620                         if (lib_handle[LIBOSP_APPFW] == NULL) {
621                                 perror("dlopen failed : libosp-appfw.so");
622                                 exit(0);
623                         }
624                 }
625                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9ConstructEv");
626
627                 if (tmpPtr == NULL || dlerror() != NULL) {
628                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Construct");
629                         exit(0);
630                 }
631
632                 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
633                 probeBlockEnd();
634         }
635
636         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
637                 setProbePoint(&probeInfo);
638                 preBlockEnd();
639         }
640         //
641         ret = (this->*Constructp)();
642         //
643         if (postBlockBegin(blockresult)) {
644
645                 PREPARE_LOCAL_BUF();
646                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
647                                   API_ID_result_Monitor__Construct_void_,
648                                   "", 0);
649                 PACK_COMMON_END('x', ret, ret, blockresult);
650                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_NEW);
651                 FLUSH_LOCAL_BUF();
652
653                 postBlockEnd();
654         }
655         return ret;
656 }
657
658 result Monitor::Enter(void) {
659         typedef result
660                 (Monitor::*methodType)(void);
661         static methodType Enterp = 0;
662         result ret;
663         probeInfo_t probeInfo;
664         int blockresult;
665         bool bfiltering = true;
666         void *tmpPtr;
667
668         if (!Enterp) {
669                 probeBlockStart();
670                 if(lib_handle[LIBOSP_APPFW] == NULL) {
671                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
672                         if (lib_handle[LIBOSP_APPFW] == NULL) {
673                                 perror("dlopen failed : libosp-appfw.so");
674                                 exit(0);
675                         }
676                 }
677                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor5EnterEv");
678
679                 if (tmpPtr == NULL || dlerror() != NULL) {
680                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Enter");
681                         exit(0);
682                 }
683
684                 memcpy(&Enterp, &tmpPtr, sizeof(tmpPtr));
685
686                 probeBlockEnd();
687         }
688
689         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
690                 setProbePoint(&probeInfo);
691
692                 PREPARE_LOCAL_BUF();
693                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
694                                   API_ID_result_Monitor__Enter_void_,
695                                   "", 0);
696                 PACK_COMMON_END('x', 0, 0, blockresult);
697                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_ACQUIRE_WAIT_START);
698                 FLUSH_LOCAL_BUF();
699
700                 preBlockEnd();
701         }
702         //
703         ret = (this->*Enterp)();
704         //
705         if (postBlockBegin(blockresult)) {
706                 setProbePoint(&probeInfo);
707
708                 PREPARE_LOCAL_BUF();
709                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
710                                   API_ID_result_Monitor__Enter_void_,
711                                   "", 0);
712                 PACK_COMMON_END('x', ret, ret, blockresult);
713                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_ACQUIRE_WAIT_END);
714                 FLUSH_LOCAL_BUF();
715
716                 postBlockEnd();
717         }
718         return ret;
719 }
720
721 result Monitor::Exit(void) {
722         typedef result
723                 (Monitor::*methodType)(void);
724         static methodType Exitp = 0;
725         result ret;
726         probeInfo_t probeInfo;
727         int blockresult;
728         bool bfiltering = true;
729         void *tmpPtr;
730
731         if (!Exitp) {
732                 probeBlockStart();
733                 if(lib_handle[LIBOSP_APPFW] == NULL) {
734                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
735                         if (lib_handle[LIBOSP_APPFW] == NULL) {
736                                 perror("dlopen failed : libosp-appfw.so");
737                                 exit(0);
738                         }
739                 }
740                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4ExitEv");
741
742                 if (tmpPtr == NULL || dlerror() != NULL) {
743                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Exit");
744                         exit(0);
745                 }
746
747                 memcpy(&Exitp, &tmpPtr, sizeof(tmpPtr));
748
749                 probeBlockEnd();
750         }
751
752         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
753                 setProbePoint(&probeInfo);
754                 preBlockEnd();
755         }
756         //
757         ret = (this->*Exitp)();
758         //
759         if (postBlockBegin(blockresult)) {
760
761                 PREPARE_LOCAL_BUF();
762                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
763                                    API_ID_result_Monitor__Exit_void_,
764                                   "", 0);
765                 PACK_COMMON_END('x', ret, ret, blockresult);
766                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_RELEASE);
767                 FLUSH_LOCAL_BUF();
768
769                 postBlockEnd();
770         }
771         return ret;
772 }
773
774 result Monitor::Wait(void) {
775         typedef result
776                 (Monitor::*methodType)(void);
777         static methodType Waitp = 0;
778         result ret;
779         probeInfo_t probeInfo;
780         int blockresult;
781         bool bfiltering = true;
782         void *tmpPtr;
783
784         if (!Waitp) {
785                 probeBlockStart();
786                 if(lib_handle[LIBOSP_APPFW] == NULL) {
787                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
788                         if (lib_handle[LIBOSP_APPFW] == NULL) {
789                                 perror("dlopen failed : libosp-appfw.so");
790                                 exit(0);
791                         }
792                 }
793                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4WaitEv");
794
795                 if (tmpPtr == NULL || dlerror() != NULL) {
796                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Wait");
797                         exit(0);
798                 }
799
800                 memcpy(&Waitp, &tmpPtr, sizeof(tmpPtr));
801
802                 probeBlockEnd();
803         }
804
805         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
806                 setProbePoint(&probeInfo);
807
808                 PREPARE_LOCAL_BUF();
809                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
810                                   API_ID_result_Monitor__Wait_void_,
811                                   "", 0);
812                 PACK_COMMON_END('x', 0, 0, blockresult);
813                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_COND_WAIT_START);
814                 FLUSH_LOCAL_BUF();
815
816                 preBlockEnd();
817         }
818         //
819         ret = (this->*Waitp)();
820         //
821         if (postBlockBegin(blockresult)) {
822                 setProbePoint(&probeInfo);
823
824                 PREPARE_LOCAL_BUF();
825                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
826                                   API_ID_result_Monitor__Wait_void_,
827                                   "", 0);
828                 PACK_COMMON_END('x', ret, ret, blockresult);
829                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_COND_WAIT_END);
830                 FLUSH_LOCAL_BUF();
831
832                 postBlockEnd();
833         }
834         return ret;
835 }
836
837 result Monitor::Notify(void) {
838         typedef result
839                 (Monitor::*methodType)(void);
840         static methodType Notifyp = 0;
841         result ret;
842         probeInfo_t probeInfo;
843         int blockresult;
844         bool bfiltering = true;
845         void *tmpPtr;
846
847         if (!Notifyp) {
848                 probeBlockStart();
849                 if(lib_handle[LIBOSP_APPFW] == NULL) {
850                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
851                         if (lib_handle[LIBOSP_APPFW] == NULL) {
852                                 perror("dlopen failed : libosp-appfw.so");
853                                 exit(0);
854                         }
855                 }
856                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor6NotifyEv");
857
858                 if (tmpPtr == NULL || dlerror() != NULL) {
859                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::Notify");
860                         exit(0);
861                 }
862
863                 memcpy(&Notifyp, &tmpPtr, sizeof(tmpPtr));
864
865                 probeBlockEnd();
866         }
867
868         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
869                 setProbePoint(&probeInfo);
870                 preBlockEnd();
871         }
872         //
873         ret = (this->*Notifyp)();
874         //
875         if (postBlockBegin(blockresult)) {
876
877                 PREPARE_LOCAL_BUF();
878                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
879                                   API_ID_result_Monitor__Notify_void_,
880                                   "", 0);
881                 PACK_COMMON_END('x', ret, ret, blockresult);
882                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_NOTIFY);
883                 FLUSH_LOCAL_BUF();
884
885                 postBlockEnd();
886         }
887         return ret;
888 }
889
890 result Monitor::NotifyAll(void) {
891         typedef result
892                 (Monitor::*methodType)(void);
893         static methodType NotifyAllp = 0;
894         result ret;
895         probeInfo_t probeInfo;
896         int blockresult;
897         bool bfiltering = true;
898         void *tmpPtr;
899
900         if (!NotifyAllp) {
901                 probeBlockStart();
902                 if(lib_handle[LIBOSP_APPFW] == NULL) {
903                         lib_handle[LIBOSP_APPFW] = dlopen(lib_string[LIBOSP_APPFW], RTLD_LAZY);
904                         if (lib_handle[LIBOSP_APPFW] == NULL) {
905                                 perror("dlopen failed : libosp-appfw.so");
906                                 exit(0);
907                         }
908                 }
909                 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9NotifyAllEv");
910
911                 if (tmpPtr == NULL || dlerror() != NULL) {
912                         perror("dlsym failed : Tizen::Base::Runtime::Monitor::NotifyAll");
913                         exit(0);
914                 }
915
916                 memcpy(&NotifyAllp, &tmpPtr, sizeof(tmpPtr));
917
918                 probeBlockEnd();
919         }
920
921         if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
922                 setProbePoint(&probeInfo);
923                 preBlockEnd();
924         }
925         //
926         ret = (this->*NotifyAllp)();
927         //
928         if (postBlockBegin(blockresult)) {
929
930                 PREPARE_LOCAL_BUF();
931                 PACK_COMMON_BEGIN(MSG_PROBE_SYNC,
932                                   API_ID_result_Monitor__NotifyAll_void_,
933                                   "", 0);
934                 PACK_COMMON_END('x', ret, ret, blockresult);
935                 PACK_SYNC((unsigned int) this, SYNC_TIZEN_MONITOR, SYNC_API_NOTIFY_ALL);
936                 FLUSH_LOCAL_BUF();
937
938                 postBlockEnd();
939         }
940         return ret;
941 }
942
943 }
944 }
945 }