Index: webkit/quota/quota_temporary_storage_evictor.h |
diff --git a/webkit/quota/quota_temporary_storage_evictor.h b/webkit/quota/quota_temporary_storage_evictor.h |
index 8db1eda88009efbf3640bd3cfd9ed44ce63ff488..ccaeaae1f98f89d16f690d759fa77b0d3bd9b560 100644 |
--- a/webkit/quota/quota_temporary_storage_evictor.h |
+++ b/webkit/quota/quota_temporary_storage_evictor.h |
@@ -38,6 +38,53 @@ class QuotaTemporaryStorageEvictor : public base::NonThreadSafe { |
int64 num_evicted_origins; |
int64 num_eviction_rounds; |
int64 num_skipped_eviction_rounds; |
+ |
+ Statistics& operator -=(const Statistics& rhs) { |
kinuko
2011/08/12 03:57:45
As we chatted locally, unfortunately operator over
tzik
2011/08/12 07:12:06
Done.
|
+ num_errors_on_evicting_origin -= rhs.num_errors_on_evicting_origin; |
+ num_errors_on_getting_usage_and_quota -= |
+ rhs.num_errors_on_getting_usage_and_quota; |
+ num_evicted_origins -= rhs.num_evicted_origins; |
+ num_eviction_rounds -= rhs.num_eviction_rounds; |
+ num_skipped_eviction_rounds -= rhs.num_skipped_eviction_rounds; |
+ return *this; |
+ } |
+ }; |
+ |
+ struct EvictionRoundStatistics { |
+ EvictionRoundStatistics() |
+ : started(false), |
+ amount_of_usage_overage(-1), |
+ amount_of_diskspace_shortage(-1), |
+ usage_on_beginning_of_round(-1), |
+ usage_on_end_of_round(-1), |
+ num_evicted_origins(0) { |
+ } |
+ |
+ void put_usage_overage(int64 overage) { |
Dai Mikurube (NOT FULLTIME)
2011/08/12 04:19:03
Maybe "set" looks better?
tzik
2011/08/12 07:12:06
As we chatted, I added |is_initialized| flag. So w
|
+ if (amount_of_usage_overage < 0) |
+ amount_of_usage_overage = overage; |
+ } |
+ |
+ void put_diskspace_shortage(int64 diskspace_shortage) { |
+ if (amount_of_diskspace_shortage < 0) |
+ amount_of_diskspace_shortage = diskspace_shortage; |
+ } |
+ |
+ void put_usage(int64 usage) { |
+ if (usage_on_beginning_of_round < 0) |
+ usage_on_beginning_of_round = usage; |
+ usage_on_end_of_round = usage; |
+ } |
+ |
+ bool started; |
+ |
+ base::Time start_time; |
+ int64 amount_of_usage_overage; |
+ int64 amount_of_diskspace_shortage; |
Dai Mikurube (NOT FULLTIME)
2011/08/12 04:19:03
In my understanding, overage and shortage include
tzik
2011/08/12 07:12:06
Done.
I feel, "in this round" sounds as if the sho
Dai Mikurube (NOT FULLTIME)
2011/08/12 07:32:39
Sounds good.
|
+ |
+ int64 usage_on_beginning_of_round; |
+ int64 usage_on_end_of_round; |
+ int64 num_evicted_origins; |
Dai Mikurube (NOT FULLTIME)
2011/08/12 04:19:03
Adding "in_round" could be better though it looks
tzik
2011/08/12 07:12:06
Done.
|
}; |
QuotaTemporaryStorageEvictor( |
@@ -46,7 +93,8 @@ class QuotaTemporaryStorageEvictor : public base::NonThreadSafe { |
virtual ~QuotaTemporaryStorageEvictor(); |
void GetStatistics(std::map<std::string, int64>* statistics); |
- void ReportHistogram(); |
+ void ReportPerRoundHistogram(); |
+ void ReportPerHourHistogram(); |
void Start(); |
private: |
@@ -63,6 +111,9 @@ class QuotaTemporaryStorageEvictor : public base::NonThreadSafe { |
void OnGotLRUOrigin(const GURL& origin); |
void OnEvictionComplete(QuotaStatusCode status); |
+ void OnEvictionRoundStarted(); |
+ void OnEvictionRoundFinished(); |
+ |
// This is only used for tests. |
void set_repeated_eviction(bool repeated_eviction) { |
repeated_eviction_ = repeated_eviction; |
@@ -78,15 +129,13 @@ class QuotaTemporaryStorageEvictor : public base::NonThreadSafe { |
// Not owned; quota_eviction_handler owns us. |
QuotaEvictionHandler* quota_eviction_handler_; |
- Statistics statistics_; |
+ Statistics statistics_, reported_hourly_statistics_; |
Dai Mikurube (NOT FULLTIME)
2011/08/12 04:19:03
Declare them in two lines.
Does reported_hourly_s
tzik
2011/08/12 07:12:06
Done.
|
+ EvictionRoundStatistics round_statistics_; |
+ base::Time time_of_last_nonskipped_round_; |
Dai Mikurube (NOT FULLTIME)
2011/08/12 04:19:03
Does this "time" point the beginning of last non-s
tzik
2011/08/12 07:12:06
Done.
|
+ base::Time time_of_end_of_last_round_; |
int64 interval_ms_; |
bool repeated_eviction_; |
- int num_evicted_origins_in_round_; |
- |
- int64 usage_on_beginning_of_round_; |
- base::Time time_of_beginning_of_round_; |
- base::Time time_of_end_of_last_round_; |
base::OneShotTimer<QuotaTemporaryStorageEvictor> eviction_timer_; |
base::RepeatingTimer<QuotaTemporaryStorageEvictor> histogram_timer_; |