lkml.org 
[lkml]   [2011]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/4] printk: Minimize time zero output
Reduce the length for time zero messages by only printing "[0] ".

Before:
[ 0.000000] <message>
After:
[0] <message>

There will be somewhere around 4000 to 5000 messages(*) on a fully
configured large NUMA system, before allocation of the log buf can
happen. By removing 11 bytes from each the net gain will be from
44,000 to 55,000 bytes of redundant information removed.

(* - this is after the minimize-srat-msgs patch is applied.)

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
kernel/printk.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

--- linux.orig/kernel/printk.c
+++ linux/kernel/printk.c
@@ -745,12 +745,17 @@ static inline int printk_emit_time(void)
char tbuf[50], *tp;
unsigned tlen;
unsigned long long t;
- unsigned long microsec_rem;

t = cpu_clock(printk_cpu);
- microsec_rem = do_div(t, 1000000000) / 1000;
- tlen = sprintf(tbuf, "[%5lu.%06lu] ", (unsigned long)t, microsec_rem);
+ if (likely(t)) {
+ unsigned long microsec_rem = do_div(t, 1000000000) / 1000;

+ tlen = sprintf(tbuf, "[%5lu.%06lu] ",
+ (unsigned long)t, microsec_rem);
+ } else {
+ /* reduce byte count in log when time is zero */
+ tlen = sprintf(tbuf, "[0] ");
+ }
for (tp = tbuf; tp < tbuf + tlen; tp++)
emit_log_char(*tp);

--


\
 
 \ /
  Last update: 2011-02-25 19:09    [W:0.149 / U:5.312 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site