Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
debug_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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_DEBUG_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_DEBUG_FILTER_H_
21 
26 
27 namespace net_instaweb {
28 
29 class HtmlElement;
30 class RewriteDriver;
31 class Timer;
32 
36 class DebugFilter : public EmptyHtmlFilter {
37  public:
38  explicit DebugFilter(RewriteDriver* driver);
39  virtual ~DebugFilter();
40 
41  virtual void EndDocument();
42  virtual void Flush();
43 
44  virtual const char* Name() const { return "Debug"; }
45 
52  void InitParse();
53  void StartParse();
54  void EndParse();
55  void StartRender();
56  void EndRender();
57 
58  virtual void EndElement(HtmlElement* element);
59 
65  static GoogleString FormatFlushMessage(int64 time_since_init_parse_us,
66  int64 parse_duration_us,
67  int64 flush_duration_us,
68  int64 idle_duration_us);
69  static GoogleString FormatEndDocumentMessage(
70  int64 time_since_init_parse_us, int64 total_parse_duration_us,
71  int64 total_flush_duration_us, int64 total_idle_duration_us,
72  int num_flushes, bool is_critical_images_beacon_enabled,
73  const StringSet& critical_image_urls,
74  const StringVector& dynamically_disabled_filter_list);
78 
79  private:
82  class Event {
83  public:
84  Event();
85  inline void Clear();
86  inline void Start(int64 now_us);
87  inline void End(int64 now_us);
88  inline void AddToTotal();
89 
90  int64 start_us() const { return start_us_; }
91  int64 duration_us() const { return duration_us_; }
92  int64 total_us() const { return total_us_; }
93 
94  private:
95  int64 start_us_;
96  int64 duration_us_;
97  int64 total_us_;
98  };
99 
100  void Clear();
101 
102  RewriteDriver* driver_;
103  Timer* timer_;
104  bool end_document_seen_;
105  int num_flushes_;
106  int64 start_doc_time_us_;
107  Event parse_;
108  Event render_;
109  Event idle_;
110  StringSet critical_image_urls_;
111 
114  GoogleString flush_messages_;
115 
116  StringVector dynamically_disabled_filter_list_;
117 
118 
119 };
120 
121 }
122 
123 #endif
virtual void EndDocument()
Definition: empty_html_filter.h:37
static GoogleString FormatFlushMessage(int64 time_since_init_parse_us, int64 parse_duration_us, int64 flush_duration_us, int64 idle_duration_us)
Definition: html_element.h:42
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: debug_filter.h:44
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
GoogleString ListActiveFiltersAndOptions() const
Definition: rewrite_driver.h:100
Definition: debug_filter.h:36