James Kuszmaul | b3fb78a | 2024-05-09 15:35:29 -0700 | [diff] [blame^] | 1 | #include "aos/ipc_lib/memory_estimation.h" |
| 2 | |
| 3 | #include "aos/ipc_lib/memory_mapped_queue.h" |
| 4 | namespace aos::ipc_lib { |
| 5 | size_t TotalSharedMemoryUsage(const aos::Configuration *config, |
| 6 | const aos::Node *node) { |
| 7 | size_t total_size = 0; |
| 8 | for (const aos::Channel *channel : *CHECK_NOTNULL(config->channels())) { |
| 9 | if (aos::configuration::ChannelIsReadableOnNode(channel, node)) { |
| 10 | total_size += |
| 11 | LocklessQueueMemorySize(MakeQueueConfiguration(config, channel)); |
| 12 | } |
| 13 | } |
| 14 | return total_size; |
| 15 | } |
| 16 | } // namespace aos::ipc_lib |