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

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: rebased Created 4 years, 6 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // This access to the persistent allocator is only for testing; it extracts 432 // This access to the persistent allocator is only for testing; it extracts
433 // the current allocator completely. This allows easy creation of histograms 433 // the current allocator completely. This allows easy creation of histograms
434 // within persistent memory segments which can then be extracted and used in 434 // within persistent memory segments which can then be extracted and used in
435 // other ways. 435 // other ways.
436 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting(); 436 static std::unique_ptr<GlobalHistogramAllocator> ReleaseForTesting();
437 437
438 // Stores a pathname to which the contents of this allocator should be saved 438 // Stores a pathname to which the contents of this allocator should be saved
439 // in order to persist the data for a later use. 439 // in order to persist the data for a later use.
440 void SetPersistentLocation(const FilePath& location); 440 void SetPersistentLocation(const FilePath& location);
441 441
442 // Retrieves a previously set pathname to which the contents of this allocator
443 // are to be saved.
444 const FilePath& GetPersistentLocation() const;
445
442 // Writes the internal data to a previously set location. This is generally 446 // Writes the internal data to a previously set location. This is generally
443 // called when a process is exiting from a section of code that may not know 447 // called when a process is exiting from a section of code that may not know
444 // the filesystem. The data is written in an atomic manner. The return value 448 // the filesystem. The data is written in an atomic manner. The return value
445 // indicates success. 449 // indicates success.
446 bool WriteToPersistentLocation(); 450 bool WriteToPersistentLocation();
447 451
448 private: 452 private:
449 friend class StatisticsRecorder; 453 friend class StatisticsRecorder;
450 454
451 // Creates a new global histogram allocator. 455 // Creates a new global histogram allocator.
(...skipping 14 matching lines...) Expand all
466 470
467 // The location to which the data should be persisted. 471 // The location to which the data should be persisted.
468 FilePath persistent_location_; 472 FilePath persistent_location_;
469 473
470 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator); 474 DISALLOW_COPY_AND_ASSIGN(GlobalHistogramAllocator);
471 }; 475 };
472 476
473 } // namespace base 477 } // namespace base
474 478
475 #endif // BASE_METRICS_HISTOGRAM_PERSISTENCE_H_ 479 #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