From owner-freebsd-arch@FreeBSD.ORG Sun Dec 28 03:07:33 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA171997; Sun, 28 Dec 2014 03:07:32 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 95C8F642F0; Sun, 28 Dec 2014 03:07:32 +0000 (UTC) Received: from AlfredMacbookAir.local (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id C81C4341F853; Sat, 27 Dec 2014 19:07:25 -0800 (PST) Message-ID: <549F742D.3000802@mu.org> Date: Sat, 27 Dec 2014 19:08:29 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: "Simon J. Gerraty" Subject: Re: Libxo bugs and fixes. References: <201408141640.s7EGe422096656@idle.juniper.net> <53ED57F2.5020808@mu.org> <20140815053604.9E40B580A2@chaos.jnpr.net> <53EDB0EF.6090902@mu.org> <20140815173830.93832580A2@chaos.jnpr.net> <53EEA74B.9070107@mu.org> <20140816045254.5F47E580A2@chaos.jnpr.net> <549BA675.9070107@freebsd.org> <29784.1419492726@chaos> <26E73A9E-6EA4-4698-885D-BD91906D32D2@mu.org> <18276.1419528679@chaos> <549C50FB.6050908@mu.org> <23687.1419546234@chaos> In-Reply-To: <23687.1419546234@chaos> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcel Moolenaar , Phil Shafer , John-Mark Gurney , Alfred Perlstein , "arch@freebsd.org" , Poul-Henning Kamp , freebsd-arch , Konstantin Belousov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2014 03:07:33 -0000 On 12/25/14 2:23 PM, Simon J. Gerraty wrote: > Alfred Perlstein wrote: >> I don't think my patch adds an xo_flush to xo_emit... ? > No, you added a test around it - I only looked at the RHS. > OK, so I've updated https://reviews.freebsd.org/D1379 to include code to handle this. Solaris and glibc have a private libc function to check if a stream is line buffered called int __flbf (FILE *stream) which returns true/false if the stream if line buffered or not. We can use this in libxo now. This should avoid the superfluous flushes. One other topic, I talked to some webdevs and they suggested that we have a "jsonLD" which stands for "json line delimited" that would be useful for periodic output. This would be halfway between a "pretty format" and a compact stream format. meaning that each line would be a record, example: Currently: /usr/src/contrib/libxo/libxo % netstat --libxo json,pretty 1 { "statistics": { "interface-statistics": [ { "received-packets": 2, "received-errors": 0, "dropped-packets": 0, "received-bytes": 132, "sent-packets": 4, "send-errors": 0, "sent-bytes": 1080, "collisions": 0 }, { "received-packets": 2, "received-errors": 0, "dropped-packets": 0, "received-bytes": 132, "sent-packets": 6, "send-errors": 0, "sent-bytes": 1964, "collisions": 0 }, { "received-packets": 1, "received-errors": 0, "dropped-packets": 0, "received-bytes": 66, "sent-packets": 4, "send-errors": 0, "sent-bytes": 1048, "collisions": 0 Later we might want to support something like this: /usr/src/contrib/libxo/libxo % netstat --libxo json,ld 1 { "statistics": { "interface-statistics": [ { "received-packets": 2, "received-errors": 0, "dropped-packets": 0, "received-bytes": 132, "sent-packets": 4, "send-errors": 0, "sent-bytes": 1080, "collisions": 0 }, { "received-packets": 2, "received-errors": 0, "dropped-packets": 0, "received-bytes": 132, "sent-packets": 6, "send-errors": 0, "sent-bytes": 1964, "collisions": 0 }, { "received-packets": 1, "received-errors": 0, "dropped-packets": 0, "received-bytes": 66, "sent-packets": 4, "send-errors": 0, "sent-bytes": 1048, "collisions": 0 } Let me know what you think. -Alfred