• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getrusage only partially working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getrusage only partially working?


  • Subject: Re: getrusage only partially working?
  • From: Mike Fischer <email@hidden>
  • Date: Wed, 12 Dec 2007 09:21:47 +0100

Hi Terry,


Am 12.12.2007 um 03:27 schrieb Terry Lambert:

On Dec 11, 2007, at 7:26 AM, Mike Fischer wrote:
Hi!

For some reason I can't seem to get getrusage(2) to work the way I expect it to under 10.4.11 on a PPC G5 machine (haven't tested on other machines).

I expected the memory related fields to show values other than 0 which more or less correlate with the actual memory usage of the application. But what I am seeing is values of 0 only in each of these fields (ru_maxrss, ru_ixrss, ru_idrss, ru_isrss).

Probably I'm doing something wrong, but what?

Most of the information you are requesting in Mac information, and you are requesting it using a BSD API.

Generally I don't see anything wrong with that. Why wouldn't I call BSD APIs in a command line tool? (Also your sentence structure is not entirely clear to me so I may be missing some of the meaning here?)



The BSD API idea of the information will not be updated until the process exits (see xnu/bsd/kern/kern_exit.c:proc_exit()).

Err, in that case how would the call ever work with the given option RUSAGE_SELF? Seems like a chicken and egg problem to me: the info is updated when the process exits but since the process has exited it can't call getrusage any more. At the very least the man page could be a bit more clear about this.



If you want this information while the process is running, you're going to need link against the whole kernel and use unsupported APIs.

No thanks, I don't want the info that badly ;-) I was just experimenting to see if I could access similar values to what top(1) or Activity Monitor report inside my application. And since they can do this while my app is running I thought the process itself should be able to as well.



Needless to say, this will end up being rather expensive, which is why we don't export them via BSD in the first place.

Yeah, that makes sense. But given the documentation of getrusage my expectations where different.


Should I file a bug? If so, against getrusage or its documentation?


Thanks! Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Note: I read this list in digest mode! Send me a private copy for faster responses.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: getrusage only partially working?
      • From: Terry Lambert <email@hidden>
References: 
 >getrusage only partially working? (From: Mike Fischer <email@hidden>)
 >Re: getrusage only partially working? (From: Terry Lambert <email@hidden>)

  • Prev by Date: Re: getrusage only partially working?
  • Next by Date: Re: getrusage only partially working?
  • Previous by thread: Re: getrusage only partially working?
  • Next by thread: Re: getrusage only partially working?
  • Index(es):
    • Date
    • Thread