OLD | NEW |
1 // SPDX-License-Identifier: BSD-2-Clause | 1 // SPDX-License-Identifier: BSD-2-Clause |
2 | 2 |
3 #include "homa_impl.h" | 3 #include "homa_impl.h" |
4 #include "homa_interest.h" | 4 #include "homa_interest.h" |
5 #include "homa_sock.h" | 5 #include "homa_sock.h" |
6 | 6 |
7 #ifndef __STRIP__ /* See strip.py */ | 7 #ifndef __STRIP__ /* See strip.py */ |
8 #include "homa_offload.h" | 8 #include "homa_offload.h" |
9 #endif /* See strip.py */ | 9 #endif /* See strip.py */ |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 TEST_F(homa_interest, homa_interest_wait__already_ready) | 140 TEST_F(homa_interest, homa_interest_wait__already_ready) |
141 { | 141 { |
142 struct homa_interest interest; | 142 struct homa_interest interest; |
143 | 143 |
144 homa_interest_init_shared(&interest, &self->hsk); | 144 homa_interest_init_shared(&interest, &self->hsk); |
145 atomic_set(&interest.ready, 1); | 145 atomic_set(&interest.ready, 1); |
146 EXPECT_EQ(0, homa_interest_wait(&interest, 0)); | 146 EXPECT_EQ(0, homa_interest_wait(&interest, 0)); |
147 EXPECT_EQ(0, interest.blocked); | 147 EXPECT_EQ(0, interest.blocked); |
148 IF_NO_STRIP(EXPECT_EQ(1, homa_metrics_per_cpu()->fast_wakeups)); | |
149 | 148 |
150 homa_interest_unlink_shared(&interest); | 149 homa_interest_unlink_shared(&interest); |
151 } | 150 } |
152 #ifndef __STRIP__ /* See strip.py */ | 151 #ifndef __STRIP__ /* See strip.py */ |
153 TEST_F(homa_interest, homa_interest_wait__call_schedule) | 152 TEST_F(homa_interest, homa_interest_wait__call_schedule) |
154 { | 153 { |
155 struct homa_interest interest; | 154 struct homa_interest interest; |
156 | 155 |
157 homa_interest_init_shared(&interest, &self->hsk); | 156 homa_interest_init_shared(&interest, &self->hsk); |
158 | 157 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 mock_set_clock_vals(1000, 2000, 3999, 4000, 0); | 205 mock_set_clock_vals(1000, 2000, 3999, 4000, 0); |
207 mock_ns = 4000; | 206 mock_ns = 4000; |
208 unit_hook_register(notify_hook); | 207 unit_hook_register(notify_hook); |
209 hook_interest = &interest; | 208 hook_interest = &interest; |
210 hook_count = 4; | 209 hook_count = 4; |
211 | 210 |
212 EXPECT_EQ(0, -homa_interest_wait(&interest, 0)); | 211 EXPECT_EQ(0, -homa_interest_wait(&interest, 0)); |
213 #ifndef __STRIP__ /* See strip.py */ | 212 #ifndef __STRIP__ /* See strip.py */ |
214 EXPECT_EQ(3000, homa_metrics_per_cpu()->poll_ns); | 213 EXPECT_EQ(3000, homa_metrics_per_cpu()->poll_ns); |
215 EXPECT_EQ(0, homa_metrics_per_cpu()->blocked_ns); | 214 EXPECT_EQ(0, homa_metrics_per_cpu()->blocked_ns); |
216 EXPECT_EQ(0, homa_metrics_per_cpu()->fast_wakeups); | |
217 EXPECT_EQ(1, homa_metrics_per_cpu()->slow_wakeups); | |
218 EXPECT_EQ(1, interest.blocked); | 215 EXPECT_EQ(1, interest.blocked); |
219 #endif /* See strip.py */ | 216 #endif /* See strip.py */ |
220 homa_interest_unlink_shared(&interest); | 217 homa_interest_unlink_shared(&interest); |
221 } | 218 } |
222 TEST_F(homa_interest, homa_interest_wait__interrupted_by_signal) | 219 TEST_F(homa_interest, homa_interest_wait__interrupted_by_signal) |
223 { | 220 { |
224 struct homa_interest interest; | 221 struct homa_interest interest; |
225 | 222 |
226 homa_interest_init_shared(&interest, &self->hsk); | 223 homa_interest_init_shared(&interest, &self->hsk); |
227 mock_prepare_to_wait_errors = 1; | 224 mock_prepare_to_wait_errors = 1; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 per_cpu(homa_offload_core, 1).last_active = 4100; | 313 per_cpu(homa_offload_core, 1).last_active = 4100; |
317 per_cpu(homa_offload_core, 2).last_active = 4001; | 314 per_cpu(homa_offload_core, 2).last_active = 4001; |
318 per_cpu(homa_offload_core, 3).last_active = 4800; | 315 per_cpu(homa_offload_core, 3).last_active = 4800; |
319 | 316 |
320 struct homa_interest *result = homa_choose_interest(&self->hsk); | 317 struct homa_interest *result = homa_choose_interest(&self->hsk); |
321 EXPECT_EQ(3, result->core); | 318 EXPECT_EQ(3, result->core); |
322 IF_NO_STRIP(EXPECT_EQ(0, homa_metrics_per_cpu()->handoffs_alt_thread)); | 319 IF_NO_STRIP(EXPECT_EQ(0, homa_metrics_per_cpu()->handoffs_alt_thread)); |
323 INIT_LIST_HEAD(&self->hsk.interests); | 320 INIT_LIST_HEAD(&self->hsk.interests); |
324 } | 321 } |
325 #endif /* See strip.py */ | 322 #endif /* See strip.py */ |
OLD | NEW |