• 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: circular log buffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: circular log buffer


  • Subject: Re: circular log buffer
  • From: Marc Majka <email@hidden>
  • Date: Wed, 01 Dec 2010 14:37:11 -0800

Although I haven't actually tested this, I suspect you'll get better for performance using asl_free() when you dump them, and asl_new() to create them.   It would be possible to just asl_set() to change existing values, but asl_set() does too much mucking around in the data structure.  Changing keys and values may be slower than just starting with a new aslmsg.  If you are leaving most of the key/value pairs unchanged, then it *might* pay off to re-use them, but you'd have to do a test to see which does a better job.

BTW, the aslmsg internals are getting some streamlining for improved performance.  Something to look forward to in Lion!

-- Marc

On 1 Dec, 2010, at 02:26, Joel Reymont wrote:


On Dec 1, 2010, at 12:13 AM, Marc Majka wrote:

What OS version is this on, and how much is getting logged?

10.6.4 I think.

If it's sufficient to maintain a circular queue of messages internal to your app, you could allocate an array of aslmsg structures:

This would be my preferred option.

   asl_circular_queue = (aslmsg *)calloc(CIRCULAR_QUEUE_SIZE, sizeof(aslmsg));

and use asl_new() / asl_set() to make messages.  Then hold them in the array

   asl_circular_queue[cursor] = new_msg;
   cursor = (cursor + 1) % CIRCULAR_QUEUE_SIZE;

Do I need to asl_new/asl_free for every asl_set or can a message allocated with asl_new be reused multiple times?

Thanks, Joel

---
http://twitter.com/wagerlabs


 _______________________________________________
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

References: 
 >Re: circular log buffer (From: Joel Reymont <email@hidden>)

  • Prev by Date: Re: circular log buffer
  • Next by Date: desktop replacement OS; Darwin/Webkit project
  • Previous by thread: Re: circular log buffer
  • Next by thread: desktop replacement OS; Darwin/Webkit project
  • Index(es):
    • Date
    • Thread