Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: base/metrics/persistent_histogram_allocator.h

Issue 2010173005: Support experiment to store persistent metrics in memory-mapped file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments by Alexei Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 6 #define BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // This access to the persistent allocator is only for testing; it extracts 401 // This access to the persistent allocator is only for testing; it extracts
402 // the current allocator completely. This allows easy creation of histograms 402 // the current allocator completely. This allows easy creation of histograms
403 // within persistent memory segments which can then be extracted and used in 403 // within persistent memory segments which can then be extracted and used in
404 // other ways. 404 // other ways.
405 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting(); 405 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting();
406 406
407 // Stores a pathname to which the contents of this allocator should be saved 407 // Stores a pathname to which the contents of this allocator should be saved
408 // in order to persist the data for a later use. 408 // in order to persist the data for a later use.
409 void SetPersistentLocation(const FilePath& location); 409 void SetPersistentLocation(const FilePath& location);
410 410
411 // Retrieves a previously set pathname to which the contents of this allocator
412 // are to be saved.
413 const FilePath& GetPersistentLocation() const;
414
411 // Writes the internal data to a previously set location. This is generally 415 // Writes the internal data to a previously set location. This is generally
412 // called when a process is exiting from a section of code that may not know 416 // called when a process is exiting from a section of code that may not know
413 // the filesystem. The data is written in an atomic manner. The return value 417 // the filesystem. The data is written in an atomic manner. The return value
414 // indicates success. 418 // indicates success.
415 bool WriteToPersistentLocation(); 419 bool WriteToPersistentLocation();
416 420
417 private: 421 private:
418 friend class StatisticsRecorder; 422 friend class StatisticsRecorder;
419 423
420 // Creates a new global histogram allocator. 424 // Creates a new global histogram allocator.
(...skipping 14 matching lines...) Expand all
435 439
436 // The location to which the data should be persisted. 440 // The location to which the data should be persisted.
437 FilePath persistent_location_; 441 FilePath persistent_location_;
438 442
439 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); 443 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator);
440 }; 444 };
441 445
442 } // namespace base 446 } // namespace base
443 447
444 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 448 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_
OLDNEW
« no previous file with comments | « no previous file | base/metrics/persistent_histogram_allocator.cc » ('j') | chrome/browser/chrome_browser_field_trials.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698