From 33d95806addac4c84a88eb8561ea424ef2097b6d Mon Sep 17 00:00:00 2001 From: bcwhite Date: Tue, 15 Mar 2016 19:37:45 -0700 Subject: Refactor histogram_persistence to be a class. The number of top-level functions was getting too large and impeding development of other features due to the previous lack of OO design. The code is largely unchanged, just moved into a stateful class and reordered to match the public/private sections of the class. Two other CLs are included here because they fit well with the refactoring: https://codereview.chromium.org/1689833002/ Add ownership-transfer to histogram management calls. This CL changes the interface to use scoped_ptr to explicitly document, with std::move, when the transfer of ownership is taking place. https://codereview.chromium.org/1731453002/ Reduce histogram creation time by avoiding import of those just created. Attempting to import histograms in the persistent memory segment is necessary because it could be shared and thus have other processes creating objects within it. However, there's no need to import those objects that this process created. The simple method remembering the "reference" of the last histogram created in the allocator catches almost all cases and reduces histogram creation time by 40%. BUG=546019 TBR=grt,thakis grt: setup/installer_metrics.cc (no logic changes) thakis: gn & gyp changes for new files Review URL: https://codereview.chromium.org/1738063002 Cr-Commit-Position: refs/heads/master@{#381386} --- base/BUILD.gn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'base/BUILD.gn') diff --git a/base/BUILD.gn b/base/BUILD.gn index cfe258b..1fcd718 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -526,14 +526,14 @@ component("base") { "metrics/histogram_delta_serialization.h", "metrics/histogram_flattener.h", "metrics/histogram_macros.h", - "metrics/histogram_persistence.cc", - "metrics/histogram_persistence.h", "metrics/histogram_samples.cc", "metrics/histogram_samples.h", "metrics/histogram_snapshot_manager.cc", "metrics/histogram_snapshot_manager.h", "metrics/metrics_hashes.cc", "metrics/metrics_hashes.h", + "metrics/persistent_histogram_allocator.cc", + "metrics/persistent_histogram_allocator.h", "metrics/persistent_memory_allocator.cc", "metrics/persistent_memory_allocator.h", "metrics/sample_map.cc", @@ -1738,6 +1738,7 @@ test("base_unittests") { "metrics/histogram_snapshot_manager_unittest.cc", "metrics/histogram_unittest.cc", "metrics/metrics_hashes_unittest.cc", + "metrics/persistent_histogram_allocator_unittest.cc", "metrics/persistent_memory_allocator_unittest.cc", "metrics/sample_map_unittest.cc", "metrics/sample_vector_unittest.cc", -- cgit v1.1