1 // Copyright 2021 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef PARTITION_ALLOC_STARSCAN_STATS_REPORTER_H_ 6 #define PARTITION_ALLOC_STARSCAN_STATS_REPORTER_H_ 7 8 #include "partition_alloc/partition_alloc_base/threading/platform_thread.h" 9 #include "partition_alloc/starscan/stats_collector.h" 10 11 namespace partition_alloc { 12 13 // StatsReporter is a wrapper to invoke TRACE_EVENT_BEGIN/END, TRACE_COUNTER1, 14 // and UmaHistogramTimes. It is used to just remove trace_log and uma 15 // dependencies from PartitionAlloc. 16 class StatsReporter { 17 public: ReportTraceEvent(internal::StatsCollector::ScannerId id,internal::base::PlatformThreadId tid,int64_t start_time_ticks_internal_value,int64_t end_time_ticks_internal_value)18 virtual void ReportTraceEvent(internal::StatsCollector::ScannerId id, 19 internal::base::PlatformThreadId tid, 20 int64_t start_time_ticks_internal_value, 21 int64_t end_time_ticks_internal_value) {} ReportTraceEvent(internal::StatsCollector::MutatorId id,internal::base::PlatformThreadId tid,int64_t start_time_ticks_internal_value,int64_t end_time_ticks_internal_value)22 virtual void ReportTraceEvent(internal::StatsCollector::MutatorId id, 23 internal::base::PlatformThreadId tid, 24 int64_t start_time_ticks_internal_value, 25 int64_t end_time_ticks_internal_value) {} 26 ReportSurvivedQuarantineSize(size_t survived_size)27 virtual void ReportSurvivedQuarantineSize(size_t survived_size) {} 28 ReportSurvivedQuarantinePercent(double survivied_rate)29 virtual void ReportSurvivedQuarantinePercent(double survivied_rate) {} 30 ReportStats(const char * stats_name,int64_t sample_in_usec)31 virtual void ReportStats(const char* stats_name, int64_t sample_in_usec) {} 32 }; 33 34 } // namespace partition_alloc 35 36 #endif // PARTITION_ALLOC_STARSCAN_STATS_REPORTER_H_ 37