From 67d227a0521b1fc3e87f6b432dbf80393160d48c Mon Sep 17 00:00:00 2001 From: Kihyuck Shin Date: Fri, 10 Mar 2017 14:16:13 +0900 Subject: [PATCH] Add following wrapper macros for convenience. - OIC_TRACE_MARK, OIC_TRACE_BUFFER Add and modify trace point positions for clarification. Change-Id: I3996b38d71d3a2cfe4abff2353f8aef66e6ceb8a Signed-off-by: Kihyuck Shin Reviewed-on: https://gerrit.iotivity.org/gerrit/17821 Tested-by: jenkins-iotivity Reviewed-by: jihwan seo Reviewed-by: Phil Coval Reviewed-by: Ashok Babu Channa --- build_common/SConscript | 1 + build_common/tizen/SConscript | 5 +- .../build/tizen/packaging/com.oic.ca.spec | 4 ++ .../csdk/connectivity/build/tizen/scons/SConscript | 4 +- resource/csdk/connectivity/src/camessagehandler.c | 19 ++++--- resource/csdk/logger/SConscript | 2 + resource/csdk/logger/include/trace.h | 36 +++++++++++- resource/csdk/logger/src/trace.c | 64 +++++++++++++++------- .../stack/samples/tizen/build/scons/SConscript | 5 +- resource/csdk/stack/src/occlientcb.c | 14 +++++ resource/csdk/stack/src/ocstack.c | 11 ++++ tools/tizen/iotivity.spec | 9 +++ 12 files changed, 139 insertions(+), 35 deletions(-) mode change 100644 => 100755 build_common/SConscript mode change 100644 => 100755 build_common/tizen/SConscript mode change 100644 => 100755 resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec mode change 100644 => 100755 resource/csdk/connectivity/build/tizen/scons/SConscript mode change 100644 => 100755 resource/csdk/connectivity/src/camessagehandler.c mode change 100644 => 100755 resource/csdk/logger/SConscript mode change 100644 => 100755 resource/csdk/stack/samples/tizen/build/scons/SConscript mode change 100644 => 100755 resource/csdk/stack/src/occlientcb.c mode change 100644 => 100755 resource/csdk/stack/src/ocstack.c mode change 100644 => 100755 tools/tizen/iotivity.spec diff --git a/build_common/SConscript b/build_common/SConscript old mode 100644 new mode 100755 index d204f8f..537809c --- a/build_common/SConscript +++ b/build_common/SConscript @@ -138,6 +138,7 @@ if target_os == 'windows': help_vars.Add(BoolVariable('BUILD_JAVA', 'Build Java bindings', False)) help_vars.Add(PathVariable('JAVA_HOME', 'JDK directory', os.environ.get('JAVA_HOME'), PathVariable.PathAccept)) +help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False'))) AddOption('--prefix', dest='prefix', diff --git a/build_common/tizen/SConscript b/build_common/tizen/SConscript old mode 100644 new mode 100755 index c3c4feb..aa2c212 --- a/build_common/tizen/SConscript +++ b/build_common/tizen/SConscript @@ -23,6 +23,7 @@ env.AppendUnique(CCFLAGS = ['-Wextra', '-fPIC']) env.AppendUnique(LIBS = ['dl', 'pthread']) env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE']) -env.ParseConfig("pkg-config dlog ttrace --cflags --libs") - +env.ParseConfig("pkg-config dlog --cflags --libs") +if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': + env.ParseConfig("pkg-config ttrace --cflags --libs") # Set arch flags : It will be handled by Tizen build system. diff --git a/resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec b/resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec old mode 100644 new mode 100755 index cf51131..a189ccc --- a/resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec +++ b/resource/csdk/connectivity/build/tizen/packaging/com.oic.ca.spec @@ -28,9 +28,12 @@ Source0: http://mirrors.kernel.org/%{name}/%{version}/%{name}-%{version}.tar.gz %{!?TARGET_TRANSPORT: %define TARGET_TRANSPORT IP} %{!?VERBOSE: %define VERBOSE 1} %{!?WITH_TCP: %define WITH_TCP 0} +%{!?OIC_SUPPORT_TIZEN_TRACE: %define OIC_SUPPORT_TIZEN_TRACE False} BuildRequires: pkgconfig(dlog) +%if "%{OIC_SUPPORT_TIZEN_TRACE}" == "True" BuildRequires: pkgconfig(ttrace) +%endif BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(capi-network-bluetooth) @@ -57,6 +60,7 @@ scons %{JOB} \ TARGET_TRANSPORT=%{TARGET_TRANSPORT} \ VERBOSE=%{VERBOSE} \ WITH_TCP=%{WITH_TCP} \ + OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \ #eol diff --git a/resource/csdk/connectivity/build/tizen/scons/SConscript b/resource/csdk/connectivity/build/tizen/scons/SConscript old mode 100644 new mode 100755 index 19ee696..49c3b61 --- a/resource/csdk/connectivity/build/tizen/scons/SConscript +++ b/resource/csdk/connectivity/build/tizen/scons/SConscript @@ -20,7 +20,9 @@ else: if env.get('LOGGING'): env.AppendUnique(CPPDEFINES = ['TB_LOG']) -env.ParseConfig("pkg-config --cflags --libs capi-network-connection dlog ttrace glib-2.0") +env.ParseConfig("pkg-config --cflags --libs capi-network-connection dlog glib-2.0") +if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': + env.ParseConfig("pkg-config --cflags --libs ttrace") if 'ALL' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER','EDR_ADAPTER','LE_ADAPTER']) print "CA Transport is ALL" diff --git a/resource/csdk/connectivity/src/camessagehandler.c b/resource/csdk/connectivity/src/camessagehandler.c old mode 100644 new mode 100755 index 32b57e0..daef640 --- a/resource/csdk/connectivity/src/camessagehandler.c +++ b/resource/csdk/connectivity/src/camessagehandler.c @@ -417,7 +417,9 @@ static void CAReceiveThreadProcess(void *threadData) { #ifndef SINGLE_HANDLE CAData_t *data = (CAData_t *) threadData; + OIC_TRACE_BEGIN(%s:CAProcessReceivedData, TAG); CAProcessReceivedData(data); + OIC_TRACE_END(); #else (void)threadData; #endif @@ -503,8 +505,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) VERIFY_NON_NULL(data, TAG, "data"); VERIFY_NON_NULL(data->remoteEndpoint, TAG, "remoteEndpoint"); - OIC_TRACE_BEGIN(%s:CAProcessSendData, TAG); - CAResult_t res = CA_STATUS_FAILED; CASendDataType_t type = data->type; @@ -551,7 +551,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) else { OIC_LOG(DEBUG, TAG, "request info, response info is empty"); - OIC_TRACE_END(); return CA_STATUS_INVALID_PARAM; } @@ -573,7 +572,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) CAErrorHandler(data->remoteEndpoint, pdu->transport_hdr, pdu->length, res); coap_delete_list(options); coap_delete_pdu(pdu); - OIC_TRACE_END(); return res; } } @@ -589,7 +587,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) CAErrorHandler(data->remoteEndpoint, pdu->transport_hdr, pdu->length, res); coap_delete_list(options); coap_delete_pdu(pdu); - OIC_TRACE_END(); return res; } @@ -615,7 +612,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) OIC_LOG_V(INFO, TAG, "retransmission is not enabled due to error, res : %d", res); coap_delete_list(options); coap_delete_pdu(pdu); - OIC_TRACE_END(); return res; } } @@ -627,7 +623,6 @@ static CAResult_t CAProcessSendData(const CAData_t *data) { OIC_LOG(ERROR,TAG,"Failed to generate unicast PDU"); CASendErrorInfo(data->remoteEndpoint, info, CA_SEND_FAILED); - OIC_TRACE_END(); return CA_SEND_FAILED; } } @@ -665,7 +660,7 @@ static CAResult_t CAProcessSendData(const CAData_t *data) CAProcessMulticastData(data); #endif } - OIC_TRACE_END(); + return CA_STATUS_OK; } @@ -673,7 +668,9 @@ static CAResult_t CAProcessSendData(const CAData_t *data) static void CASendThreadProcess(void *threadData) { CAData_t *data = (CAData_t *) threadData; + OIC_TRACE_BEGIN(%s:CAProcessSendData, TAG); CAProcessSendData(data); + OIC_TRACE_END(); } #endif @@ -744,7 +741,6 @@ static void CAReceivedPacketCallback(const CASecureEndpoint_t *sep, { VERIFY_NON_NULL_VOID(sep, TAG, "remoteEndpoint"); VERIFY_NON_NULL_VOID(data, TAG, "data"); - OIC_TRACE_BEGIN(%s:CAReceivedPacketCallback, TAG); if (0 == dataLen) @@ -1370,6 +1366,7 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) VERIFY_NON_NULL_VOID(data, TAG, "data"); VERIFY_NON_NULL_VOID(pdu, TAG, "pdu"); + OIC_TRACE_BEGIN(%s:CALogPDUInfo, TAG); OIC_LOG(DEBUG, ANALYZER_TAG, "================================================="); if(SEND_TYPE_MULTICAST == data->type) @@ -1448,7 +1445,10 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) { OIC_LOG(DEBUG, ANALYZER_TAG, "Coap Token"); OIC_LOG_BUFFER(DEBUG, ANALYZER_TAG, (const uint8_t *) info->token, info->tokenLength); + OIC_TRACE_BUFFER("OIC_CA_MSG_HANDLE:CALogPDUInfo:token:", (const uint8_t *) info->token, + info->tokenLength); OIC_LOG_V(DEBUG, ANALYZER_TAG, "Res URI = [%s]", info->resourceUri); + OIC_TRACE_MARK(%s:CALogPDUInfo:uri:%s, TAG, info->resourceUri); if (CA_FORMAT_APPLICATION_CBOR == info->payloadFormat) { @@ -1471,6 +1471,7 @@ static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) // OIC_LOG_BUFFER(DEBUG, ANALYZER_TAG, pdu->data, payloadLen); OIC_LOG_V(DEBUG, ANALYZER_TAG, "CoAP Payload Size = [%lu]", payloadLen); OIC_LOG(DEBUG, ANALYZER_TAG, "================================================="); + OIC_TRACE_END(); } #else static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu) diff --git a/resource/csdk/logger/SConscript b/resource/csdk/logger/SConscript old mode 100644 new mode 100755 index 753e9a5..c2b7fba --- a/resource/csdk/logger/SConscript +++ b/resource/csdk/logger/SConscript @@ -14,6 +14,8 @@ if env.get('TARGET_OS') == 'tizen': env.AppendUnique(LIBPATH = [build_dir]) else: env.AppendUnique(LIBPATH = [os.path.join(build_dir, 'resource', 'csdk', 'logger')]) +if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': + env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE']) env.PrependUnique(LIBS = ['logger']) diff --git a/resource/csdk/logger/include/trace.h b/resource/csdk/logger/include/trace.h index 1083ecf..db230292 100755 --- a/resource/csdk/logger/include/trace.h +++ b/resource/csdk/logger/include/trace.h @@ -24,7 +24,9 @@ #ifdef __ANDROID__ #include "logger.h" #elif defined(__TIZEN__) +#ifdef OIC_SUPPORT_TIZEN_TRACE #include +#endif #elif defined(ARDUINO) #endif @@ -32,28 +34,60 @@ extern "C" { #endif + #ifdef __ANDROID__ +void oic_trace_begin(const char *name, ...); +void oic_trace_end(); +void oic_trace_buffer(const char *name, const uint8_t * buffer, size_t bufferSize); + #define OIC_TRACE_BEGIN(MSG, ...) \ oic_trace_begin("OIC:"#MSG, ##__VA_ARGS__) #define OIC_TRACE_END() \ oic_trace_end() +#define OIC_TRACE_MARK(MSG, ...) \ + oic_trace_begin("OIC:"#MSG, ##__VA_ARGS__), \ + oic_trace_end() +#define OIC_TRACE_BUFFER(MSG, BUF, SIZ) \ + oic_trace_buffer(MSG, BUF, SIZ) #elif defined(__TIZEN__) /* trace macro for Tizen. this will call ttrace api internally*/ +#ifdef OIC_SUPPORT_TIZEN_TRACE + +#include + +void oic_trace_buffer(const char *name, const uint8_t * buffer, size_t bufferSize); + +/* ttrace api is available on tizen2.4 (or above) only */ #define OIC_TRACE_BEGIN(MSG, ...) \ - traceBegin(TTRACE_TAG_APP, "IOTIVITY:"#MSG, ##__VA_ARGS__) + traceBegin(TTRACE_TAG_APP, "OIC:"#MSG, ##__VA_ARGS__) #define OIC_TRACE_END() \ traceEnd(TTRACE_TAG_APP) +#define OIC_TRACE_MARK(MSG, ...) \ + traceBegin(TTRACE_TAG_APP, "OIC:"#MSG, ##__VA_ARGS__), \ + traceEnd(TTRACE_TAG_APP) +#define OIC_TRACE_BUFFER(MSG, BUF, SIZ) \ + oic_trace_buffer(MSG, BUF, SIZ) +#else +#define OIC_TRACE_BEGIN(MSG, ...) +#define OIC_TRACE_END() +#define OIC_TRACE_MARK(MSG, ...) +#define OIC_TRACE_BUFFER(MSG, BUF, SIZ) +#endif #elif defined(ARDUINO) /* trace macro for Arduino. currently this will call nothing*/ #define OIC_TRACE_BEGIN(MSG, ...) #define OIC_TRACE_END() +#define OIC_TRACE_MARK(MSG, ...) +#define OIC_TRACE_BUFFER(MSG, BUF, SIZ) #else #define OIC_TRACE_BEGIN(MSG, ...) #define OIC_TRACE_END() +#define OIC_TRACE_MARK(MSG, ...) +#define OIC_TRACE_BUFFER(MSG, BUF, SIZ) #endif //endif diff --git a/resource/csdk/logger/src/trace.c b/resource/csdk/logger/src/trace.c index 47a626f..7e1a9b0 100755 --- a/resource/csdk/logger/src/trace.c +++ b/resource/csdk/logger/src/trace.c @@ -18,25 +18,46 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -// Defining _POSIX_C_SOURCE macro with 199309L (or greater) as value -// causes header files to expose definitions -// corresponding to the POSIX.1b, Real-time extensions -// (IEEE Std 1003.1b-1993) specification -// -// For this specific file, see use of clock_gettime, -// Refer to http://pubs.opengroup.org/stage7tc1/functions/clock_gettime.html -// and to http://man7.org/linux/man-pages/man2/clock_gettime.2.html -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200809L -#endif - #include "iotivity_config.h" +#include "trace.h" + +#if (defined(__ANDROID__)) || (defined(__TIZEN__) && defined(OIC_SUPPORT_TIZEN_TRACE)) + +#define MAX_BUFFER_SIZE 8 +#define MAX_LINE_LEN ((MAX_BUFFER_SIZE) * 2) + 1 + +void oic_trace_buffer(const char *name, const uint8_t * buffer, size_t bufferSize) +{ + if (!name || !buffer || (0 == bufferSize)) + { + return; + } + + char lineBuffer[MAX_LINE_LEN] = {0}; + size_t count = (MAX_BUFFER_SIZE > bufferSize) ? bufferSize : MAX_BUFFER_SIZE; + size_t remainSize = MAX_LINE_LEN; + int writtenSize = 0; + char* buf = &lineBuffer[0]; + + for (size_t i = 0; i < count; i++) + { + writtenSize = snprintf(buf, remainSize, "%02x", buffer[i]); + if (2 != writtenSize) + { + break; + } + buf += writtenSize; + remainSize -= 2; + } + + OIC_TRACE_BEGIN(%s:%s, name, lineBuffer); + OIC_TRACE_END(); +} + +#endif -// Pull in _POSIX_TIMERS feature test macro to check for -// clock_gettime() support. #ifndef __TIZEN__ -#include "trace.h" #include "logger.h" #ifdef HAVE_UNISTD_H @@ -73,10 +94,10 @@ int g_trace_marker_hd=FD_INITIAL_VALUE; int oic_trace_init() { OIC_LOG(INFO, TAG, "entering oic_trace_init"); - int mounts; + int mounts = -1; char buf[MAX_BUF_SIZE] = {0}; - ssize_t buflen; - char *line, *tmp1, *path = NULL; + ssize_t buflen = -1; + char *line = NULL, *tmp1 = NULL, *path = NULL; if(g_trace_marker_hd == FD_INITIAL_VALUE) { @@ -99,7 +120,7 @@ int oic_trace_init() line = strtok_r(buf, "\n", &tmp1); while (line) { - char *tmp2, *tmp_path, *fstype; + char *tmp2 = NULL, *tmp_path = NULL, *fstype = NULL; /* " ..." */ strtok_r(line, " ", &tmp2); tmp_path = strtok_r(NULL, " ", &tmp2); @@ -123,12 +144,13 @@ int oic_trace_init() g_trace_marker_hd = open(buf, O_WRONLY); if (g_trace_marker_hd < 0) { - OIC_LOG_V(INFO, TAG, "failed to open trace_marker file: %s (%d)", strerror(errno), errno); + OIC_LOG_V(INFO, TAG, "failed to open trace_marker file: %s (%d)", + strerror(errno), errno); return -1; } } OIC_LOG_V(INFO, TAG, "exit oic_trace_init with: %d", g_trace_marker_hd); - return 0; + return g_trace_marker_hd; } void oic_trace_begin(const char *name, ...) diff --git a/resource/csdk/stack/samples/tizen/build/scons/SConscript b/resource/csdk/stack/samples/tizen/build/scons/SConscript old mode 100644 new mode 100755 index 93512f1..a606db0 --- a/resource/csdk/stack/samples/tizen/build/scons/SConscript +++ b/resource/csdk/stack/samples/tizen/build/scons/SConscript @@ -20,7 +20,10 @@ else: if env.get('LOGGING'): env.AppendUnique(CPPDEFINES = ['TB_LOG']) -env.ParseConfig("pkg-config --cflags --libs capi-network-connection dlog ttrace glib-2.0") +env.ParseConfig("pkg-config --cflags --libs capi-network-connection dlog glib-2.0") +if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True': + env.ParseConfig("pkg-config --cflags --libs ttrace") + env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE']) if 'ALL' in transport: env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER','EDR_ADAPTER','LE_ADAPTER']) print "CA Transport is ALL" diff --git a/resource/csdk/stack/src/occlientcb.c b/resource/csdk/stack/src/occlientcb.c old mode 100644 new mode 100755 index 40912b4..315e7da --- a/resource/csdk/stack/src/occlientcb.c +++ b/resource/csdk/stack/src/occlientcb.c @@ -22,6 +22,7 @@ #include "occlientcb.h" #include #include "logger.h" +#include "trace.h" #include "oic_malloc.h" #include @@ -52,6 +53,8 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, return OC_STACK_INVALID_PARAM; } + OIC_TRACE_BEGIN(%s:AddClientCB, TAG); + ClientCB *cbNode = NULL; #ifdef WITH_PRESENCE @@ -73,6 +76,8 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, { OIC_LOG(INFO, TAG, "Adding client callback with token"); OIC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, tokenLength); + OIC_TRACE_BUFFER("OIC_RI_CLIENTCB:AddClientCB:token:", + (const uint8_t *)token, tokenLength); cbNode->callBack = cbData->cb; cbNode->context = cbData->context; cbNode->deleteCallback = cbData->cd; @@ -101,6 +106,7 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, cbNode->requestUri = requestUri; // I own it now cbNode->devAddr = devAddr; // I own it now OIC_LOG_V(INFO, TAG, "Added Callback for uri : %s", requestUri); + OIC_TRACE_MARK(%s:AddClientCB:uri:%s, TAG, requestUri); LL_APPEND(cbList, cbNode); *clientCB = cbNode; } @@ -126,6 +132,7 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, if (method == OC_REST_PRESENCE && resourceTypeName) { + OIC_TRACE_END(); // Amend the found or created node by adding a new resourceType to it. return InsertResourceTypeFilter(cbNode,(char *)resourceTypeName); // I own resourceTypName now. @@ -138,25 +145,31 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, OICFree(resourceTypeName); #endif + OIC_TRACE_END(); return OC_STACK_OK; exit: + OIC_TRACE_END(); return OC_STACK_NO_MEMORY; } void DeleteClientCB(ClientCB * cbNode) { + OIC_TRACE_BEGIN(%s:DeleteClientCB, TAG); if (cbNode) { LL_DELETE(cbList, cbNode); OIC_LOG (INFO, TAG, "Deleting token"); OIC_LOG_BUFFER(INFO, TAG, (const uint8_t *)cbNode->token, cbNode->tokenLength); + OIC_TRACE_BUFFER("OIC_RI_CLIENTCB:DeleteClientCB:token:", + (const uint8_t *)cbNode->token, cbNode->tokenLength); CADestroyToken (cbNode->token); OICFree(cbNode->devAddr); OICFree(cbNode->handle); if (cbNode->requestUri) { OIC_LOG_V (INFO, TAG, "Deleting callback with uri %s", cbNode->requestUri); + OIC_TRACE_MARK(%s:DeleteClientCB:uri:%s, TAG, cbNode->requestUri); OICFree(cbNode->requestUri); } if (cbNode->deleteCallback) @@ -186,6 +199,7 @@ void DeleteClientCB(ClientCB * cbNode) OICFree(cbNode); cbNode = NULL; } + OIC_TRACE_END(); } /* diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c old mode 100644 new mode 100755 index 8993ef1..783234f --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -588,12 +588,14 @@ static OCStackResult OCSendRequest(const CAEndpoint_t *object, CARequestInfo_t * { VERIFY_NON_NULL(object, FATAL, OC_STACK_INVALID_PARAM); VERIFY_NON_NULL(requestInfo, FATAL, OC_STACK_INVALID_PARAM); + OIC_TRACE_BEGIN(%s:OCSendRequest, TAG); #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP) OCStackResult rmResult = RMAddInfo(object->routeData, requestInfo, true, NULL); if (OC_STACK_OK != rmResult) { OIC_LOG(ERROR, TAG, "Add destination option failed"); + OIC_TRACE_END(); return rmResult; } #endif @@ -634,8 +636,10 @@ static OCStackResult OCSendRequest(const CAEndpoint_t *object, CARequestInfo_t * if(CA_STATUS_OK != result) { OIC_LOG_V(ERROR, TAG, "CASendRequest failed with CA error %u", result); + OIC_TRACE_END(); return CAResultToOCResult(result); } + OIC_TRACE_END(); return OC_STACK_OK; } //----------------------------------------------------------------------------- @@ -1438,6 +1442,7 @@ OCStackResult OCMapZoneIdToLinkLocalEndpoint(OCDiscoveryPayload *payload, uint32 void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* responseInfo) { OIC_LOG(DEBUG, TAG, "Enter OCHandleResponse"); + OIC_TRACE_MARK(%s:OCHandleResponse:%s, TAG, responseInfo->info.resourceUri); if(responseInfo->info.resourceUri && strcmp(responseInfo->info.resourceUri, OC_RSRVD_PRESENCE_URI) == 0) @@ -1954,6 +1959,7 @@ void HandleCAErrorResponse(const CAEndpoint_t *endPoint, const CAErrorInfo_t *er if (!response) { OIC_LOG(ERROR, TAG, "Allocating memory for response failed"); + OIC_TRACE_END(); return; } @@ -2161,6 +2167,7 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) void OCHandleRequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* requestInfo) { + OIC_TRACE_MARK(%s:OCHandleRequests:%s, TAG, requestInfo->info.resourceUri); OIC_LOG(DEBUG, TAG, "Enter OCHandleRequests"); OIC_LOG_V(INFO, TAG, "Endpoint URI : %s", requestInfo->info.resourceUri); @@ -3044,8 +3051,10 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCHeaderOption *options, uint8_t numOptions) { + OIC_TRACE_BEGIN(%s:OCDoRequest, TAG); OCStackResult ret = OCDoRequest(handle, method, requestUri,destination, payload, connectivityType, qos, cbData, options, numOptions); + OIC_TRACE_END(); // This is the owner of the payload object, so we free it OCPayloadDestroy(payload); @@ -4652,6 +4661,7 @@ OCNotifyListOfObservers (OCResourceHandle handle, OCStackResult OCDoResponse(OCEntityHandlerResponse *ehResponse) { + OIC_TRACE_BEGIN(%s:OCDoResponse, TAG); OCStackResult result = OC_STACK_ERROR; OCServerRequest *serverRequest = NULL; @@ -4670,6 +4680,7 @@ OCStackResult OCDoResponse(OCEntityHandlerResponse *ehResponse) result = serverRequest->ehResponseHandler(ehResponse); } + OIC_TRACE_END(); return result; } diff --git a/tools/tizen/iotivity.spec b/tools/tizen/iotivity.spec old mode 100644 new mode 100755 index 684eeb9..c86efee --- a/tools/tizen/iotivity.spec +++ b/tools/tizen/iotivity.spec @@ -19,6 +19,10 @@ Source1002: %{name}-test.manifest %define TARGET_TRANSPORT IP %endif +%if "%{tizen}" == "3.0" +%define OIC_SUPPORT_TIZEN_TRACE True +%endif + %if "%{profile}" == "ivi" %define TARGET_TRANSPORT IP %endif @@ -82,6 +86,7 @@ BuildRequires: python-accel-aarch64-cross-aarch64 %{!?WITH_MQ: %define WITH_MQ OFF} %{!?WITH_PROXY: %define WITH_PROXY 0} %{!?WITH_TCP: %define WITH_TCP 0} +%{!?OIC_SUPPORT_TIZEN_TRACE: %define OIC_SUPPORT_TIZEN_TRACE False} BuildRequires: expat-devel BuildRequires: python, libcurl-devel @@ -97,7 +102,9 @@ BuildRequires: pkgconfig(sqlite3) %if "%{TARGET_OS}" == "tizen" BuildRequires: gettext-tools BuildRequires: pkgconfig(dlog) +%if "%{OIC_SUPPORT_TIZEN_TRACE}" == "True" BuildRequires: pkgconfig(ttrace) +%endif BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(capi-network-bluetooth) >= 0.1.52 %else @@ -189,6 +196,7 @@ scons %{?_smp_mflags} --prefix=%{_prefix} \ WITH_MQ=%{WITH_MQ} \ WITH_PROXY=%{WITH_PROXY} \ WITH_TCP=%{WITH_TCP} \ + OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \ #eol @@ -212,6 +220,7 @@ scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \ WITH_MQ=%{WITH_MQ} \ WITH_PROXY=%{WITH_PROXY} \ WITH_TCP=%{WITH_TCP} \ + OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \ #eol mkdir -p %{ex_install_dir} -- 2.7.4