[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resource tracking



Eric,

I'd like to add code to MiNT to support more resource tracking than is
currently implemented.

There's currently room in the rusage structure for three more
elements.  BSD's rusage has many more elements than we have room for.
Many of these are related to things MiNT doesn't know about (paging
and virtual memory related things) but there's a possibility we'll be
able to track more than 3 new things with relative simplicity.  The
three simplest I can think of, which have almost no overhead are
number of signals received, and number of voluntary & involuntary
context switches.

I will probably send you a patch to track these three resources in a
day or two.  But this brings up the question of what we do if we want
to track more resources in the future, since there will be no more
room in the rusage structure?

I can think of several ways of dealing with this:

- Leave those three elements of the structure reserved in case we
  really need to track a specific resource later on.
  (I'm not personally fond of this one, but it's certainly a
  possiblity).

- Expand the defined rusage structure size now, and give people some
  time to recompile any existing applications that rely on the size of
  this structure.  Then, at some point in the future, actually fill in
  the structure more fully.  (Again, not a great idea IMHO).

- Add new system calls Prusage2() and Pwaitpid2() that take an
  additional parameter to be filled with any new resource tracking
  information.  (OK, but kind of crufty.)

- Add a new system call, Prusagelen(n), to inform MiNT that we are
  able to cope with 'n' rusage elements. (One of the better ideas, i
  think)

- Add a new system call, Paware(v), to inform MiNT that we are aware
  of any features added in MiNT up to and including version 'v' where
  'v' is a number in the same format as the __mint variable.  Then
  if and when the rusage size is expanded, applications that want the
  extra information (or any new but backwards-incompatible feature)
  can declare that they are capable of dealing with this new feature
  by claiming to be compatible with that version of MiNT.

What do you think?

--
entropy -- it's not just a good idea, it's the second law.
Personal mail:      entropy@gnu.ai.mit.edu
MiNT library mail:  entropy@terminator.rs.itd.umich.edu