MCPcopy Create free account
hub / github.com/F-Stack/f-stack / writer_run

Function writer_run

dpdk/app/test/test_seqlock.c:35–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#define WRITER_INTERRUPT_TIME 1 /* us */
34
35static int
36writer_run(void *arg)
37{
38 struct data *data = arg;
39 uint64_t deadline;
40
41 deadline = rte_get_timer_cycles() +
42 WRITER_RUNTIME * rte_get_timer_hz();
43
44 while (rte_get_timer_cycles() < deadline) {
45 bool interrupted;
46 uint64_t new_value;
47 unsigned int delay;
48
49 new_value = rte_rand();
50
51 interrupted = rte_rand_max(INTERRUPTED_WRITER_FREQUENCY) == 0;
52
53 rte_seqlock_write_lock(&data->lock);
54
55 data->c = new_value;
56 data->b = new_value;
57
58 if (interrupted)
59 rte_delay_us_block(WRITER_INTERRUPT_TIME);
60
61 data->a = new_value;
62
63 rte_seqlock_write_unlock(&data->lock);
64
65 delay = rte_rand_max(WRITER_MAX_DELAY);
66
67 rte_delay_us_block(delay);
68 }
69
70 return TEST_SUCCESS;
71}
72
73#define INTERRUPTED_READER_FREQUENCY 1000
74#define READER_INTERRUPT_TIME 1000 /* us */

Callers 1

test_seqlockFunction · 0.85

Calls 3

rte_randFunction · 0.85
rte_rand_maxFunction · 0.85
rte_delay_us_blockFunction · 0.85

Tested by

no test coverage detected