Page Speed Optimization Libraries  1.3.25.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   RewriteStats(Statistics* stats, ThreadSystem* thread_system, Timer* timer);
00041   ~RewriteStats();
00042 
00043   static void InitStats(Statistics* statistics);
00044 
00045   Variable* cached_output_hits() { return cached_output_hits_; }
00046   Variable* cached_output_missed_deadline() {
00047     return cached_output_missed_deadline_; }
00048   Variable* cached_output_misses() { return cached_output_misses_;
00049   }
00050   Variable* cached_resource_fetches() { return cached_resource_fetches_; }
00051   Variable* failed_filter_resource_fetches() {
00052     return failed_filter_resource_fetches_;
00053   }
00054   Variable* num_flushes() { return num_flushes_; }
00055   Variable* resource_404_count() { return resource_404_count_; }
00056   Variable* resource_url_domain_rejections() {
00057     return resource_url_domain_rejections_;
00058   }
00059   Variable* slurp_404_count() { return slurp_404_count_; }
00060   Variable* succeeded_filter_resource_fetches() {
00061     return succeeded_filter_resource_fetches_;
00062   }
00063   Variable* total_page_load_ms() { return total_page_load_ms_; }
00066   Variable* page_load_count() { return page_load_count_; }
00067   Variable* fallback_responses_served() {
00068     return fallback_responses_served_;
00069   }
00070   Variable* num_conditional_refreshes() { return num_conditional_refreshes_; }
00071 
00072   Histogram* beacon_timings_ms_histogram() {
00073     return beacon_timings_ms_histogram_;
00074   }
00076   Histogram* fetch_latency_histogram() { return fetch_latency_histogram_; }
00078   Histogram* rewrite_latency_histogram() { return rewrite_latency_histogram_; }
00079   Histogram* backend_latency_histogram() { return backend_latency_histogram_; }
00080 
00082   TimedVariable* total_fetch_count() { return total_fetch_count_; }
00084   TimedVariable* total_rewrite_count() { return total_rewrite_count_; }
00085 
00086   Waveform* thread_queue_depth(RewriteDriverFactory::WorkerPoolCategory pool) {
00087     return thread_queue_depths_[pool];
00088   }
00089 
00090   TimedVariable* num_rewrites_executed() { return num_rewrites_executed_; }
00091   TimedVariable* num_rewrites_dropped() { return num_rewrites_dropped_; }
00092 
00093  private:
00094   Variable* cached_output_hits_;
00095   Variable* cached_output_missed_deadline_;
00096   Variable* cached_output_misses_;
00097   Variable* cached_resource_fetches_;
00098   Variable* failed_filter_resource_fetches_;
00099   Variable* failed_filter_resource_fetches__;
00100   Variable* num_flushes_;
00101   Variable* page_load_count_;
00102   Variable* resource_404_count_;
00103   Variable* resource_url_domain_rejections_;
00104   Variable* slurp_404_count_;
00105   Variable* succeeded_filter_resource_fetches_;
00106   Variable* total_page_load_ms_;
00107   Variable* fallback_responses_served_;
00108   Variable* num_conditional_refreshes_;
00109 
00110   Histogram* beacon_timings_ms_histogram_;
00111   Histogram* fetch_latency_histogram_;
00112   Histogram* rewrite_latency_histogram_;
00113   Histogram* backend_latency_histogram_;
00114 
00115   TimedVariable* total_fetch_count_;
00116   TimedVariable* total_rewrite_count_;
00117   TimedVariable* num_rewrites_executed_;
00118   TimedVariable* num_rewrites_dropped_;
00119 
00120   std::vector<Waveform*> thread_queue_depths_;
00121 
00122   DISALLOW_COPY_AND_ASSIGN(RewriteStats);
00123 };
00124 
00125 }  
00126 
00127 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines