OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 TOOLS_GN_TRACE_H_ | 5 #ifndef TOOLS_GN_TRACE_H_ |
6 #define TOOLS_GN_TRACE_H_ | 6 #define TOOLS_GN_TRACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 std::string cmdline_; | 63 std::string cmdline_; |
64 }; | 64 }; |
65 | 65 |
66 class ScopedTrace { | 66 class ScopedTrace { |
67 public: | 67 public: |
68 ScopedTrace(TraceItem::Type t, const std::string& name); | 68 ScopedTrace(TraceItem::Type t, const std::string& name); |
69 ScopedTrace(TraceItem::Type t, const Label& label); | 69 ScopedTrace(TraceItem::Type t, const Label& label); |
70 ~ScopedTrace(); | 70 ~ScopedTrace(); |
71 | 71 |
72 void SetToolchain(const Label& label); | 72 void SetToolchain(const Label& label); |
73 void SetCommandLine(const CommandLine& cmdline); | 73 void SetCommandLine(const base::CommandLine& cmdline); |
74 | 74 |
75 void Done(); | 75 void Done(); |
76 | 76 |
77 private: | 77 private: |
78 TraceItem* item_; | 78 TraceItem* item_; |
79 bool done_; | 79 bool done_; |
80 }; | 80 }; |
81 | 81 |
82 // Call to turn tracing on. It's off by default. | 82 // Call to turn tracing on. It's off by default. |
83 void EnableTracing(); | 83 void EnableTracing(); |
84 | 84 |
85 // Adds a trace event to the log. Takes ownership of the pointer. | 85 // Adds a trace event to the log. Takes ownership of the pointer. |
86 void AddTrace(TraceItem* item); | 86 void AddTrace(TraceItem* item); |
87 | 87 |
88 // Returns a summary of the current traces, or the empty string if tracing is | 88 // Returns a summary of the current traces, or the empty string if tracing is |
89 // not enabled. | 89 // not enabled. |
90 std::string SummarizeTraces(); | 90 std::string SummarizeTraces(); |
91 | 91 |
92 // Saves the current traces to the given filename in JSON format. | 92 // Saves the current traces to the given filename in JSON format. |
93 void SaveTraces(const base::FilePath& file_name); | 93 void SaveTraces(const base::FilePath& file_name); |
94 | 94 |
95 #endif // TOOLS_GN_TRACE_H_ | 95 #endif // TOOLS_GN_TRACE_H_ |
OLD | NEW |