From patchwork Sat Feb 19 02:47:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 574391 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1J2mfFb025294 for ; Sat, 19 Feb 2011 02:48:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846Ab1BSCre (ORCPT ); Fri, 18 Feb 2011 21:47:34 -0500 Received: from relay3.sgi.com ([192.48.152.1]:42548 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753143Ab1BSCrL (ORCPT ); Fri, 18 Feb 2011 21:47:11 -0500 Received: from gulag1.americas.sgi.com (gulag1.americas.sgi.com [128.162.236.41]) by relay3.corp.sgi.com (Postfix) with ESMTP id 0DA0AAC011; Fri, 18 Feb 2011 18:47:10 -0800 (PST) Received: by gulag1.americas.sgi.com (Postfix, from userid 5508) id 3DFA31037A63F; Fri, 18 Feb 2011 20:47:06 -0600 (CST) Message-Id: <20110219024706.121740209@gulag1.americas.sgi.com> References: <20110219024705.308511527@gulag1.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Fri, 18 Feb 2011 20:47:10 -0600 From: Mike Travis To: Ingo Molnar Cc: Jack Steiner , Robin Holt , Len Brown , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , Yinghai Lu , linux-acpi@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] printk: Minimize time zero output Content-Disposition: inline; filename=minimize-time-zero-msgs Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 19 Feb 2011 02:48:41 +0000 (UTC) --- linux.orig/kernel/printk.c +++ linux/kernel/printk.c @@ -735,9 +735,14 @@ static inline int printk_emit_time(void) 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)) { + 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);