[procps] Re: newlib - drip, drip

  • From: Jim Warner <james.warner@xxxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Fri, 13 May 2016 07:29:26 -0500

On 05/13/2016 07:16 AM, Craig Small wrote:

Um.. yeah.
Wasn't at all because I was looking at new_format and completely missed
them at all!

Hi Craig,

Ah ha, not for contrast at all.  That's a relief.


    Anyway, why not share your experience.  Were those APIs easy to work
    with and/or what could be made better?

The best part about it is you just call select and all the stuff happens
in the background to get you want you want. No need to get the wchan
address and then run another function each time on get the function
name, its just there.

That's good to hear.


The make two arrays of enums is a little odd. I know why you do it and
its a simple shortcut but that takes a little getting used to.

Whoa, don't blame the library for your design decision.

Why not one humongous array, then pick and chose what you want later.

A little less efficient, but it's just computer cycles.


The main thing that caught me a lot was the different types. There is
nothing short of looking up the header field to work out what your
extractor do with the union. I didn't realise at first the actual and
deltas are different types and of course the compiler didn't warn me. I
got some odd values sometimes.

Yea, but still better than digging through source code trying to determine how to match an fprintf.


Made me think is there a way of somehow encoding this? Can't be done by
the program itself, its just an array of unions.

Now the library knows what is in each "row" of the stack. Could it
somehow say "this is an int" and then the program use some sort of
extractor?
You have R->results.s_int = value, could it also set R->mytype = s_int?

And then the extractor would return R->results.(r->mytype)
I'm not sure how you get mytype to come out and reference part of the
union but it might be possible.

In other words the library sets that stack row to s_int and the value
extractor looks at that field to work out what the type is.

Let's ponder that. Feels like an awful lot of extra overhead but migh be a good "choice" to offer users.

Thanks,
Jim

Other related posts: