Displaying 16 results from an estimated 16 matches for "bufferarray".
2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...we're already doing our own buffering.
+ ///
+ raw_ostream *TheStream;
+
+ /// DeleteStream - Do we need to delete TheStream in the
+ /// destructor?
+ ///
+ bool DeleteStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ size_t BufferSize;
+
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// printLog - Dump the contents of the buffer to Stream.
+ ///
+ void printLog(void) {
+ TheStream->write(BufferArray...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...we're already doing our own buffering.
+ ///
+ raw_ostream *TheStream;
+
+ /// DeleteStream - Do we need to delete TheStream in the
+ /// destructor?
+ ///
+ bool DeleteStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ size_t BufferSize;
+
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// printLog - Dump the contents of the buffer to Stream.
+ ///
+ void printLog(void) {
+ TheStream->write(BufferArray...
2009 Dec 16
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...gt;>
>> I want a patch that does one thing (e.g. implements dbgs(),
>
> Ok, let's start with that. Here's the patch to add the circular raw_ostream.
This idea of the patch makes sense to me, but here are a few questions:
+ int BufferSize;
+ std::vector<char> BufferArray;
+ bool DelayOutput;
+ std::vector<char>::iterator Cur;
Please doxygenify these.
Instead of using a std::vector for BufferArray, please just new[] an array since it is fixed size.
Why is BufferSize needed with the vector? Isn't it always the size of BufferArray? Also, why is it...
2009 Dec 21
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...e're already doing our own buffering.
+ ///
+ raw_ostream *TheStream;
+
+ /// OwnsStream - Are we responsible for managing the underlying
+ /// stream?
+ ///
+ bool OwnsStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ size_t BufferSize;
+
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// flushBuffer - Dump the contents of the buffer to Stream.
+ ///
+ void flushBuffer(void) {
+ // Write the older portio...
2009 Dec 16
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Wednesday 16 December 2009 13:19, Chris Lattner wrote:
> + int BufferSize;
> + std::vector<char> BufferArray;
> + bool DelayOutput;
> + std::vector<char>::iterator Cur;
>
> Please doxygenify these.
Ok.
> Instead of using a std::vector for BufferArray, please just new[] an array
> since it is fixed size.
Ok.
> Why is BufferSize needed with the vector? Isn't it alway...
2009 Dec 19
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...underlying stream will be errs() which is already unbuffered.
Might circular_raw_ostream be used with other streams at some point?
> > + /// printLog - Dump the contents of the buffer to Stream.
> > + ///
> > + void printLog(void) {
> > + TheStream->write(BufferArray, BufferSize);
> > + Cur = BufferArray;
> > + }
>
> If the buffer has circled around, won't this print it out-of-order?
> If the current pointer is 5 and the length is 10, it seems like this
> should do a write([5..9]) then write([0..4])?
Aha! Good catch. This...
2009 Dec 17
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...we're already doing our own buffering.
+ ///
+ raw_ostream *TheStream;
+
+ /// DeleteStream - Do we need to delete TheStream in the
+ /// destructor?
+ ///
+ bool DeleteStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ unsigned BufferSize;
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// printLog - Dump the contents of the buffer to Stream.
+ ///
+ void printLog(void) {
+ TheStream->write(BufferArray...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Friday 18 December 2009 13:53, David Greene wrote:
> > > + void releaseStream() {
> > > + // Delete the stream if needed. Otherwise, transfer the buffer
> > > + // settings from this raw_ostream back to the underlying stream.
> > > + if (!TheStream)
> > > + return;
> > > + if (DeleteStream)
> > > +
2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...we're already doing our own buffering.
+ ///
+ raw_ostream *TheStream;
+
+ /// DeleteStream - Do we need to delete TheStream in the
+ /// destructor?
+ ///
+ bool DeleteStream;
+
+ /// BufferSize - The size of the buffer in bytes.
+ ///
+ size_t BufferSize;
+
+ /// BufferArray - The actual buffer storage.
+ ///
+ char *BufferArray;
+
+ /// Cur - Pointer to the current output point in BufferArray.
+ ///
+ char *Cur;
+
+ /// printLog - Dump the contents of the buffer to Stream.
+ ///
+ void printLog(void) {
+ TheStream->write(BufferArray...
2009 Dec 21
3
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...power and the knowledge to set the streams up correctly when the streams are created.
> + /// flushBuffer - Dump the contents of the buffer to Stream.
> + ///
> + void flushBuffer(void) {
> + // Write the older portion of the buffer.
> + TheStream->write(Cur, BufferArray + BufferSize - Cur);
> + // Write the newer portion of the buffer.
> + TheStream->write(BufferArray, Cur - BufferArray);
> + Cur = BufferArray;
> + }
Is this correct in the case when the circular buffer hasn't completely filled yet?
> +void circular_raw_os...
2009 Dec 18
4
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...am, unsigned BuffSize = 8192,
> > + bool Delete = false)
> > + : raw_ostream(/*unbuffered*/true),
> > + TheStream(0),
> > + DeleteStream(PRESERVE_STREAM),
> > + BufferSize(BuffSize),
> > + BufferArray(0) {
> > + if (BufferSize > 0)
> > + BufferArray = new char[BufferSize];
>
> How about just asserting that BufferSize is not zero? This stream won't
> work well and doesn't make sense with a buffer of zero.
Sure it does. In fact it's crucial for ma...
2009 Dec 21
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...eam. It seems a bit wasteful to do buffering on
both streams.
> > + /// flushBuffer - Dump the contents of the buffer to Stream.
> > + ///
> > + void flushBuffer(void) {
> > + // Write the older portion of the buffer.
> > + TheStream->write(Cur, BufferArray + BufferSize - Cur);
> > + // Write the newer portion of the buffer.
> > + TheStream->write(BufferArray, Cur - BufferArray);
> > + Cur = BufferArray;
> > + }
>
> Is this correct in the case when the circular buffer hasn't completely
> filled...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...ostream(raw_ostream &Stream, unsigned BuffSize = 8192,
> + bool Delete = false)
> + : raw_ostream(/*unbuffered*/true),
> + TheStream(0),
> + DeleteStream(PRESERVE_STREAM),
> + BufferSize(BuffSize),
> + BufferArray(0) {
> + if (BufferSize > 0)
> + BufferArray = new char[BufferSize];
How about just asserting that BufferSize is not zero? This stream won't work well and doesn't make sense with a buffer of zero.
>
> + void setStream(raw_ostream &Stream, bool Delete =...
2009 Dec 16
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Tuesday 15 December 2009 23:02, Chris Lattner wrote:
> On Dec 15, 2009, at 6:33 PM, David Greene wrote:
> > On Tuesday 15 December 2009 20:11, Chris Lattner wrote:
> >> Please send complete and minimal patches to avoid wasting reviewer's
> >> time,
> >
> > What do you want, complete or minimal? I don't want to pre-send 50
> > or so patches
2009 Dec 19
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...o fiddle
with the underlying buffering of TheStream. In the dbgs() use case,
the underlying stream will be errs() which is already unbuffered.
>
> + /// printLog - Dump the contents of the buffer to Stream.
> + ///
> + void printLog(void) {
> + TheStream->write(BufferArray, BufferSize);
> + Cur = BufferArray;
> + }
If the buffer has circled around, won't this print it out-of-order?
If the current pointer is 5 and the length is 10, it seems like this
should do a write([5..9]) then write([0..4])?
> + /// current_pos - Return the current p...
2009 Dec 16
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Dec 15, 2009, at 6:33 PM, David Greene wrote:
> On Tuesday 15 December 2009 20:11, Chris Lattner wrote:
>
>> Please send complete and minimal patches to avoid wasting reviewer's
>> time,
>
> What do you want, complete or minimal? I don't want to pre-send 50
> or so patches (one per source file) that simply change errs() to dbgs().
> Thus I thought I