summaryrefslogtreecommitdiff
path: root/include/dlt/dlt_user_macros.h
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-11-28 07:49:56 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-01-10 07:15:36 +0100
commitc48c1d23f6b27a459db55d64e87dbbc0394c0cf6 (patch)
treeb0852a74bde1a67859bb53b34ddba0466c1d466a /include/dlt/dlt_user_macros.h
parentb0c6acf7f20d843b6928ba53a88aa2456bade754 (diff)
downloadDLT-daemon-c48c1d23f6b27a459db55d64e87dbbc0394c0cf6.tar.gz
Reduce usage of SEM_LOCK in application library and reset pointers.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'include/dlt/dlt_user_macros.h')
-rw-r--r--include/dlt/dlt_user_macros.h67
1 files changed, 50 insertions, 17 deletions
diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h
index bd4d5fc..3b6bb06 100644
--- a/include/dlt/dlt_user_macros.h
+++ b/include/dlt/dlt_user_macros.h
@@ -160,11 +160,14 @@ extern DltContext CONTEXT;
#else
#define DLT_LOG(CONTEXT,LOGLEVEL,ARGS...) \
do { \
- DltContextData log; \
- if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)>0) \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
{ \
- ARGS; \
- dlt_user_log_write_finish(&log); \
+ DltContextData log; \
+ if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)>0) \
+ { \
+ ARGS; \
+ dlt_user_log_write_finish(&log); \
+ } \
} \
} while(0)
#endif
@@ -184,11 +187,14 @@ extern DltContext CONTEXT;
#else
#define DLT_LOG_ID(CONTEXT,LOGLEVEL,MSGID,ARGS...) \
do { \
- DltContextData log; \
- if (dlt_user_log_write_start_id(&CONTEXT,&log,LOGLEVEL,MSGID)>0) \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
{ \
- ARGS; \
- dlt_user_log_write_finish(&log); \
+ DltContextData log; \
+ if (dlt_user_log_write_start_id(&CONTEXT,&log,LOGLEVEL,MSGID)>0) \
+ { \
+ ARGS; \
+ dlt_user_log_write_finish(&log); \
+ } \
} \
} while(0)
#endif
@@ -285,7 +291,10 @@ extern DltContext CONTEXT;
*/
#define DLT_TRACE_NETWORK(CONTEXT,TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD) \
do { \
- dlt_user_trace_network(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD); \
+ if ((CONTEXT).trace_status_ptr && *((CONTEXT).trace_status_ptr)==DLT_TRACE_STATUS_ON) \
+ { \
+ dlt_user_trace_network(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD); \
+ } \
}while(0)
/**
@@ -299,7 +308,10 @@ extern DltContext CONTEXT;
*/
#define DLT_TRACE_NETWORK_TRUNCATED(CONTEXT,TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD) \
do { \
- dlt_user_trace_network_truncated(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD, 1); \
+ if ((CONTEXT).trace_status_ptr && *((CONTEXT).trace_status_ptr)==DLT_TRACE_STATUS_ON) \
+ { \
+ dlt_user_trace_network_truncated(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD, 1); \
+ } \
}while(0)
/**
@@ -313,7 +325,10 @@ extern DltContext CONTEXT;
*/
#define DLT_TRACE_NETWORK_SEGMENTED(CONTEXT,TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD) \
do { \
- dlt_user_trace_network_segmented(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD); \
+ if ((CONTEXT).trace_status_ptr && *((CONTEXT).trace_status_ptr)==DLT_TRACE_STATUS_ON) \
+ { \
+ dlt_user_trace_network_segmented(&(CONTEXT),TYPE,HEADERLEN,HEADER,PAYLOADLEN,PAYLOAD); \
+ } \
}while(0)
/**
@@ -324,7 +339,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_STRING(CONTEXT,LOGLEVEL,TEXT) \
do { \
- dlt_log_string(&(CONTEXT), LOGLEVEL, TEXT); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_string(&(CONTEXT), LOGLEVEL, TEXT); \
+ } \
} while(0)
/**
@@ -336,7 +354,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_STRING_INT(CONTEXT,LOGLEVEL,TEXT,INT_VAR) \
do { \
- dlt_log_string_int(&(CONTEXT), LOGLEVEL, TEXT, INT_VAR); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_string_int(&(CONTEXT), LOGLEVEL, TEXT, INT_VAR); \
+ } \
} while(0)
/**
@@ -348,7 +369,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_STRING_UINT(CONTEXT,LOGLEVEL,TEXT,UINT_VAR) \
do { \
- dlt_log_string_uint(&(CONTEXT),LOGLEVEL,TEXT,UINT_VAR); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_string_uint(&(CONTEXT),LOGLEVEL,TEXT,UINT_VAR); \
+ } \
} while(0)
/**
@@ -359,7 +383,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_UINT(CONTEXT,LOGLEVEL,UINT_VAR) \
do { \
- dlt_log_uint(&(CONTEXT),LOGLEVEL,UINT_VAR); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_uint(&(CONTEXT),LOGLEVEL,UINT_VAR); \
+ } \
} while(0)
/**
@@ -370,7 +397,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_INT(CONTEXT,LOGLEVEL,INT_VAR) \
do { \
- dlt_log_int(&(CONTEXT),LOGLEVEL,INT_VAR); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_int(&(CONTEXT),LOGLEVEL,INT_VAR); \
+ } \
} while(0)
/**
@@ -382,7 +412,10 @@ extern DltContext CONTEXT;
*/
#define DLT_LOG_RAW(CONTEXT,LOGLEVEL,BUF,LEN) \
do { \
- dlt_log_raw(&(CONTEXT),LOGLEVEL,BUF,LEN); \
+ if((CONTEXT).log_level_ptr && ((LOGLEVEL)<=(int)*((CONTEXT).log_level_ptr) ) && ((LOGLEVEL)!=0)) \
+ { \
+ dlt_log_raw(&(CONTEXT),LOGLEVEL,BUF,LEN); \
+ } \
} while(0)
/**