Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146102
b: refs/heads/master
c: 6634ff2
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 6, 2009
1 parent 392cbef commit 7600c7f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00c81a58c5b4e0de14ee33bfbc3d71c90f69f9ea
refs/heads/master: 6634ff26cce2da04e5c2a5481bcb8888e7d01786
89 changes: 49 additions & 40 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,51 +1154,18 @@ static unsigned rb_calculate_event_length(unsigned length)
return length;
}


static struct ring_buffer_event *
__rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
unsigned type, unsigned long length, u64 *ts)
rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
unsigned long length, unsigned long tail,
struct buffer_page *commit_page,
struct buffer_page *tail_page, u64 *ts)
{
struct buffer_page *tail_page, *head_page, *reader_page, *commit_page;
struct buffer_page *next_page;
unsigned long tail, write;
struct buffer_page *next_page, *head_page, *reader_page;
struct ring_buffer *buffer = cpu_buffer->buffer;
struct ring_buffer_event *event;
unsigned long flags;
bool lock_taken = false;

commit_page = cpu_buffer->commit_page;
/* we just need to protect against interrupts */
barrier();
tail_page = cpu_buffer->tail_page;
write = local_add_return(length, &tail_page->write);
tail = write - length;

/* See if we shot pass the end of this buffer page */
if (write > BUF_PAGE_SIZE)
goto next_page;

/* We reserved something on the buffer */

if (RB_WARN_ON(cpu_buffer, write > BUF_PAGE_SIZE))
return NULL;

event = __rb_page_index(tail_page, tail);
rb_update_event(event, type, length);

/* The passed in type is zero for DATA */
if (likely(!type))
local_inc(&tail_page->entries);

/*
* If this is a commit and the tail is zero, then update
* this page's time stamp.
*/
if (!tail && rb_is_commit(cpu_buffer, event))
cpu_buffer->commit_page->page->time_stamp = *ts;

return event;

next_page:
unsigned long flags;

next_page = tail_page;

Expand Down Expand Up @@ -1318,6 +1285,48 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
return NULL;
}

static struct ring_buffer_event *
__rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
unsigned type, unsigned long length, u64 *ts)
{
struct buffer_page *tail_page, *commit_page;
struct ring_buffer_event *event;
unsigned long tail, write;

commit_page = cpu_buffer->commit_page;
/* we just need to protect against interrupts */
barrier();
tail_page = cpu_buffer->tail_page;
write = local_add_return(length, &tail_page->write);
tail = write - length;

/* See if we shot pass the end of this buffer page */
if (write > BUF_PAGE_SIZE)
return rb_move_tail(cpu_buffer, length, tail,
commit_page, tail_page, ts);

/* We reserved something on the buffer */

if (RB_WARN_ON(cpu_buffer, write > BUF_PAGE_SIZE))
return NULL;

event = __rb_page_index(tail_page, tail);
rb_update_event(event, type, length);

/* The passed in type is zero for DATA */
if (likely(!type))
local_inc(&tail_page->entries);

/*
* If this is a commit and the tail is zero, then update
* this page's time stamp.
*/
if (!tail && rb_is_commit(cpu_buffer, event))
cpu_buffer->commit_page->page->time_stamp = *ts;

return event;
}

static int
rb_add_time_stamp(struct ring_buffer_per_cpu *cpu_buffer,
u64 *ts, u64 *delta)
Expand Down

0 comments on commit 7600c7f

Please sign in to comment.