Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rewrite_stats.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
21 
22 #include <vector>
23 
26 
27 namespace net_instaweb {
28 
29 class Histogram;
30 class Statistics;
31 class ThreadSystem;
32 class TimedVariable;
33 class Timer;
34 class Variable;
35 class Waveform;
36 
38 class RewriteStats {
39  public:
40  static const char kNumCacheControlRewritableResources[];
41  static const char kNumCacheControlNotRewritableResources[];
42  static const char kNumResourceFetchSuccesses[];
43  static const char kNumResourceFetchFailures[];
44  static const char kResourceUrlDomainAcceptances[];
45  static const char kResourceUrlDomainRejections[];
46 
48  static const char kDownstreamCachePurgeAttempts[];
51  static const char kSuccessfulDownstreamCachePurges[];
52 
53  RewriteStats(Statistics* stats, ThreadSystem* thread_system, Timer* timer);
54  ~RewriteStats();
55 
56  static void InitStats(Statistics* statistics);
57 
58  Variable* cached_output_hits() { return cached_output_hits_; }
59  Variable* cached_output_missed_deadline() {
60  return cached_output_missed_deadline_; }
61  Variable* cached_output_misses() { return cached_output_misses_;
62  }
63  Variable* cached_resource_fetches() { return cached_resource_fetches_; }
64  Variable* failed_filter_resource_fetches() {
65  return failed_filter_resource_fetches_;
66  }
67  Variable* num_cache_control_rewritable_resources() {
68  return num_cache_control_rewritable_resources_;
69  }
70  Variable* num_cache_control_not_rewritable_resources() {
71  return num_cache_control_not_rewritable_resources_;
72  }
73  Variable* num_flushes() { return num_flushes_; }
74  Variable* resource_404_count() { return resource_404_count_; }
75  Variable* resource_url_domain_acceptances() {
76  return resource_url_domain_acceptances_;
77  }
78  Variable* resource_url_domain_rejections() {
79  return resource_url_domain_rejections_;
80  }
81  Variable* slurp_404_count() { return slurp_404_count_; }
82  Variable* succeeded_filter_resource_fetches() {
83  return succeeded_filter_resource_fetches_;
84  }
85  Variable* total_page_load_ms() { return total_page_load_ms_; }
88  Variable* page_load_count() { return page_load_count_; }
89  Variable* fallback_responses_served() {
90  return fallback_responses_served_;
91  }
92 
93  Variable* num_proactively_freshen_user_facing_request() {
94  return num_proactively_freshen_user_facing_request_;
95  }
96 
97  Variable* fallback_responses_served_while_revalidate() {
98  return fallback_responses_served_while_revalidate_;
99  }
100 
101  Variable* num_conditional_refreshes() { return num_conditional_refreshes_; }
102 
103  Variable* ipro_served() { return ipro_served_; }
104  Variable* ipro_not_in_cache() { return ipro_not_in_cache_; }
105  Variable* ipro_not_rewritable() { return ipro_not_rewritable_; }
106 
107  Variable* downstream_cache_purge_attempts() {
108  return downstream_cache_purge_attempts_;
109  }
110  Variable* successful_downstream_cache_purges() {
111  return successful_downstream_cache_purges_;
112  }
113 
114  Histogram* beacon_timings_ms_histogram() {
115  return beacon_timings_ms_histogram_;
116  }
118  Histogram* fetch_latency_histogram() { return fetch_latency_histogram_; }
120  Histogram* rewrite_latency_histogram() { return rewrite_latency_histogram_; }
121  Histogram* backend_latency_histogram() { return backend_latency_histogram_; }
122 
124  TimedVariable* total_fetch_count() { return total_fetch_count_; }
126  TimedVariable* total_rewrite_count() { return total_rewrite_count_; }
127 
128  Waveform* thread_queue_depth(RewriteDriverFactory::WorkerPoolCategory pool) {
129  return thread_queue_depths_[pool];
130  }
131 
132  TimedVariable* num_rewrites_executed() { return num_rewrites_executed_; }
133  TimedVariable* num_rewrites_dropped() { return num_rewrites_dropped_; }
134 
135  private:
136  Variable* cached_output_hits_;
137  Variable* cached_output_missed_deadline_;
138  Variable* cached_output_misses_;
139  Variable* cached_resource_fetches_;
140  Variable* failed_filter_resource_fetches_;
141  Variable* num_cache_control_rewritable_resources_;
142  Variable* num_cache_control_not_rewritable_resources_;
143  Variable* num_flushes_;
144  Variable* page_load_count_;
145  Variable* resource_404_count_;
146  Variable* resource_url_domain_acceptances_;
147  Variable* resource_url_domain_rejections_;
148  Variable* slurp_404_count_;
149  Variable* succeeded_filter_resource_fetches_;
150  Variable* total_page_load_ms_;
151  Variable* fallback_responses_served_;
152  Variable* num_proactively_freshen_user_facing_request_;
153  Variable* fallback_responses_served_while_revalidate_;
154  Variable* num_conditional_refreshes_;
155  Variable* ipro_served_;
156  Variable* ipro_not_in_cache_;
157  Variable* ipro_not_rewritable_;
158  Variable* downstream_cache_purge_attempts_;
159  Variable* successful_downstream_cache_purges_;
160 
161  Histogram* beacon_timings_ms_histogram_;
162  Histogram* fetch_latency_histogram_;
163  Histogram* rewrite_latency_histogram_;
164  Histogram* backend_latency_histogram_;
165 
166  TimedVariable* total_fetch_count_;
167  TimedVariable* total_rewrite_count_;
168  TimedVariable* num_rewrites_executed_;
169  TimedVariable* num_rewrites_dropped_;
170 
171  std::vector<Waveform*> thread_queue_depths_;
172 
173  DISALLOW_COPY_AND_ASSIGN(RewriteStats);
174 };
175 
176 }
177 
178 #endif
TimedVariable * total_fetch_count()
Number of .pagespeed. resources fetched.
Definition: rewrite_stats.h:124
static const char kDownstreamCachePurgeAttempts[]
Variable tracking number of downstream cache purges issued.
Definition: rewrite_stats.h:48
Variable * page_load_count()
Definition: rewrite_stats.h:88
Histogram * fetch_latency_histogram()
.pagespeed. resource latency in ms.
Definition: rewrite_stats.h:118
WorkerPoolCategory
Definition: rewrite_driver_factory.h:78
Histogram * rewrite_latency_histogram()
HTML rewrite latency in ms.
Definition: rewrite_stats.h:120
static const char kSuccessfulDownstreamCachePurges[]
Definition: rewrite_stats.h:51
TimedVariable * total_rewrite_count()
Number of HTML pages rewritten.
Definition: rewrite_stats.h:126
Collects a few specific statistics variables related to Rewriting.
Definition: rewrite_stats.h:38