如何在linux内核中启用纳秒分辨率的时间戳。 目前它以毫秒分辨率显示如下。
我需要启用任何配置或宏吗??? ....
[ 0.220000] omap_mux_init: Add partition: #1: core, flags: 4
[ 0.220000] ti81xx_register_mcasp: platform not supported
[ 0.230000] Debugfs: Only enabling/disabling deep sleep and wakeup timer is supported now
[ 0.230000] bio: create slab <bio-0> at 0
[ 0.230000] SCSI subsystem initialized
[ 0.230000] usbcore: registered new interface driver usbfs
[ 0.230000] usbcore: registered new interface driver hub
[ 0.230000] usbcore: registered new device driver usb
[ 0.230000] omap_i2c omap_i2c.1: bus 1 rev4.0 at 100 kHz
[ 0.260000] omap_i2c omap_i2c.2: bus 2 rev4.0 at 100 kHz
[ 0.280000] omap_i2c omap_i2c.3: bus 3 rev4.0 at 100 kHz
[ 0.300000] omap_i2c omap_i2c.4: bus 4 rev4.0 at 100 kHz
[ 0.300000] Switching to clocksource gp timer
[ 0.310000] musb-hdrc: version 6.0, otg (peripheral+host), debug=0
[ 0.310000] NET: Registered protocol family 2
[ 0.310000] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.310000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.310000] TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.310000] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.310000] TCP reno registered
[ 0.310000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.310000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.310000] NET: Registered protocol family 1
[ 0.310000] RPC: Registered udp transport module.
[ 0.310000] RPC: Registered tcp transport module.
[ 0.310000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.310000] Trying to unpack rootfs image as initramfs...
[ 0.310000] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.330000] Freeing initrd memory: 3660K
[ 0.330000] NetWinder Floating Point Emulator V0.97 (double precision)
...
答案 0 :(得分:0)
通过问题排查部分中的Printk Times文章;
- 时间的解决非常糟糕。
- Printk-time使用内核中的例程sched_clock()。在某些平台上,sched_clock()的分辨率只有1 jiffy(可能是10毫秒或更长)。这意味着您只能看到此分辨率的时间增量,为printk-times提供不精确的结果。要解决此问题,最佳解决方案是为您的平台实现一个良好的sched_clock()例程。 Sched_clock()返回一个64位的值,这是自某个事件以来的纳秒数(通常是自机器上电或调用time_init()以来。)许多嵌入式处理器在片上系统上有一个时钟或定时器,可以为sched_clock()提供一个好的分辨率时钟源。最好是时钟可以提供优于1微秒的分辨率。请注意,这只需要一个以1 MHz运行的时钟来实现此分辨率。
听起来你的平台正在以1 ms的分辨率为sched_clock()使用jiffies。