Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2005 16:04:54 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Gleb Smirnoff <glebius@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/kern kern_mutex.c
Message-ID:  <20050410160253.J3036@fledge.watson.org>
In-Reply-To: <200504081237.17789.jhb@FreeBSD.org>
References:  <19069.1112973882@critter.freebsd.dk> <200504081237.17789.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Fri, 8 Apr 2005, John Baldwin wrote:

>>>>  Log:
>>>>  Add additional newline to debug.mutex.prof.stats header, so that
>>>>  column names are printed exactly above the columns.
>>>
>>> This is bogus, as is the existence of sysctls that format data (*).
>>>
>>> (*) Formatted output is not too bad for sysctls in the debug tree, but
>>> for general-purpose sysctls it is just a bug.
>>
>> I disagree.
>
> It's a lot easier to parse a structured binary blob than to parse 
> formatted text so that you can display it differently.  Note that I 
> would consider XML ala GEOM to be more of the blob style since the 
> whitespace isn't significant. It should be up to userland to do whatever 
> formatting of data is required. For small things like 'current 
> timecounter' or 'list of valid CPU frequencies' simple strings with 
> space delimiting is probably fine though. Trying to format complex data 
> into multiple lines with columns and headers doesn't belong in the 
> kernel outside of ddb IMO.

FWIW, I ran precisely into the "formatted text sysctl" problem recently 
when looking at adapting netstat -mb to use UMA's statistics output rather 
than mbuf-specific sysctls.  In order to extract the mbuf entries from the 
current sysctl, you have to do some text parsing and munging.  However, 
finding a useful middle ground is non-trivial.  XML is one possibility, 
but we can probably get away with something simpler.  I was chatting with 
Poul-Henning about this on Friday, and he wondered about exporting the 
column list as one sysctl, and then all of the raws separated by \t's and 
\n's in another sysctl.  It still requires a bit of text frobbing, but 
doesn't require the kernel to do the formatting, etc.

Robert N M Watson



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050410160253.J3036>