On Sat, Feb 09, 2008 at 12:50:28PM -0800, ron minnich wrote:
Define an option PRINTK_TSC
This is good. Linux has the same option.
What it does: each time printk would print a newline, it will instead print this: (16 hex digits of TSC)\n
Pro: Every line has time Con: Time is last on the line
Define a new format letter, T, such that %T as a format means "time".
Pro: Time can be first on line Con: We need to add it manually.
Doing it like Linux would need a static variable near printk() to keep \n state. :\
first option allows comprehensive timing, but it will slow things down a bit.
This must be optional though.
Second option allows us to completely tailor the printing of time, but you have to explicitly add %T when you want time printed.
Comments?
I think it is important that the time always is printed at the same position in a line, but manually having to add %T to every printk is impossible.
Maybe the answer is a macro wrapper around printk() (why is it called print_k_ by the way, we are not the kernel) which is defined differently depending on the config option.
If the option is set, the macro always prepends "%T " to the format string.
//Peter