函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\ring_buffer_benchmark.c Create Date:2022-07-27 13:02:02
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:ring_buffer_producer

函数原型:static void ring_buffer_producer(void)

返回类型:void

参数:

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  循环
253 i小于write_iteration循环
255  如果非event
256  missed自加
257  否则
264  end_time等于ktime_get()
266  cnt自加
267  如果consumer且非cntumber of events for writer to wake up the reader 的模则唤醒中断线程
280  如果cnt取模umber of events for writer to wake up the reader cond_resched()
283 时间比较且非break_test()循环
284  trace_printk("End ring buffer hammer\n")
286  如果consumer
288  init_completion( & read_start)
289  init_completion( & read_done)
291  smp_wmb()
292  reader_finish等于1
293  唤醒中断线程
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  如果test_errortrace_printk("ERROR!\n")
305  如果非disable_reader
306  如果consumer_fifo小于0则trace_printk("Running Consumer at nice: %d\n", consumer_nice)
309  否则trace_printk("Running Consumer at SCHED_FIFO %d\n", consumer_fifo)
313  如果producer_fifo小于0则trace_printk("Running Producer at nice: %d\n", producer_nice)
316  否则trace_printk("Running Producer at SCHED_FIFO %d\n", producer_fifo)
321  如果producer_fifo小于0且consumer_fifo小于0且producer_nice恒等于MAX_NICEconsumer_nice恒等于MAX_NICEtrace_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  如果disable_readertrace_printk("Read: (reader disabled)\n")
329  否则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  如果timehit除等于time
341  否则trace_printk("TIME IS ZERO??\n")
344  trace_printk("Entries per millisec: %ld\n", hit)
346  如果hit
348  avg等于NSEC_PER_MSEChit
349  trace_printk("%ld ns per entry\n", avg)
352  如果missed
353  如果timemissed除等于time
356  trace_printk("Total iterations per millisec: %ld\n", hit + missed)
360  如果非hitmissed的和则
361  trace_printk("hit + missed overflowed and totalled zero!\n")
362  hit自减
366  avg等于NSEC_PER_MSEChitmissed的和
367  trace_printk("%ld ns per entry\n", avg)
调用者
名称描述
ring_buffer_producer_thread