lkml.org 
[lkml]   [2011]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/5] trace: Add ring buffer stats to measure rate of events
On Fri, Jul 29, 2011 at 11:10 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 2011-07-26 at 15:59 -0700, Vaibhav Nagarnaik wrote:
>> The stats file under per_cpu folder provides the number of entries,
>> overruns and other statistics about the CPU ring buffer. However, the
>> numbers do not provide any indication of how full the ring buffer is in
>> bytes compared to the overall size in bytes. Also, it is helpful to know
>> the rate at which the cpu buffer is filling up.
>>
>> This patch adds an entry "bytes: " in printed stats for per_cpu ring
>> buffer which provides the actual bytes consumed in the ring buffer. This
>> field includes the number of bytes used by recorded events and the
>> padding bytes added when moving the tail pointer to next page.
>>
>> It also adds the following time stamps:
>> "head ts:" - the oldest timestamp in the ring buffer
>
>
> I hate the name of "head_ts", as it really is meaningless. The head of
> our ring buffer is indeed the oldest events, but other ring buffers have
> head as the newest. This is an internal name that should not be used
> outside of the ring buffer code itself. Maybe call it "oldest_ts", or
> even more verbose (and what it actually is), "oldest_event_ts".
>
>
>> "now ts:"  - the timestamp at the time of reading
>>
>> The field "now ts" provides a consistent time snapshot to the userspace
>> when being read. This is read from the same trace clock used by tracing
>> event timestamps.
>>
>> Together, these values provide the rate at which the buffer is filling
>> up, from the formula:
>> bytes / (now_ts - head_ts)
>>
>> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
>> ---
>
>>  /**
>> + * ring_buffer_head_ts - get the oldest event timestamp from the buffer
>> + * @buffer: The ring buffer
>> + * @cpu: The per CPU buffer to read from.
>> + */
>> +unsigned long ring_buffer_head_ts(struct ring_buffer *buffer, int cpu)
>
> Hence, replace head_ts, with something else here.
>
> Thanks,
>
> -- Steve
>

'oldest_event_ts' sounds good.


Vaibhav Nagarnaik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-07-29 21:13    [from the cache]
©2003-2011 Jasper Spaans