| 1 | #include <nightmare/nightmare.h> |
|---|---|
| 2 | #include <smp/percpu.h> |
| 3 | |
| 4 | #ifdef TEST_NIGHTMARE_ENABLED |
| 5 | PERCPU_DECLARE(nightmare_progress_store, struct nightmare_progress_counter, |
| 6 | NULL); |
| 7 | PERCPU_EXPORT_AS(nightmare_progress, nightmare_progress_store); |
| 8 | |
| 9 | uint64_t nightmare_progress_sum_irq(void) { |
| 10 | uint64_t sum = 0; |
| 11 | struct nightmare_progress_counter *counter; |
| 12 | percpu_for_each(nightmare_progress, counter) sum += |
| 13 | atomic_load_explicit(&counter->count, memory_order_relaxed); |
| 14 | return sum; |
| 15 | } |
| 16 | #endif |
| 17 |