| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_LOAD_LOG_UTIL_H_ | 5 #ifndef NET_BASE_NET_LOG_UTIL_H_ |
| 6 #define NET_BASE_LOAD_LOG_UTIL_H_ | 6 #define NET_BASE_NET_LOG_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "net/base/load_log.h" | 12 #include "net/base/net_log.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 // The LoadLogUtil utility class contains methods to analyze and visualize | 16 // The NetLogUtil utility class contains methods to analyze and visualize |
| 17 // LoadLogs. | 17 // NetLog entries. |
| 18 | 18 |
| 19 class LoadLogUtil { | 19 class NetLogUtil { |
| 20 public: | 20 public: |
| 21 struct EventDuration { | 21 struct EventDuration { |
| 22 LoadLog::EventType event; | 22 NetLog::EventType event; |
| 23 base::TimeDelta duration; | 23 base::TimeDelta duration; |
| 24 }; | 24 }; |
| 25 typedef std::vector<EventDuration> EventDurationList; | 25 typedef std::vector<EventDuration> EventDurationList; |
| 26 | 26 |
| 27 // Builds a pretty printed ASCII tree showing the chronological order | 27 // Builds a pretty printed ASCII tree showing the chronological order |
| 28 // of events. | 28 // of events. |
| 29 // | 29 // |
| 30 // The indentation reflects hiearchy, with the duration of each indented | 30 // The indentation reflects hiearchy, with the duration of each indented |
| 31 // block noted on the right. The timestamp (tick count in milliseconds) | 31 // block noted on the right. The timestamp (tick count in milliseconds) |
| 32 // is noted in the left column. | 32 // is noted in the left column. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 56 // - EventY took place right before Event1 finished, at t=8 | 56 // - EventY took place right before Event1 finished, at t=8 |
| 57 // | 57 // |
| 58 // In general the rules are: | 58 // In general the rules are: |
| 59 // - Log entries added by BeginEvent() are prefixed with a '+' and | 59 // - Log entries added by BeginEvent() are prefixed with a '+' and |
| 60 // start an indentation block. | 60 // start an indentation block. |
| 61 // - Log entries added by EndEvent() are prefixed with a '-' and | 61 // - Log entries added by EndEvent() are prefixed with a '-' and |
| 62 // finish an indentation block. | 62 // finish an indentation block. |
| 63 // - Log entries added by AddEvent() have no prefix. | 63 // - Log entries added by AddEvent() have no prefix. |
| 64 // - Time units are given as milliseconds. | 64 // - Time units are given as milliseconds. |
| 65 // | 65 // |
| 66 static std::string PrettyPrintAsEventTree(const LoadLog* log); | 66 static std::string PrettyPrintAsEventTree( |
| 67 const std::vector<NetLog::Entry>& entries, size_t num_entries_truncated); |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLogUtil); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(NetLogUtil); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace net | 73 } // namespace net |
| 73 | 74 |
| 74 #endif // NET_BASE_LOAD_LOG_UTIL_H_ | 75 #endif // NET_BASE_NET_LOG_UTIL_H_ |
| OLD | NEW |