123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #ifndef BASE_PROFILER_SAMPLE_METADATA_H_
- #define BASE_PROFILER_SAMPLE_METADATA_H_
- #include "base/optional.h"
- #include "base/profiler/metadata_recorder.h"
- #include "base/strings/string_piece.h"
- namespace base {
- class BASE_EXPORT SampleMetadata {
- public:
-
- explicit SampleMetadata(StringPiece name);
- SampleMetadata(const SampleMetadata&) = default;
- ~SampleMetadata() = default;
- SampleMetadata& operator=(const SampleMetadata&) = delete;
-
-
-
- void Set(int64_t value);
-
-
-
-
-
-
-
-
-
- void Set(int64_t key, int64_t value);
-
-
-
-
- void Remove();
-
-
-
-
-
- void Remove(int64_t key);
- private:
- const uint64_t name_hash_;
- };
- class BASE_EXPORT ScopedSampleMetadata {
- public:
-
- ScopedSampleMetadata(StringPiece name, int64_t value);
-
-
-
-
-
-
-
- ScopedSampleMetadata(StringPiece name, int64_t key, int64_t value);
- ScopedSampleMetadata(const ScopedSampleMetadata&) = delete;
- ~ScopedSampleMetadata();
- ScopedSampleMetadata& operator=(const ScopedSampleMetadata&) = delete;
- private:
- const uint64_t name_hash_;
- Optional<int64_t> key_;
- };
- BASE_EXPORT void ApplyMetadataToPastSamples(TimeTicks period_start,
- TimeTicks period_end,
- StringPiece name,
- int64_t value);
- BASE_EXPORT void ApplyMetadataToPastSamples(TimeTicks period_start,
- TimeTicks period_end,
- StringPiece name,
- int64_t key,
- int64_t value);
- BASE_EXPORT MetadataRecorder* GetSampleMetadataRecorder();
- }
- #endif
|