4 * Copyright 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Woojin Jung <woojin2.jung@samsung.com>
9 * Jaewon Lim <jaewon81.lim@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
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)
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.
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
31 #include <FBaseResult.h>
32 #include <FBaseString.h>
33 #include <FBaseRtTypes.h>
37 #include "probeinfo.h"
40 static enum DaOptions _sopt = OPT_THREAD;
49 result Create(const Tizen::Base::String& name);
52 result TryToAcquire(void);
55 // virtual ~Mutex(void);
58 // Mutex(const Mutex& value);
59 // Mutex& opereator =(const Mutex& value);
62 // friend class _MutexImpl;
63 // class _MutexImpl * __pMutexImpl;
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);
75 // virtual ~Semaphore(void);
78 // Semaphore(const Semaphore& rhs);
79 // Semaphore& operator =(const Semaphore& rhs);
82 // friend class _SemaphoreImpl;
83 // class _SemaphoreImpl * __pSemaphoreImpl;
88 result Construct(void);
93 result NotifyAll(void);
96 // virtual ~Monitor(void);
99 // Monitor(const Monitor& rhs);
100 // Monitor& operator =(const Monitor& rhs);
103 // friend class _MonitorImpl;
104 // class _MonitorImpl * __pMonitorImpl;
108 result Mutex::Create(void) {
110 (Mutex::*methodType)(void);
111 static methodType Createp = 0;
113 probeInfo_t probeInfo;
116 bool bfiltering = true;
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");
128 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateEv");
130 if (tmpPtr == NULL || dlerror() != NULL) {
131 perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
135 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
140 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
141 setProbePoint(&probeInfo);
145 ret = (this->*Createp)();
147 if (postBlockBegin(blockresult)) {
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);
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);
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");
165 printLog(&log, MSG_LOG);
171 result Mutex::Create(const Tizen::Base::String& name) {
173 (Mutex::*methodType)(const Tizen::Base::String& name);
174 static methodType Createp = 0;
176 probeInfo_t probeInfo;
179 bool bfiltering = true;
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");
192 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex6CreateERKNS0_6StringE");
194 if (tmpPtr == NULL || dlerror() != NULL) {
195 perror("dlsym failed : Tizen::Base::Runtime::Mutex::Create");
199 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
204 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
205 setProbePoint(&probeInfo);
209 ret = (this->*Createp)(name);
211 if (postBlockBegin(blockresult)) {
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);
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);
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");
230 printLog(&log, MSG_LOG);
236 result Mutex::Release(void) {
238 (Mutex::*methodType)(void);
239 static methodType Releasep = 0;
241 probeInfo_t probeInfo;
244 bool bfiltering = true;
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");
256 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7ReleaseEv");
258 if (tmpPtr == NULL || dlerror() != NULL) {
259 perror("dlsym failed : Tizen::Base::Runtime::Mutex::Release");
263 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
268 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
269 setProbePoint(&probeInfo);
273 ret = (this->*Releasep)();
275 if (postBlockBegin(blockresult)) {
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);
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);
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");
293 printLog(&log, MSG_LOG);
299 result Mutex::Acquire(void) {
301 (Mutex::*methodType)(void);
302 static methodType Acquirep = 0;
304 probeInfo_t probeInfo;
307 bool bfiltering = true;
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");
319 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex7AcquireEv");
321 if (tmpPtr == NULL || dlerror() != NULL) {
322 perror("dlsym failed : Tizen::Base::Runtime::Mutex::Acquire");
326 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
331 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
332 setProbePoint(&probeInfo);
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);
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);
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");
350 printLog(&log, MSG_LOG);
354 ret = (this->*Acquirep)();
356 if (postBlockBegin(blockresult)) {
357 setProbePoint(&probeInfo);
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);
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);
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");
375 printLog(&log, MSG_LOG);
381 result Mutex::TryToAcquire(void) {
383 (Mutex::*methodType)(void);
384 static methodType TryToAcquirep = 0;
386 probeInfo_t probeInfo;
389 bool bfiltering = true;
392 if (!TryToAcquirep) {
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");
401 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime5Mutex12TryToAcquireEv");
403 if (tmpPtr == NULL || dlerror() != NULL) {
404 perror("dlsym failed : Tizen::Base::Runtime::Mutex::TryToAcquire");
408 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
413 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
414 setProbePoint(&probeInfo);
418 ret = (this->*TryToAcquirep)();
420 if (postBlockBegin(blockresult)) {
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);
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);
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");
438 printLog(&log, MSG_LOG);
445 result Semaphore::Create(int count) {
447 (Semaphore::*methodType)(int count);
448 static methodType Createp = 0;
450 probeInfo_t probeInfo;
453 bool bfiltering = true;
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");
465 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateEi");
467 if (tmpPtr == NULL || dlerror() != NULL) {
468 perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
472 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
477 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
478 setProbePoint(&probeInfo);
482 ret = (this->*Createp)(count);
484 if (postBlockBegin(blockresult)) {
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);
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);
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");
502 printLog(&log, MSG_LOG);
508 result Semaphore::Create(const Tizen::Base::String& name, int count) {
510 (Semaphore::*methodType)(const Tizen::Base::String& name, int count);
511 static methodType Createp = 0;
513 probeInfo_t probeInfo;
516 bool bfiltering = true;
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");
529 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore6CreateERKNS0_6StringEi");
531 if (tmpPtr == NULL || dlerror() != NULL) {
532 perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Create");
536 memcpy(&Createp, &tmpPtr, sizeof(tmpPtr));
541 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
542 setProbePoint(&probeInfo);
546 ret = (this->*Createp)(name, count);
548 if (postBlockBegin(blockresult)) {
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);
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);
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");
567 printLog(&log, MSG_LOG);
574 result Semaphore::Acquire(long timeout) {
576 (Semaphore::*methodType)(long timeout);
577 static methodType Acquirep = 0;
579 probeInfo_t probeInfo;
582 bool bfiltering = true;
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");
594 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7AcquireEl");
596 if (tmpPtr == NULL || dlerror() != NULL) {
597 perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Acquire");
601 memcpy(&Acquirep, &tmpPtr, sizeof(tmpPtr));
606 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
607 setProbePoint(&probeInfo);
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);
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);
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");
625 printLog(&log, MSG_LOG);
629 ret = (this->*Acquirep)(timeout);
631 if (postBlockBegin(blockresult)) {
632 setProbePoint(&probeInfo);
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);
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);
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");
650 printLog(&log, MSG_LOG);
656 result Semaphore::TryToAcquire(void) {
658 (Semaphore::*methodType)(void);
659 static methodType TryToAcquirep = 0;
661 probeInfo_t probeInfo;
664 bool bfiltering = true;
667 if (!TryToAcquirep) {
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");
676 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore12TryToAcquireEv");
678 if (tmpPtr == NULL || dlerror() != NULL) {
679 perror("dlsym failed : Tizen::Base::Runtime::Semaphore::TryToAcquire");
683 memcpy(&TryToAcquirep, &tmpPtr, sizeof(tmpPtr));
688 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
689 setProbePoint(&probeInfo);
693 ret = (this->*TryToAcquirep)();
695 if (postBlockBegin(blockresult)) {
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);
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);
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");
713 printLog(&log, MSG_LOG);
719 result Semaphore::Release(void) {
721 (Semaphore::*methodType)(void);
722 static methodType Releasep = 0;
724 probeInfo_t probeInfo;
727 bool bfiltering = true;
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");
739 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime9Semaphore7ReleaseEv");
741 if (tmpPtr == NULL || dlerror() != NULL) {
742 perror("dlsym failed : Tizen::Base::Runtime::Semaphore::Release");
746 memcpy(&Releasep, &tmpPtr, sizeof(tmpPtr));
751 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
752 setProbePoint(&probeInfo);
756 ret = (this->*Releasep)();
758 if (postBlockBegin(blockresult)) {
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);
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);
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");
776 printLog(&log, MSG_LOG);
783 result Monitor::Construct(void) {
785 (Monitor::*methodType)(void);
786 static methodType Constructp = 0;
788 probeInfo_t probeInfo;
791 bool bfiltering = true;
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");
803 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9ConstructEv");
805 if (tmpPtr == NULL || dlerror() != NULL) {
806 perror("dlsym failed : Tizen::Base::Runtime::Monitor::Construct");
810 memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr));
814 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
815 setProbePoint(&probeInfo);
819 ret = (this->*Constructp)();
821 if (postBlockBegin(blockresult)) {
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);
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);
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");
839 printLog(&log, MSG_LOG);
845 result Monitor::Enter(void) {
847 (Monitor::*methodType)(void);
848 static methodType Enterp = 0;
850 probeInfo_t probeInfo;
853 bool bfiltering = true;
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");
865 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor5EnterEv");
867 if (tmpPtr == NULL || dlerror() != NULL) {
868 perror("dlsym failed : Tizen::Base::Runtime::Monitor::Enter");
872 memcpy(&Enterp, &tmpPtr, sizeof(tmpPtr));
877 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
878 setProbePoint(&probeInfo);
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);
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);
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");
896 printLog(&log, MSG_LOG);
900 ret = (this->*Enterp)();
902 if (postBlockBegin(blockresult)) {
903 setProbePoint(&probeInfo);
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);
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);
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");
921 printLog(&log, MSG_LOG);
927 result Monitor::Exit(void) {
929 (Monitor::*methodType)(void);
930 static methodType Exitp = 0;
932 probeInfo_t probeInfo;
935 bool bfiltering = true;
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");
947 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4ExitEv");
949 if (tmpPtr == NULL || dlerror() != NULL) {
950 perror("dlsym failed : Tizen::Base::Runtime::Monitor::Exit");
954 memcpy(&Exitp, &tmpPtr, sizeof(tmpPtr));
959 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
960 setProbePoint(&probeInfo);
964 ret = (this->*Exitp)();
966 if (postBlockBegin(blockresult)) {
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);
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);
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");
984 printLog(&log, MSG_LOG);
990 result Monitor::Wait(void) {
992 (Monitor::*methodType)(void);
993 static methodType Waitp = 0;
995 probeInfo_t probeInfo;
998 bool bfiltering = true;
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");
1010 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor4WaitEv");
1012 if (tmpPtr == NULL || dlerror() != NULL) {
1013 perror("dlsym failed : Tizen::Base::Runtime::Monitor::Wait");
1017 memcpy(&Waitp, &tmpPtr, sizeof(tmpPtr));
1022 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1023 setProbePoint(&probeInfo);
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);
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);
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");
1041 printLog(&log, MSG_LOG);
1045 ret = (this->*Waitp)();
1047 if (postBlockBegin(blockresult)) {
1048 setProbePoint(&probeInfo);
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);
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);
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");
1066 printLog(&log, MSG_LOG);
1072 result Monitor::Notify(void) {
1074 (Monitor::*methodType)(void);
1075 static methodType Notifyp = 0;
1077 probeInfo_t probeInfo;
1080 bool bfiltering = true;
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");
1092 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor6NotifyEv");
1094 if (tmpPtr == NULL || dlerror() != NULL) {
1095 perror("dlsym failed : Tizen::Base::Runtime::Monitor::Notify");
1099 memcpy(&Notifyp, &tmpPtr, sizeof(tmpPtr));
1104 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1105 setProbePoint(&probeInfo);
1109 ret = (this->*Notifyp)();
1111 if (postBlockBegin(blockresult)) {
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);
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);
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");
1129 printLog(&log, MSG_LOG);
1135 result Monitor::NotifyAll(void) {
1137 (Monitor::*methodType)(void);
1138 static methodType NotifyAllp = 0;
1140 probeInfo_t probeInfo;
1143 bool bfiltering = true;
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");
1155 tmpPtr = dlsym(lib_handle[LIBOSP_APPFW], "_ZN5Tizen4Base7Runtime7Monitor9NotifyAllEv");
1157 if (tmpPtr == NULL || dlerror() != NULL) {
1158 perror("dlsym failed : Tizen::Base::Runtime::Monitor::NotifyAll");
1162 memcpy(&NotifyAllp, &tmpPtr, sizeof(tmpPtr));
1167 if ((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) {
1168 setProbePoint(&probeInfo);
1172 ret = (this->*NotifyAllp)();
1174 if (postBlockBegin(blockresult)) {
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);
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);
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");
1192 printLog(&log, MSG_LOG);