Page Speed Optimization Libraries  1.7.30.1
net/instaweb/rewriter/public/rewrite_stats.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 Google Inc.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http:///www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00018 
00019 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
00020 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
00021 
00022 #include <vector>
00023 
00024 #include "net/instaweb/rewriter/public/rewrite_driver_factory.h"
00025 #include "net/instaweb/util/public/basictypes.h"
00026 
00027 namespace net_instaweb {
00028 
00029 class Histogram;
00030 class Statistics;
00031 class ThreadSystem;
00032 class TimedVariable;
00033 class Timer;
00034 class Variable;
00035 class Waveform;
00036 
00038 class RewriteStats {
00039  public:
00040   static const char kNumCacheControlRewritableResources[];
00041   static const char kNumCacheControlNotRewritableResources[];
00042   static const char kNumResourceFetchSuccesses[];
00043   static const char kNumResourceFetchFailures[];
00044   static const char kResourceUrlDomainAcceptances[];
00045   static const char kResourceUrlDomainRejections[];
00046 
00048   static const char kDownstreamCachePurgeAttempts[];
00051   static const char kSuccessfulDownstreamCachePurges[];
00052 
00053   RewriteStats(Statistics* stats, ThreadSystem* thread_system, Timer* timer);
00054   ~RewriteStats();
00055 
00056   static void InitStats(Statistics* statistics);
00057 
00058   Variable* cached_output_hits() { return cached_output_hits_; }
00059   Variable* cached_output_missed_deadline() {
00060     return cached_output_missed_deadline_; }
00061   Variable* cached_output_misses() { return cached_output_misses_;
00062   }
00063   Variable* cached_resource_fetches() { return cached_resource_fetches_; }
00064   Variable* failed_filter_resource_fetches() {
00065     return failed_filter_resource_fetches_;
00066   }
00067   Variable* num_cache_control_rewritable_resources() {
00068     return num_cache_control_rewritable_resources_;
00069   }
00070   Variable* num_cache_control_not_rewritable_resources() {
00071     return num_cache_control_not_rewritable_resources_;
00072   }
00073   Variable* num_flushes() { return num_flushes_; }
00074   Variable* resource_404_count() { return resource_404_count_; }
00075   Variable* resource_url_domain_acceptances() {
00076     return resource_url_domain_acceptances_;
00077   }
00078   Variable* resource_url_domain_rejections() {
00079     return resource_url_domain_rejections_;
00080   }
00081   Variable* slurp_404_count() { return slurp_404_count_; }
00082   Variable* succeeded_filter_resource_fetches() {
00083     return succeeded_filter_resource_fetches_;
00084   }
00085   Variable* total_page_load_ms() { return total_page_load_ms_; }
00088   Variable* page_load_count() { return page_load_count_; }
00089   Variable* fallback_responses_served() {
00090     return fallback_responses_served_;
00091   }
00092 
00093   Variable* num_proactively_freshen_user_facing_request() {
00094     return num_proactively_freshen_user_facing_request_;
00095   }
00096 
00097   Variable* fallback_responses_served_while_revalidate() {
00098     return fallback_responses_served_while_revalidate_;
00099   }
00100 
00101   Variable* num_conditional_refreshes() { return num_conditional_refreshes_; }
00102 
00103   Variable* ipro_served() { return ipro_served_; }
00104   Variable* ipro_not_in_cache() { return ipro_not_in_cache_; }
00105   Variable* ipro_not_rewritable() { return ipro_not_rewritable_; }
00106 
00107   Variable* downstream_cache_purge_attempts() {
00108     return downstream_cache_purge_attempts_;
00109   }
00110   Variable* successful_downstream_cache_purges() {
00111     return successful_downstream_cache_purges_;
00112   }
00113 
00114   Histogram* beacon_timings_ms_histogram() {
00115     return beacon_timings_ms_histogram_;
00116   }
00118   Histogram* fetch_latency_histogram() { return fetch_latency_histogram_; }
00120   Histogram* rewrite_latency_histogram() { return rewrite_latency_histogram_; }
00121   Histogram* backend_latency_histogram() { return backend_latency_histogram_; }
00122 
00124   TimedVariable* total_fetch_count() { return total_fetch_count_; }
00126   TimedVariable* total_rewrite_count() { return total_rewrite_count_; }
00127 
00128   Waveform* thread_queue_depth(RewriteDriverFactory::WorkerPoolCategory pool) {
00129     return thread_queue_depths_[pool];
00130   }
00131 
00132   TimedVariable* num_rewrites_executed() { return num_rewrites_executed_; }
00133   TimedVariable* num_rewrites_dropped() { return num_rewrites_dropped_; }
00134 
00135  private:
00136   Variable* cached_output_hits_;
00137   Variable* cached_output_missed_deadline_;
00138   Variable* cached_output_misses_;
00139   Variable* cached_resource_fetches_;
00140   Variable* failed_filter_resource_fetches_;
00141   Variable* num_cache_control_rewritable_resources_;
00142   Variable* num_cache_control_not_rewritable_resources_;
00143   Variable* num_flushes_;
00144   Variable* page_load_count_;
00145   Variable* resource_404_count_;
00146   Variable* resource_url_domain_acceptances_;
00147   Variable* resource_url_domain_rejections_;
00148   Variable* slurp_404_count_;
00149   Variable* succeeded_filter_resource_fetches_;
00150   Variable* total_page_load_ms_;
00151   Variable* fallback_responses_served_;
00152   Variable* num_proactively_freshen_user_facing_request_;
00153   Variable* fallback_responses_served_while_revalidate_;
00154   Variable* num_conditional_refreshes_;
00155   Variable* ipro_served_;
00156   Variable* ipro_not_in_cache_;
00157   Variable* ipro_not_rewritable_;
00158   Variable* downstream_cache_purge_attempts_;
00159   Variable* successful_downstream_cache_purges_;
00160 
00161   Histogram* beacon_timings_ms_histogram_;
00162   Histogram* fetch_latency_histogram_;
00163   Histogram* rewrite_latency_histogram_;
00164   Histogram* backend_latency_histogram_;
00165 
00166   TimedVariable* total_fetch_count_;
00167   TimedVariable* total_rewrite_count_;
00168   TimedVariable* num_rewrites_executed_;
00169   TimedVariable* num_rewrites_dropped_;
00170 
00171   std::vector<Waveform*> thread_queue_depths_;
00172 
00173   DISALLOW_COPY_AND_ASSIGN(RewriteStats);
00174 };
00175 
00176 }  
00177 
00178 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines