Skip to content
Snippets Groups Projects
Select Git revision
  • c1b51fd2654736fd7c614d1571f904e236006651
  • devel default protected
  • fix_crash_at_transport
  • wenpeng-1007
  • asterisk_rdkb
  • lk_debug_dialogs
  • lk_forking_revert
  • wenpeng-jul8
  • gyang-devel
  • gyang-devel1
  • wenpeng-jul9
  • asterisk_rdkb_ipv6
  • 16916_rdkb_merge
  • lk_disable_registrar
  • wenpeng-100rel-ippbx
  • fix_multiple_dns_lookup
  • dev_fxs_no_wb
  • fix_fallback
  • 14666_fxs_no_wideband_codec
  • fix_srv_records
  • fix_deadlock_in_bridge_peer_functions
  • 22.0.0-pre1
  • 21.4.2
  • 20.9.2
  • 18.24.2
  • certified-20.7-cert2
  • certified-18.9-cert11
  • 21.4.1
  • 20.9.1
  • 18.24.1
  • 21.4.0
  • 20.9.0
  • 18.24.0
  • certified-20.7-cert1
  • certified-18.9-cert10
  • 21.4.0-rc1
  • 20.9.0-rc1
  • 18.24.0-rc1
  • 21.3.1
  • 20.8.1
  • 18.23.1
41 results

cli.c

Blame
  • debug.h 1.91 KiB
    /*
     * debug.h - defines macros for debugging.
     *
     * Copyright (C) 2020 iopsys Software Solutions AB. All rights reserved.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful, but
     * WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     * General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
     * 02110-1301 USA
     */
    #ifndef LIBWIFI_DEBUG_H
    #define LIBWIFI_DEBUG_H
    
    #define ERR_LEVEL   (3)
    #define WARN_LEVEL  (4)
    #define INFO_LEVEL  (6)
    #define DBG_LEVEL   (7)
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    extern void log_stderr(int level, const char *fmt, ...);
    
    #define pr_error(...)	log_stderr(ERR_LEVEL, __VA_ARGS__)
    #define pr_warn(...)	log_stderr(WARN_LEVEL, __VA_ARGS__)
    #define pr_info(...)	log_stderr(INFO_LEVEL, __VA_ARGS__)
    #define pr_debug(...)	log_stderr(DBG_LEVEL, __VA_ARGS__)
    
    #define WARN_ON(cond) \
    ({ \
    	typeof(cond) __c = (cond); \
    	if (__c) \
    		pr_warn("%sL%d@%s: [%s] failed\n", __FILE__, __LINE__, __func__, #cond); \
    	__c; \
    })
    
    #ifdef LIBEASY_TRACE_TIME
    #define ENTER() clock_t _clk_end, _clk_begin; \
    		_clk_begin = clock(); \
    		pr_error("%s called\n", __func__)
    
    #define EXIT(__res__) _clk_end = clock(); \
    			pr_error("%s ret %d consume %u us\n\n", __func__, __res__, \
    				 (unsigned int) _clk_end - _clk_begin)
    
    #define EXITV() _clk_end = clock(); \
    		pr_error("%s exit consume %u us\n\n", __func__, \
    			 (unsigned int) _clk_end - _clk_begin)
    #else
    #define ENTER()
    #define EXIT(__res__)
    #define EXITV()
    #endif
    
    
    #ifdef __cplusplus
    }
    #endif
    #endif /* LIBWIFI_DEBUG_H */