| Index: services/blamer/heap_objects/blame_data.h
|
| diff --git a/services/blamer/heap_objects/blame_data.h b/services/blamer/heap_objects/blame_data.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..045bd3e4250265df81782cdfb4c87510399405ba
|
| --- /dev/null
|
| +++ b/services/blamer/heap_objects/blame_data.h
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Declares the hierarchy of classes that are used for the tallying of
|
| +// performance data by the blamer service.
|
| +
|
| +#ifndef SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_
|
| +#ifndef SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_
|
| +
|
| +#include <atomic>
|
| +
|
| +namespace blamer {
|
| +
|
| +// This is the data store for actual metrics gathered and attributed to a
|
| +// particular blame node. These can be written to and read from by multiple
|
| +// threads and processes at the same time. As such, they make use of atomics to
|
| +// keep them thread safe. The backing memory will be in a shared memory segment
|
| +// exported by the blame service to all other connected processes.
|
| +struct FlatBlameData {
|
| + // For use with SharedMemoryHeap and PersistentMemoryAllocator.
|
| + constexpr HeapObjectTypes kPersistentTypeId = HeapObjectTypes::BLAME_DATA;
|
| +
|
| + // Cumulative CPU time in milliseconds. This can represent 50 days of
|
| + // cumulative time.
|
| + std::atomic<uint32_t> cumulative_task_time_ms;
|
| +
|
| + // The total number of tasks that have been executed under this node.
|
| + std::atomic<uint32_t> task_count;
|
| +};
|
| +
|
| +// TODO(chrisha): Consider a distinct in-process thread-local / sequence-local
|
| +// representation that can be written to directly without any locking or
|
| +// atomics. This would then be "drained" to the central store that is accessible
|
| +// from all processes. This would mean that in-process work wouldn't be visible
|
| +// by other processes, but the moment a task completes its attribution data
|
| +// would be available.
|
| +
|
| +} // namespace blamer
|
| +
|
| +#endif // SERVICES_BLAMER_PUBLIC_CPP_BLAME_DATA_H_
|
|
|