OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Declares the hierarchy of classes that are used for the tallying of |
| 6 // performance data by the blamer service. |
| 7 |
| 8 #ifndef SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_ |
| 9 #ifndef SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_ |
| 10 |
| 11 #include <atomic> |
| 12 |
| 13 namespace blamer { |
| 14 |
| 15 // This is the data store for actual metrics gathered and attributed to a |
| 16 // particular blame node. These can be written to and read from by multiple |
| 17 // threads and processes at the same time. As such, they make use of atomics to |
| 18 // keep them thread safe. The backing memory will be in a shared memory segment |
| 19 // exported by the blame service to all other connected processes. |
| 20 struct FlatBlameData { |
| 21 // For use with SharedMemoryHeap and PersistentMemoryAllocator. |
| 22 constexpr HeapObjectTypes kPersistentTypeId = HeapObjectTypes::BLAME_DATA; |
| 23 |
| 24 // Cumulative CPU time in milliseconds. This can represent 50 days of |
| 25 // cumulative time. |
| 26 std::atomic<uint32_t> cumulative_task_time_ms; |
| 27 |
| 28 // The total number of tasks that have been executed under this node. |
| 29 std::atomic<uint32_t> task_count; |
| 30 }; |
| 31 |
| 32 // TODO(chrisha): Consider a distinct in-process thread-local / sequence-local |
| 33 // representation that can be written to directly without any locking or |
| 34 // atomics. This would then be "drained" to the central store that is accessible |
| 35 // from all processes. This would mean that in-process work wouldn't be visible |
| 36 // by other processes, but the moment a task completes its attribution data |
| 37 // would be available. |
| 38 |
| 39 } // namespace blamer |
| 40 |
| 41 #endif // SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_ |
OLD | NEW |