| 1008 | } |
| 1009 | |
| 1010 | void AccessState::UpdateStats(AccessContextStats& stats) const { |
| 1011 | #if VVL_ENABLE_SYNCVAL_STATS != 0 |
| 1012 | stats.read_states += last_read_count; |
| 1013 | stats.write_states += last_write.has_value(); |
| 1014 | stats.first_accesses += first_accesses_.size(); |
| 1015 | stats.access_states_with_multiple_reads += (last_read_count > 1); |
| 1016 | stats.access_states_with_multiple_firsts += (first_accesses_.size() > 1); |
| 1017 | |
| 1018 | bool is_dynamic_allocation = false; |
| 1019 | // check if last reads allocate |
| 1020 | if (last_read_count > 1) { |
| 1021 | stats.access_states_dynamic_allocation_size += uint64_t(sizeof(ReadState) * last_read_count); |
| 1022 | is_dynamic_allocation = true; |
| 1023 | } |
| 1024 | // check if first accesses allocate |
| 1025 | if (first_accesses_.size() > first_accesses_.kSmallCapacity) { |
| 1026 | stats.access_states_dynamic_allocation_size += uint64_t(sizeof(FirstAccess) * first_accesses_.size()); |
| 1027 | is_dynamic_allocation = true; |
| 1028 | } |
| 1029 | stats.access_states_with_dynamic_allocations += is_dynamic_allocation; |
| 1030 | stats.max_first_accesses_size = std::max(stats.max_first_accesses_size, (uint32_t)first_accesses_.size()); |
| 1031 | stats.max_last_reads_count = std::max(stats.max_last_reads_count, last_read_count); |
| 1032 | #endif |
| 1033 | } |
| 1034 | |
| 1035 | bool AccessState::IsRAWHazard(const SyncAccessInfo& usage_info) const { |
| 1036 | assert(IsRead(usage_info.access_index)); |
no test coverage detected