Page Speed Optimization Libraries
1.5.27.2
|
00001 /* 00002 * Copyright 2012 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 00019 00020 #ifndef NET_INSTAWEB_HTTP_PUBLIC_URL_ASYNC_FETCHER_STATS_H_ 00021 #define NET_INSTAWEB_HTTP_PUBLIC_URL_ASYNC_FETCHER_STATS_H_ 00022 00023 #include "net/instaweb/http/public/url_async_fetcher.h" 00024 #include "net/instaweb/util/public/basictypes.h" 00025 #include "net/instaweb/util/public/string.h" 00026 #include "net/instaweb/util/public/string_util.h" 00027 00028 namespace net_instaweb { 00029 00030 class AsyncFetch; 00031 class Histogram; 00032 class MessageHandler; 00033 class Statistics; 00034 class Timer; 00035 class Variable; 00036 00037 class UrlAsyncFetcherStats : public UrlAsyncFetcher { 00038 public: 00049 UrlAsyncFetcherStats(StringPiece prefix, 00050 UrlAsyncFetcher* base_fetcher, 00051 Timer* timer, 00052 Statistics* statistics); 00053 virtual ~UrlAsyncFetcherStats(); 00054 00057 static void InitStats(StringPiece prefix, Statistics* statistics); 00058 00061 virtual bool SupportsHttps() const; 00062 virtual void Fetch(const GoogleString& url, 00063 MessageHandler* message_handler, 00064 AsyncFetch* fetch); 00065 virtual int64 timeout_ms(); 00066 virtual void ShutDown(); 00067 00068 private: 00069 class StatsAsyncFetch; 00070 00071 UrlAsyncFetcher* base_fetcher_; 00072 Timer* timer_; 00073 00074 Histogram* fetch_latency_us_histogram_; 00075 Variable* fetches_; 00076 Variable* bytes_fetched_; 00077 Variable* approx_header_bytes_fetched_; 00078 00079 DISALLOW_COPY_AND_ASSIGN(UrlAsyncFetcherStats); 00080 }; 00081 00082 } 00083 00084 #endif ///< NET_INSTAWEB_HTTP_PUBLIC_URL_ASYNC_FETCHER_STATS_H_