Function report |
Source Code:kernel\trace\ring_buffer_benchmark.c |
Create Date:2022-07-28 11:56:24 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:ring_buffer_producer
Proto:static void ring_buffer_producer(void)
Type:void
Parameter:Nothing
236 | missed = 0 |
237 | hit = 0 |
239 | cnt = 0 |
245 | trace_printk("Starting ring buffer hammer\n") |
246 | start_time = ktime_get() |
247 | timeout = Add a ktime_t variable and a scalar nanosecond value.* res = kt + nsval:(start_time, un time and sleep time in seconds * NSEC_PER_SEC) |
248 | Do |
253 | When i < write_iteration cycle |
255 | If Not event Then |
256 | missed++ |
257 | Else |
266 | cnt++ |
280 | If cnt % umber of events for writer to wake up the reader Then cond_resched() |
283 | When ktime_before - Compare if a ktime_t value is smaller than another one.*@cmp1: comparable1*@cmp2: comparable2* Return: true if cmp1 happened before cmp2. && Not break_test() cycle |
284 | trace_printk("End ring buffer hammer\n") |
286 | If consumer Then |
288 | init_completion( & read_start) |
289 | init_completion( & read_done) |
291 | smp_wmb() |
292 | reader_finish = 1 |
297 | time = ktime_us_delta(end_time, start_time) |
299 | entries = g_buffer_entries - get the number of entries in a buffer*@buffer: The ring buffer* Returns the total number of entries in the ring buffer* (all CPU entries) |
300 | overruns = g_buffer_overruns - get the number of overruns in buffer*@buffer: The ring buffer* Returns the total number of overruns in the ring buffer* (all CPU entries) |
302 | If test_error Then trace_printk("ERROR!\n") |
305 | If Not disable_reader Then |
306 | If consumer_fifo < 0 Then trace_printk("Running Consumer at nice: %d\n", consumer_nice) |
309 | Else trace_printk("Running Consumer at SCHED_FIFO %d\n", consumer_fifo) |
313 | If producer_fifo < 0 Then trace_printk("Running Producer at nice: %d\n", producer_nice) |
316 | Else trace_printk("Running Producer at SCHED_FIFO %d\n", producer_fifo) |
321 | If producer_fifo < 0 && consumer_fifo < 0 && producer_nice == MAX_NICE && consumer_nice == MAX_NICE Then trace_printk("WARNING!!! This test is running at lowest priority.\n") |
325 | trace_printk("Time: %lld (usecs)\n", time) |
326 | trace_printk("Overruns: %lld\n", overruns) |
327 | If disable_reader Then trace_printk("Read: (reader disabled)\n") |
329 | Else trace_printk("Read: %ld (by %s)\n", read, read_events ? "events" : "pages") |
332 | trace_printk("Entries: %lld\n", entries) |
333 | trace_printk("Total: %lld\n", entries + overruns + read) |
334 | trace_printk("Missed: %ld\n", missed) |
335 | trace_printk("Hit: %ld\n", hit) |
341 | Else trace_printk("TIME IS ZERO??\n") |
344 | trace_printk("Entries per millisec: %ld\n", hit) |
346 | If hit Then |
348 | avg = NSEC_PER_MSEC / hit |
349 | trace_printk("%ld ns per entry\n", avg) |
352 | If missed Then |
356 | trace_printk("Total iterations per millisec: %ld\n", hit + missed) |
361 | trace_printk("hit + missed overflowed and totalled zero!\n") |
362 | hit-- |
366 | avg = NSEC_PER_MSEC / (hit + missed) |
367 | trace_printk("%ld ns per entry\n", avg) |
Name | Describe |
---|---|
ring_buffer_producer_thread |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |