linux - How to print time in kernel source? -


i'm newbie of linux.

i'm modifying kernel/sys.c in linux kernel source.

to see fluctuation of system calls, want modify source print time.

but think can use printf in kernel source.

how can print time????

one way accomplish use printk (see http://www.makelinux.net/books/lkd2/ch18lev1sec3 example) , enable printk_times feature, you'll output in form of

[8804849.737776] kernel bug @ fs/nfs/file.c:321 

where these 2 numbers number of seconds , microseconds since system booted.

you can enable in several ways:

  1. you can define config_printk_time kernel config option
  2. at boot time, passing printk.time=1
  3. at runtime, issuing # echo 1 > /sys/module/printk/parameters/time

some resources:


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -