You need syntax or "transport", and then you need semantics. My approach
is identical to XML except it doesn't give you kilobytes of human-unreadable
text.
You could use text, with binary you save the extra conversions along with
errors from parsers or bad use of sscanf()/sprintf()/... K.I.S.S. :)
I see a good point in using one-value-files though, except I think there's
some type information missing.
>
>
> > It eats CPU, it's error-prone, and all in all it's just "wrong".
>
> How much of your CPU time is spent parsing /proc files?
[albatros:joe] $ time vmstat 1
procs memory swap io system cpu
r b w swpd free buff cache si so bi bo in cs us sy id
0 0 0 113908 3184 1892 130584 1 1 3 3 61 43 9 5 86
1 0 0 113908 3064 1896 130700 0 0 8 0 2301 1148 8 2 90
0 0 0 113908 3064 1896 130700 0 0 0 0 2026 893 7 2 91
0 0 0 113908 3064 1896 130700 0 0 0 0 1877 829 3 4 93
0 0 0 113908 3068 1896 130696 0 0 0 0 1946 942 5 3 92
0 0 0 113908 3072 1896 130696 0 0 0 0 2009 1034 7 5 88
0 0 0 113908 3064 1896 130704 0 0 0 0 3706 2336 4 5 90
0 0 0 113908 3064 1900 130688 0 0 0 0 2341 1671 10 3 87
0 0 0 113908 3064 1900 130736 0 0 0 0 2431 1869 15 5 79
2 0 0 113908 3064 1900 130764 0 0 0 88 2346 1440 12 3 85
^C
real 0m9.486s
user 0m0.070s
sys 0m0.120s
[albatros:joe] $
A *very* simple program (top is probably a lot worse!) uses 1% on my Dual 1.4
GHz Athlon.
Those TEN lines of status output cost me 336 MILLION clock cycles.
>
>
> > However - having a human-readable /proc that you can use directly with
> > cat, echo, your scripts, simple programs using read(), etc. is
> > absolutely a *very* cool feature that I don't want to let go. It is just
> > too damn practical.
>
> You shouldn't use them in scripts because they are likely to break. That's
> the whole point. At least not when you want to distribute the scripts to
> others. And BTW the one-value-files are much easier to parse for scripts than
> any other solution that I have seen so far, including the current /proc
> interface.
I agree that there's some really good points in using single-value files.
-- ................................................................ : jakob@unthought.net : And I see the elder races, : :.........................: putrid forms of man : : Jakob Østergaard : See him rise and claim the earth, : : OZ9ABN : his downfall is at hand. : :.........................:............{Konkhra}...............: - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/