| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/metrics/persistent_histogram_allocator.h" | 5 #include "base/metrics/persistent_histogram_allocator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 // A second delayed allocations is defined using the same reference storage | 660 // A second delayed allocations is defined using the same reference storage |
| 661 // location as the first so the allocation of one will automatically be found | 661 // location as the first so the allocation of one will automatically be found |
| 662 // by the other. Within the block, the first half of the space is for "counts" | 662 // by the other. Within the block, the first half of the space is for "counts" |
| 663 // and the second half is for "logged counts". | 663 // and the second half is for "logged counts". |
| 664 DelayedPersistentAllocation logged_data( | 664 DelayedPersistentAllocation logged_data( |
| 665 memory_allocator_.get(), &histogram_data_ptr->counts_ref, | 665 memory_allocator_.get(), &histogram_data_ptr->counts_ref, |
| 666 kTypeIdCountsArray, counts_bytes, counts_bytes / 2, | 666 kTypeIdCountsArray, counts_bytes, counts_bytes / 2, |
| 667 /*make_iterable=*/false); | 667 /*make_iterable=*/false); |
| 668 | 668 |
| 669 // Create the right type of histogram. | 669 // Create the right type of histogram. |
| 670 std::string name(histogram_data_ptr->name); | 670 const char* name = histogram_data_ptr->name; |
| 671 std::unique_ptr<HistogramBase> histogram; | 671 std::unique_ptr<HistogramBase> histogram; |
| 672 switch (histogram_type) { | 672 switch (histogram_type) { |
| 673 case HISTOGRAM: | 673 case HISTOGRAM: |
| 674 histogram = Histogram::PersistentCreate( | 674 histogram = Histogram::PersistentCreate( |
| 675 name, histogram_minimum, histogram_maximum, ranges, counts_data, | 675 name, histogram_minimum, histogram_maximum, ranges, counts_data, |
| 676 logged_data, &histogram_data_ptr->samples_metadata, | 676 logged_data, &histogram_data_ptr->samples_metadata, |
| 677 &histogram_data_ptr->logged_metadata); | 677 &histogram_data_ptr->logged_metadata); |
| 678 DCHECK(histogram); | 678 DCHECK(histogram); |
| 679 break; | 679 break; |
| 680 case LINEAR_HISTOGRAM: | 680 case LINEAR_HISTOGRAM: |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 // static | 1078 // static |
| 1079 FilePath GlobalHistogramAllocator::MakeMetricsFilePath(const FilePath& dir, | 1079 FilePath GlobalHistogramAllocator::MakeMetricsFilePath(const FilePath& dir, |
| 1080 StringPiece name) { | 1080 StringPiece name) { |
| 1081 return dir.AppendASCII(name).AddExtension( | 1081 return dir.AppendASCII(name).AddExtension( |
| 1082 PersistentMemoryAllocator::kFileExtension); | 1082 PersistentMemoryAllocator::kFileExtension); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 } // namespace base | 1085 } // namespace base |
| OLD | NEW |