博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
dpdk 调试(log)小结(终端打印或是输出到文件)
阅读量:4057 次
发布时间:2019-05-25

本文共 992 字,大约阅读时间需要 3 分钟。

1、日志等级

/* Can't use 0, as it gives compiler warnings */

#define RTE_LOG_EMERG    1U  /**< System is unusable.               */
#define RTE_LOG_ALERT    2U  /**< Action must be taken immediately. */
#define RTE_LOG_CRIT     3U  /**< Critical conditions.              */
#define RTE_LOG_ERR      4U  /**< Error conditions.                 */
#define RTE_LOG_WARNING  5U  /**< Warning conditions.               */
#define RTE_LOG_NOTICE   6U  /**< Normal but significant condition. */
#define RTE_LOG_INFO     7U  /**< Informational.                    */
#define RTE_LOG_DEBUG    8U  /**< Debug-level messages.             */

2、设置日志等级函数

rte_set_log_level(); 

eg:rte_set_log_level(RTE_LOG_DEBUG    );  设置调试日志,默认直接打印在终端上

在dpdk库里,rte_set_log_level()在rte_eal_init()里调用

3、日志输出到文件

rte_openlog_stream(fd);

注意fd是文件描述符,得自己使用fopen(log_file, "a+")创建

4、dpdk函数库运行参数

log-level [数字]

eg: ./build/l2fwd -c 3 -n 4  --log-level  8    

5、注意事项

在有的使用dpdk库的开源程序里,比如dvps, 在dvps.conf文件里

global_defs {

    log_level   WARNING
!    log_file    /var/log/dpvs.log
}

设置了日志等级,你在运行时使用--log-level  8可能不会生效,原因是dvps代码在执行rte_eal_init()函数后调用了rte_set_log_level,日志等级肯定是以最后调用的为准了

转载地址:http://lbqci.baihongyu.com/

你可能感兴趣的文章
MySQL查询及删除重复记录的方法
查看>>
Convert Sorted Array to Binary Search Tree
查看>>
Permutations
查看>>
Binary Tree Postorder Traversal
查看>>
Spiral Matrix II
查看>>
Set Matrix Zeroes
查看>>
Linked List Cycle II
查看>>
Remove Duplicates from Sorted Array II
查看>>
Combinations
查看>>
Sum Root to Leaf Numbers
查看>>
Longest Consecutive Sequence
查看>>
Binary Search Tree Iterator
查看>>
First Missing Positive Given an unsorted integer array, find the first missing positive integer. Fo
查看>>
Jump Game II
查看>>
Candy
查看>>
Simplify Path
查看>>
Evaluate Reverse Polish Notation
查看>>
Palindrome Partitioning
查看>>
Permutations II
查看>>
Combination Sum II
查看>>