[procps] Re: newlib stat interface

  • From: Craig Small <csmall@xxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Mon, 09 May 2016 12:16:38 +0000

Hi Jim,
 I have commited the changes. They look good and I agree its nice there
isn't that magic end flag anymore.  I been toying around with fixing vmstat
and using the reap, but how do the deltas work? I'm getting zeros for the
first set which means it doesn't look too good.

vmstat basically has something like

print_initial_stuff()
for something:
  print_delta_stuff()

the problem is im getting zeros for the first line. Do you have to use both
the normal statistic and the delta? something like
reap_stats
print_normal_stats()
for something:
  print_delta_stats()
in other words i need to specify both the normal stat and the delta? What I
mean for example is to fetch both
PROCPS_STAT_TIC_USER and PROCPS_STAT_TIC_DELTA_USER and print the first for
the first row and the second for the second row?

 - Craig


On Sun, May 8, 2016 at 5:39 AM Jim Warner <james.warner@xxxxxxxxxxx> wrote:

On 04/26/2016 07:43 AM, Craig Small wrote:
I have pushed those patches across. Don't hurry the rework, its been
a while anyhow and it best to cook it right.

Hi Craig,

Whew, I think I'm finally done.

I've tried to hide most every implementation detail from potential
users. In this way the ABI was made much more robust. We can now alter
any of the exposed structures without breaking the binary interface
since none are embedded in an array. The results struct is, of course,
already immune to size changes.

Additionally the learning curve was made much less steep. Gone are the
'allocate' or 'fill' type functions, with their occasional confusing
need for a priming 'read'. The only accessors are 'get' (a single item),
'select' (multiple items) and 'reap' (multiple items returning a
variable number of objects).

This redesign pioneers the use of dynamic items lists without the need
to ever 'reset'. Perhaps this feature should be incorporated in the
<pids> interface too. Then its 'new' function would be the same as all
the others.

Maybe the <diskstat>, <meminfo>, <slab> and <vmstat> interfaces could be
patterned after this new API as well. Of course, not all need a 'reap'
function. But at the least we should remove those 'stack_end'
enumerators from <meminfo> and <slab>. They make it impossible to add a
new enum in the future without breaking the binary interface.

And if those interfaces were to follow the <stat> example, imagine the
user benefits. Once a single API was mastered, all of the others would
be a cake walk.

Anyway, the attached 5 patches are for newlib. They include 2 changes
unrelated to <stat> and, as usual, the commit messages contain
additional background.

If you have any questions, I'd be happy to try and answer them.

If not, then thanks in advance for the push.

Regards,
Jim

p.s. The vmstat '-m' output (even before these patches) is very unlike
the master branch version. I don't know when/why the output got
reordered. Sorry I can't offer a solution (because the code makes my
head hurt).

-- 
Craig Small (@smallsees)   http://enc.com.au/       csmall at : enc.com.au
Debian GNU/Linux           http://www.debian.org/   csmall at : debian.org
GPG fingerprint:        5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5

Other related posts: