From 3a5bf13c0e7b427b805a372dc1ed1bd5d7759082 Mon Sep 17 00:00:00 2001 From: Yalei Wang Date: Tue, 13 Mar 2018 16:36:34 +0800 Subject: Clean up the src and update the doc Change-Id: If9c9cdb3ae5167198f0a2ae085871ff7134b32b0 Signed-off-by: Yalei Wang --- src/framework/include/nsfw_mgr_com_api.h | 2 - src/framework/include/nstack_log.h | 110 +------------------------------ src/framework/include/nstack_trace.h | 76 --------------------- 3 files changed, 1 insertion(+), 187 deletions(-) delete mode 100644 src/framework/include/nstack_trace.h (limited to 'src/framework/include') diff --git a/src/framework/include/nsfw_mgr_com_api.h b/src/framework/include/nsfw_mgr_com_api.h index 2499fee..099cdbc 100644 --- a/src/framework/include/nsfw_mgr_com_api.h +++ b/src/framework/include/nsfw_mgr_com_api.h @@ -150,8 +150,6 @@ typedef struct _nsfw_mgr_msg u32 src_pid; u32 dst_pid; - u64 traceid; - u8 msg_body[NSFW_MGR_MSG_BODY_LEN]; } nsfw_mgr_msg; diff --git a/src/framework/include/nstack_log.h b/src/framework/include/nstack_log.h index bb90ec8..1f0749a 100644 --- a/src/framework/include/nstack_log.h +++ b/src/framework/include/nstack_log.h @@ -34,7 +34,6 @@ #include #include #include "types.h" -#include "nstack_trace.h" #include "glog/nstack_glog.ph" #include "glog/nstack_glog_in.h" @@ -275,65 +274,24 @@ extern __thread unsigned int nstack_log_nonreentry; /* hanging up version check log need restrain */ extern int ctrl_log_switch; -#if defined MPTCP_UT -#define NS_LOGPID(_module,_prestr,_level,fmt, ...) -#elif !defined FOR_NSTACK_UT + #define NS_LOGPID(_module,_prestr,_level,fmt, ...) \ {\ if (log_shooting(_module, _level) && (0 == nstack_log_nonreentry) && (0 == ctrl_log_switch))\ {\ nstack_log_nonreentry = 1;\ - NSTACK_TRACING(_level, _prestr, fmt,##__VA_ARGS__);\ if(nstack_log_info_check(_module, _level))\ glog_print(LOG_TYPE(_module,_level),_prestr,level_stoa(_level),-1,GET_FILE_NAME(__FILE__),\ __LINE__,__func__,fmt, ##__VA_ARGS__);\ nstack_log_nonreentry = 0;\ }\ } -#else -static inline void -ut_log_info (const char *file_name, int line_no, const char *func_name, - int _module, const char *_prestr, unsigned int _level, char *fmt, - ...) -{ - va_list ap; - - if (log_shooting (_module, _level) && (0 == nstack_log_nonreentry) - && (0 == ctrl_log_switch)) - { - - nstack_log_nonreentry = 1; - if (nstack_log_info_check (_module, _level)) - { - char pMsgBuf[MAX_LOG_TRANSITIONAL_LEN] = "\0"; - va_start (ap, fmt); - VSNPRINTF_S (pMsgBuf, - MAX_LOG_TRANSITIONAL_LEN, - MAX_LOG_TRANSITIONAL_LEN - 1, fmt, ap); - glog_print (LOG_TYPE (_module, _level), _prestr, - level_stoa (_level), -1, GET_FILE_NAME (file_name), - line_no, func_name, "%s", pMsgBuf); - va_end (ap); - } - nstack_log_nonreentry = 0; - - } -} -#define NS_LOGPID(_module,_prestr,_level,fmt, ...) \ -{\ - ut_log_info(__FILE__,__LINE__, __func__, _module,_prestr,_level,fmt, ##__VA_ARGS__); \ -} - -#endif - -#ifndef FOR_NSTACK_UT #define NS_LOG_CTRL(_id, _module, _prestr, _level, fmt, ...) \ {\ if (log_shooting(_module, _level) && (0 == nstack_log_nonreentry) && check_log_prt_time(_id))\ {\ nstack_log_nonreentry = 1;\ - NSTACK_TRACING(_level, _prestr, fmt,##__VA_ARGS__);\ if(nstack_log_info_check(_module, _level))\ glog_print(LOG_TYPE(_module,_level),_prestr,level_stoa(_level),get_unprt_log_count(_id),\ GET_FILE_NAME(__FILE__),__LINE__,__func__,fmt, ##__VA_ARGS__);\ @@ -342,42 +300,6 @@ ut_log_info (const char *file_name, int line_no, const char *func_name, }\ } -#else -static inline void -ut_ctrl_log_info (char *file_name, int line_no, char *func_name, int _id, - int _module, char *_prestr, unsigned int _level, char *fmt, - ...) -{ - va_list ap; - if (log_shooting (_module, _level) && (0 == nstack_log_nonreentry) - && check_log_prt_time (_id)) - { - nstack_log_nonreentry = 1; - if (nstack_log_info_check (_module, _level)) - { - char pMsgBuf[MAX_LOG_TRANSITIONAL_LEN] = "\0"; - va_start (ap, fmt); - VSNPRINTF_S (pMsgBuf, - MAX_LOG_TRANSITIONAL_LEN, - MAX_LOG_TRANSITIONAL_LEN - 1, fmt, ap); - glog_print (LOG_TYPE (_module, _level), _prestr, - level_stoa (_level), get_unprt_log_count (_id), - GET_FILE_NAME (file_name), line_no, func_name, "%s", - pMsgBuf); - va_end (ap); - } - clr_unprt_log_count (_id); - nstack_log_nonreentry = 0; - - } -} - -#define NS_LOG_CTRL(_id, _module, _prestr, _level, fmt, ...) \ -{\ - ut_ctrl_log_info(__FILE__,__LINE__, __func__, _id, _module,_prestr,_level,fmt, ##__VA_ARGS__); \ -} - -#endif #define NS_LOG_CTRL_STACKX(_id, dbug,_module,_prestr,_level,fmt, ...) \ {\ @@ -547,34 +469,4 @@ void clr_unprt_log_count (int id); void get_current_time (char *buf, const int len); -#ifdef CPU_CYCLES -static __inline__ unsigned long long -nstack_rdtsc (void) -{ - unsigned hi, lo; - __asm__ __volatile__ ("rdtsc":"=a" (lo), "=d" (hi)); - return ((unsigned long long) lo) | (((unsigned long long) hi) << 32); -} - -#define CPUB(name) \ -unsigned long long start##name = 0;\ -unsigned long long stop##name = 0;\ -static unsigned long long total##name = 0;\ -static unsigned long long total_cout##name = 0;\ -start##name = nstack_rdtsc(); - -#define CPUE(name) \ -stop##name = nstack_rdtsc();\ -total##name += (stop##name - start##name);\ -if(++total_cout##name == 1000000)\ -{\ - NSSOC_LOGINF(#name" cpu %llu-------\n", total##name / total_cout##name);\ - total##name = 0;\ - total_cout##name = 0;\ -} -#else -#define CPUB(name) -#define CPUE(name) -#endif - #endif diff --git a/src/framework/include/nstack_trace.h b/src/framework/include/nstack_trace.h deleted file mode 100644 index 0f4f640..0000000 --- a/src/framework/include/nstack_trace.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef __NSTACK_TRACE_H__ -#define __NSTACK_TRACE_H__ - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C"{ -/* *INDENT-ON* */ -#endif - -/*==============================================* - * include header files * - *----------------------------------------------*/ -#include "types.h" -#include "nstack_log.h" -#include -#define SPAN_NAME_MAX 64 -#define TRACE_NULL 0 -#define NSTACK_TRACE_ON 0 -#define NSTACK_TRACE_OFF 1 - -typedef struct nst_trace_header -{ - u64 trace_id; - u64 span_pid; - u64 span_id; /*now us */ - int fd; - int thread_id; -} trace_hread_t; - -typedef struct nst_trace_fun -{ - u64 (*current_traceid) (); - void (*span_raw) (char *msg); - void (*tracing_enable) (int enable); - void (*tracing_simpling) (int frequency); - void (*tracing_cleanup) (); - void (*tracing_setup) (u32 process); - u64 (*tracing_string_to_traceid) (const char *input, size_t length); -} trace_fun_t; - -extern __thread struct nst_trace_header strace_header; - -#define get_trace_header() (&strace_header) - -//For Tracing define own tracing feature. -#define nstack_trace_init( a ) -#define nstack_set_tracing_contex( a,b,c) -#define nstack_get_tracing_contex(traceid,spanid,spanpid,fd) -#define nstack_clear_tracing_contex( ) -#define NSTACK_TRACING(level, module_name,famt,...) -#define nstack_tracing_enalbe() -#define nstack_get_traceid() (NULL) - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif -- cgit 1.2.3-korg