From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 23 17:11:05 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0014CD42 for ; Sun, 23 Nov 2014 17:11:04 +0000 (UTC) Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [IPv6:2a00:1450:400c:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89555C32 for ; Sun, 23 Nov 2014 17:11:04 +0000 (UTC) Received: by mail-wg0-f48.google.com with SMTP id y19so10330482wgg.21 for ; Sun, 23 Nov 2014 09:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=7zR3dz+TaSYYjW2oQBCTLSh0uSwKJEDImSSHmMp+iqI=; b=RWGDU6YQaaupkCI45b6IHifQ/+OD54JUslEkqwFZozbsXxW8GoG8Vb2t3dpC9Y5u/W 9SjmsgFzjG4c0cU4MWnhd5fO92ltT8o4XLyj50J8c2kTMIpspiUlknHaiu7LL30//Gs+ 13CpL8NvM1etzXFoApg9bIwWMpFzh8YZWcctDvmzsitAeV/OiaGCTm3HK8GpI9QoqhFC 88b4mlqev8rmkpokK2O/3a7VNi2ja2E33ICMdBKMIXUbK38ULGHAEtpNuRSUDnEWNrzW Xsgqe33CfXS4M2Mg2Ax/+SzVg9ZAmpoM7avW5Vg4IeMYWmeS5wiPFatfXDGissx6rjFB tjDg== MIME-Version: 1.0 X-Received: by 10.180.109.194 with SMTP id hu2mr14533167wib.24.1416762662899; Sun, 23 Nov 2014 09:11:02 -0800 (PST) Received: by 10.180.8.7 with HTTP; Sun, 23 Nov 2014 09:11:02 -0800 (PST) Date: Sun, 23 Nov 2014 18:11:02 +0100 Message-ID: Subject: top -d1 behavior From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= To: FreeBSD Hackers Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2014 17:11:05 -0000 Hi hackers, While writing a small script for a friend, I run into a peculiar top behavior: top -d1 shows only one 'iteration' of the information screen, but in it, the CPU percentages line is not well formed: there are 5 columns with the '%' symbol, but no values are shown. This only happens for -d1 and this behavior is deliberately done in the sources (see 'dostates' variable). Also we are using pc_cp_time from struct pcpu as the output for the kern.cp_time sysctl (used by top to know the time spent by the cpu in every state), and we are using the same fields in linprocfs for the 'stat' file in linux emulation (so a linux top version would read and print out those values). My point is: why are we doing this? If we remove that constraint, top would show the values for -d1. I don't know if they would be really accurate, but not printing anything doesn't seem a nice behavior either (especially when this is not documented in the man page) Thanks in advance.