Page Speed Optimization Libraries  1.13.35.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 
28 
29 namespace net_instaweb {
30 
31 class Timer;
32 class Waveform;
33 
35 class RewriteStats {
36  public:
37  static const char kNumCacheControlRewritableResources[];
38  static const char kNumCacheControlNotRewritableResources[];
39  static const char kNumResourceFetchSuccesses[];
40  static const char kNumResourceFetchFailures[];
41  static const char kResourceUrlDomainAcceptances[];
42  static const char kResourceUrlDomainRejections[];
43 
45  static const char kDownstreamCachePurgeAttempts[];
48  static const char kSuccessfulDownstreamCachePurges[];
49 
50  RewriteStats(bool has_waveforms, Statistics* stats,
51  ThreadSystem* thread_system, Timer* timer);
52  ~RewriteStats();
53 
54  static void InitStats(Statistics* statistics);
55 
56  Variable* cached_output_hits() { return cached_output_hits_; }
57  Variable* cached_output_missed_deadline() {
58  return cached_output_missed_deadline_; }
59  Variable* cached_output_misses() { return cached_output_misses_;
60  }
61  Variable* cached_resource_fetches() { return cached_resource_fetches_; }
62  Variable* failed_filter_resource_fetches() {
63  return failed_filter_resource_fetches_;
64  }
65  Variable* num_cache_control_rewritable_resources() {
66  return num_cache_control_rewritable_resources_;
67  }
68  Variable* num_cache_control_not_rewritable_resources() {
69  return num_cache_control_not_rewritable_resources_;
70  }
71  Variable* num_flushes() { return num_flushes_; }
72  Variable* resource_404_count() { return resource_404_count_; }
73  Variable* resource_url_domain_acceptances() {
74  return resource_url_domain_acceptances_;
75  }
76  Variable* resource_url_domain_rejections() {
77  return resource_url_domain_rejections_;
78  }
79  Variable* slurp_404_count() { return slurp_404_count_; }
80  Variable* succeeded_filter_resource_fetches() {
81  return succeeded_filter_resource_fetches_;
82  }
83  Variable* total_page_load_ms() { return total_page_load_ms_; }
86  Variable* page_load_count() { return page_load_count_; }
87  Variable* fallback_responses_served() {
88  return fallback_responses_served_;
89  }
90 
91  Variable* num_proactively_freshen_user_facing_request() {
92  return num_proactively_freshen_user_facing_request_;
93  }
94 
95  Variable* fallback_responses_served_while_revalidate() {
96  return fallback_responses_served_while_revalidate_;
97  }
98 
99  Variable* num_conditional_refreshes() { return num_conditional_refreshes_; }
100 
101  Variable* ipro_served() { return ipro_served_; }
102  Variable* ipro_not_in_cache() { return ipro_not_in_cache_; }
103  Variable* ipro_not_rewritable() { return ipro_not_rewritable_; }
104 
105  Variable* downstream_cache_purge_attempts() {
106  return downstream_cache_purge_attempts_;
107  }
108  Variable* successful_downstream_cache_purges() {
109  return successful_downstream_cache_purges_;
110  }
111 
112  Histogram* beacon_timings_ms_histogram() {
113  return beacon_timings_ms_histogram_;
114  }
116  Histogram* fetch_latency_histogram() { return fetch_latency_histogram_; }
118  Histogram* rewrite_latency_histogram() { return rewrite_latency_histogram_; }
119  Histogram* backend_latency_histogram() { return backend_latency_histogram_; }
120 
122  TimedVariable* total_fetch_count() { return total_fetch_count_; }
124  TimedVariable* total_rewrite_count() { return total_rewrite_count_; }
125 
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 
174 };
175 
176 }
177 
178 #endif
TimedVariable * total_fetch_count()
Number of .pagespeed. resources fetched.
Definition: rewrite_stats.h:122
Definition: statistics.h:43
static const char kDownstreamCachePurgeAttempts[]
Variable tracking number of downstream cache purges issued.
Definition: rewrite_stats.h:45
Variable * page_load_count()
Definition: rewrite_stats.h:86
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
Histogram * fetch_latency_histogram()
.pagespeed. resource latency in ms.
Definition: rewrite_stats.h:116
WorkerPoolCategory
Definition: rewrite_driver_factory.h:75
Histogram * rewrite_latency_histogram()
HTML rewrite latency in ms.
Definition: rewrite_stats.h:118
static const char kSuccessfulDownstreamCachePurges[]
Definition: rewrite_stats.h:48
Definition: waveform.h:45
Waveform * thread_queue_depth(RewriteDriverFactory::WorkerPoolCategory pool)
Definition: rewrite_stats.h:128
TimedVariable * total_rewrite_count()
Number of HTML pages rewritten.
Definition: rewrite_stats.h:124
Definition: statistics.h:138
Definition: thread_system.h:40
Definition: statistics.h:298
Collects a few specific statistics variables related to Rewriting.
Definition: rewrite_stats.h:35
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27