00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 Initialize(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_; }
00064 Variable* page_load_count() { return page_load_count_; }
00065 Variable* fallback_responses_served() {
00066 return fallback_responses_served_;
00067 }
00068 Variable* num_conditional_refreshes() { return num_conditional_refreshes_; }
00069
00070 Histogram* fetch_latency_histogram() { return fetch_latency_histogram_; }
00071 Histogram* rewrite_latency_histogram() { return rewrite_latency_histogram_; }
00072 Histogram* backend_latency_histogram() { return backend_latency_histogram_; }
00073
00074 TimedVariable* total_fetch_count() { return total_fetch_count_; }
00075 TimedVariable* total_rewrite_count() { return total_rewrite_count_; }
00076
00077 Waveform* thread_queue_depth(RewriteDriverFactory::WorkerPoolName name) {
00078 return thread_queue_depths_[name];
00079 }
00080
00081 TimedVariable* num_rewrites_executed() { return num_rewrites_executed_; }
00082 TimedVariable* num_rewrites_dropped() { return num_rewrites_dropped_; }
00083
00084 private:
00085 Variable* cached_output_hits_;
00086 Variable* cached_output_missed_deadline_;
00087 Variable* cached_output_misses_;
00088 Variable* cached_resource_fetches_;
00089 Variable* failed_filter_resource_fetches_;
00090 Variable* failed_filter_resource_fetches__;
00091 Variable* num_flushes_;
00092 Variable* page_load_count_;
00093 Variable* resource_404_count_;
00094 Variable* resource_url_domain_rejections_;
00095 Variable* slurp_404_count_;
00096 Variable* succeeded_filter_resource_fetches_;
00097 Variable* total_page_load_ms_;
00098 Variable* fallback_responses_served_;
00099 Variable* num_conditional_refreshes_;
00100
00101 Histogram* fetch_latency_histogram_;
00102 Histogram* rewrite_latency_histogram_;
00103 Histogram* backend_latency_histogram_;
00104
00105 TimedVariable* total_fetch_count_;
00106 TimedVariable* total_rewrite_count_;
00107 TimedVariable* num_rewrites_executed_;
00108 TimedVariable* num_rewrites_dropped_;
00109
00110 std::vector<Waveform*> thread_queue_depths_;
00111
00112 DISALLOW_COPY_AND_ASSIGN(RewriteStats);
00113 };
00114
00115 }
00116
00117 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_STATS_H_