1、知识百科在DPDK库中提供了一个timer模块,负责异步调用一些回调函数、定时操作等等,DPDK的精准定时是依靠hpet模块(和DPDK版本也有关系),在main()->rte_eal_init()->rte_eal_hpet_init()初始化。hpet时钟支持:允许内核使用hpet,hpet是替代8524芯片的新一代定时器,i686及以上级别的主板都支持。rte_eal_hpet_init()会去打开/dev/hpet设备文件描述符,并映射一块1024大小的内存空间,创建hpet_msb_inc线程(主要更新eal_hpet_msb全局变量)。比如rte_delay_us()会调用rte_get_hpet_cycles()获取全局变量eal_hpet_msb的值,去确定延时是否到达。fd = open(DEV_HPET, O_RDONLY);eal_hpet = mmap(NULL, 1024, PROT_READ, MAP_SHARED, fd, 0);ret = pthread_create(&msb;_inc_thread_id, NULL,hpet_msb_inc, NULL);static voidhpet_msb_inc(__attribute__((unused)) void *arg){uint32_t t;while (1) {t = (eal_hpet-
...
继续阅读
(920)