| 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 #include "tools/gn/trace.h" | 5 #include "tools/gn/trace.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 case TraceItem::TRACE_CHECK_HEADERS: | 195 case TraceItem::TRACE_CHECK_HEADERS: |
| 196 check_headers.push_back(event); | 196 check_headers.push_back(event); |
| 197 break; | 197 break; |
| 198 case TraceItem::TRACE_CHECK_HEADER: | 198 case TraceItem::TRACE_CHECK_HEADER: |
| 199 headers_checked++; | 199 headers_checked++; |
| 200 break; | 200 break; |
| 201 case TraceItem::TRACE_SETUP: | 201 case TraceItem::TRACE_SETUP: |
| 202 case TraceItem::TRACE_FILE_LOAD: | 202 case TraceItem::TRACE_FILE_LOAD: |
| 203 case TraceItem::TRACE_FILE_WRITE: | 203 case TraceItem::TRACE_FILE_WRITE: |
| 204 case TraceItem::TRACE_DEFINE_TARGET: | 204 case TraceItem::TRACE_DEFINE_TARGET: |
| 205 case TraceItem::TRACE_ON_RESOLVED: |
| 205 break; // Ignore these for the summary. | 206 break; // Ignore these for the summary. |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 std::ostringstream out; | 210 std::ostringstream out; |
| 210 SummarizeParses(parses, out); | 211 SummarizeParses(parses, out); |
| 211 out << std::endl; | 212 out << std::endl; |
| 212 SummarizeFileExecs(file_execs, out); | 213 SummarizeFileExecs(file_execs, out); |
| 213 out << std::endl; | 214 out << std::endl; |
| 214 SummarizeScriptExecs(script_execs, out); | 215 SummarizeScriptExecs(script_execs, out); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 break; | 275 break; |
| 275 case TraceItem::TRACE_FILE_WRITE: | 276 case TraceItem::TRACE_FILE_WRITE: |
| 276 out << "\"file_write\""; | 277 out << "\"file_write\""; |
| 277 break; | 278 break; |
| 278 case TraceItem::TRACE_SCRIPT_EXECUTE: | 279 case TraceItem::TRACE_SCRIPT_EXECUTE: |
| 279 out << "\"script_exec\""; | 280 out << "\"script_exec\""; |
| 280 break; | 281 break; |
| 281 case TraceItem::TRACE_DEFINE_TARGET: | 282 case TraceItem::TRACE_DEFINE_TARGET: |
| 282 out << "\"define\""; | 283 out << "\"define\""; |
| 283 break; | 284 break; |
| 285 case TraceItem::TRACE_ON_RESOLVED: |
| 286 out << "\"onresolved\""; |
| 287 break; |
| 284 case TraceItem::TRACE_CHECK_HEADER: | 288 case TraceItem::TRACE_CHECK_HEADER: |
| 285 out << "\"hdr\""; | 289 out << "\"hdr\""; |
| 286 break; | 290 break; |
| 287 case TraceItem::TRACE_CHECK_HEADERS: | 291 case TraceItem::TRACE_CHECK_HEADERS: |
| 288 out << "\"header_check\""; | 292 out << "\"header_check\""; |
| 289 break; | 293 break; |
| 290 } | 294 } |
| 291 | 295 |
| 292 if (!item.toolchain().empty() || !item.cmdline().empty()) { | 296 if (!item.toolchain().empty() || !item.cmdline().empty()) { |
| 293 out << ",\"args\":{"; | 297 out << ",\"args\":{"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 310 } | 314 } |
| 311 out << "}"; | 315 out << "}"; |
| 312 } | 316 } |
| 313 | 317 |
| 314 out << "]}"; | 318 out << "]}"; |
| 315 | 319 |
| 316 std::string out_str = out.str(); | 320 std::string out_str = out.str(); |
| 317 base::WriteFile(file_name, out_str.data(), | 321 base::WriteFile(file_name, out_str.data(), |
| 318 static_cast<int>(out_str.size())); | 322 static_cast<int>(out_str.size())); |
| 319 } | 323 } |
| OLD | NEW |