• 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: limiting CPU usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: limiting CPU usage


  • Subject: Re: limiting CPU usage
  • From: "Gammah Radiation" <email@hidden>
  • Date: Fri, 30 Nov 2007 11:00:48 -0600

I think the correct API to use would be the BSD setpriority() call,
which is similar to nice-ing a process. This would not limit the CPU
usage your daemon would see to always less than some percentage, but
would make sure that it's priority is lower than other processes in
the system.

I suppose the very hackerish way would be to sleep between images, but
that seems kinda dumb.

On Nov 30, 2007 10:36 AM, Alexander Cohen <email@hidden> wrote:
>
> On 30-Nov-07, at 9:41 AM, Thomas Davie wrote:
>
> >
> > On 30 Nov 2007, at 13:53, Alexander Cohen wrote:
> >
> >> Is it possible to limit an apps CPU usage to under a certain
> >> percentage using cocoa?
> >
> > Someone may want to correct me, but I'm pretty sure that that goes
> > against the way the scheduler works -- if there's spare CPU and
> > something can use it, it will give it.
> >
> > What you can do, is use nice to lower your priority in the scheduler.
>
> In that case, maybe you have an idea for me. I have a daemon that runs
> and indexes all the images on a system. For each image, it needs to
> open it up, get some info, close it and store that info. This is very
> CPU consuming and can pretty much bring the system to a halt after a
> while.
>
> thanks
>
> AC
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >limiting CPU usage (From: Alexander Cohen <email@hidden>)
 >Re: limiting CPU usage (From: Thomas Davie <email@hidden>)
 >Re: limiting CPU usage (From: Alexander Cohen <email@hidden>)

  • Prev by Date: Overriding the new inter-cell navigation of NSTableView
  • Next by Date: NSWindow styleMask warning on bit 0x10
  • Previous by thread: Re: limiting CPU usage
  • Next by thread: Re: limiting CPU usage
  • Index(es):
    • Date
    • Thread