Skip to content

Commit

Permalink
Allow dumping trace information during GN calls.
Browse files Browse the repository at this point in the history
`--trace-gn` to `./flutter/tools/gn` should now dump a `gn_trace.json` in the
build directory. This is not on by default because capturing and generating the
traces seems to take about a second itself. So it is opt-in.

Related to flutter/flutter#81074
  • Loading branch information
chinmaygarde committed Apr 23, 2021
1 parent 060f108 commit db2767b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ def parse_args(args):
parser.add_argument('--tsan', default=False, action='store_true')
parser.add_argument('--ubsan', default=False, action='store_true')

parser.add_argument('--trace-gn', default=False, action='store_true',
help='Write a GN trace log (gn_trace.json) in the Chromium tracing format in the build directory.')

return parser.parse_args(args)

def main(argv):
Expand Down Expand Up @@ -466,6 +469,10 @@ def main(argv):
out_dir = get_out_dir(args)
command.append(out_dir)
command.append('--args=%s' % ' '.join(gn_args))

if args.trace_gn:
command.append('--tracelog=%s/gn_trace.json' % out_dir)

print("Generating GN files in: %s" % out_dir)
try:
gn_call_result = subprocess.call(command, cwd=SRC_ROOT)
Expand Down

0 comments on commit db2767b

Please sign in to comment.