Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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
264  end_time = ktime_get()
266  cnt++
267  If consumer && Not (cnt % umber of events for writer to wake up the reader ) Then wake_up_process - Wake up a specific process*@p: The process to be woken up.* Attempt to wake up the nominated process and move it to the set of runnable* processes.* Return: 1 if the process was woken up, 0 if it was already running.
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
293  wake_up_process - Wake up a specific process*@p: The process to be woken up.* Attempt to wake up the nominated process and move it to the set of runnable* processes.* Return: 1 if the process was woken up, 0 if it was already running.
294  wait_for_completion: - waits for completion of a task*@x: holds the state of this particular completion* This waits to be signaled for completion of a specific task. It is NOT* interruptible and there is no timeout.* See also similar routines (i
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)
338  do_div() is NOT a C function(time, USEC_PER_MSEC)
339  If time Then hit /= time
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
353  If time Then missed /= time
356  trace_printk("Total iterations per millisec: %ld\n", hit + missed)
360  If Not (hit + missed) Then
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)
Caller
NameDescribe
ring_buffer_producer_thread