ring-buffer: Move the add_timestamp into its own function

Make a helper function rb_add_timestamp() that moves the adding of the
extended time stamps into its own function. Also, remove the noinline and
inline for the functions it calls, as recent benchmarks appear they do not
make a difference (just let gcc decide).
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 58fbc3c6
...@@ -2596,8 +2596,8 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2596,8 +2596,8 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
return NULL; return NULL;
} }
/* Slow path, do not inline */ /* Slow path */
static noinline struct ring_buffer_event * static struct ring_buffer_event *
rb_add_time_stamp(struct ring_buffer_event *event, u64 delta, bool abs) rb_add_time_stamp(struct ring_buffer_event *event, u64 delta, bool abs)
{ {
if (abs) if (abs)
...@@ -2628,7 +2628,7 @@ static inline bool sched_clock_stable(void) ...@@ -2628,7 +2628,7 @@ static inline bool sched_clock_stable(void)
} }
#endif #endif
static noinline void static void
rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer, rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
struct rb_event_info *info) struct rb_event_info *info)
{ {
...@@ -2648,6 +2648,21 @@ rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2648,6 +2648,21 @@ rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
"or add trace_clock=global to the kernel command line\n"); "or add trace_clock=global to the kernel command line\n");
} }
static void rb_add_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event **event,
struct rb_event_info *info,
u64 *delta,
unsigned int *length)
{
bool abs = info->add_timestamp &
(RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE);
rb_check_timestamp(cpu_buffer, info);
*event = rb_add_time_stamp(*event, info->delta, abs);
*length -= RB_LEN_TIME_EXTEND;
*delta = 0;
}
/** /**
* rb_update_event - update event type and data * rb_update_event - update event type and data
* @cpu_buffer: The per cpu buffer of the @event * @cpu_buffer: The per cpu buffer of the @event
...@@ -2671,15 +2686,8 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -2671,15 +2686,8 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer,
* If we need to add a timestamp, then we * If we need to add a timestamp, then we
* add it to the start of the reserved space. * add it to the start of the reserved space.
*/ */
if (unlikely(info->add_timestamp)) { if (unlikely(info->add_timestamp))
bool abs = info->add_timestamp & rb_add_timestamp(cpu_buffer, &event, info, &delta, &length);
(RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE);
rb_check_timestamp(cpu_buffer, info);
event = rb_add_time_stamp(event, abs ? info->delta : delta, abs);
length -= RB_LEN_TIME_EXTEND;
delta = 0;
}
event->time_delta = delta; event->time_delta = delta;
length -= RB_EVNT_HDR_SIZE; length -= RB_EVNT_HDR_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment