Re: circular log buffer
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