From patchwork Fri Feb 25 18:06:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 590811 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 p1PI6ett005387 for ; Fri, 25 Feb 2011 18:06:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756259Ab1BYSGj (ORCPT ); Fri, 25 Feb 2011 13:06:39 -0500 Received: from relay2.sgi.com ([192.48.179.30]:42326 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756089Ab1BYSGi (ORCPT ); Fri, 25 Feb 2011 13:06:38 -0500 Received: from gulag1.americas.sgi.com (gulag1.americas.sgi.com [128.162.236.41]) by relay2.corp.sgi.com (Postfix) with ESMTP id 7973130407B; Fri, 25 Feb 2011 10:06:34 -0800 (PST) Received: by gulag1.americas.sgi.com (Postfix, from userid 5508) id 6531F10377714; Fri, 25 Feb 2011 12:06:34 -0600 (CST) Message-Id: <20110225180634.281487428@gulag1.americas.sgi.com> References: <20110225180633.857892225@gulag1.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Fri, 25 Feb 2011 12:06:36 -0600 From: Mike Travis To: Ingo Molnar Cc: David Rientjes , 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 3/4] 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]); Fri, 25 Feb 2011 18:06:40 +0000 (UTC) --- 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);