2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4 # Test implicit trace file name
5 # RUN: ld.lld --time-trace --time-trace-granularity=0 -o %t1.elf %t.o
6 # RUN: cat %t1.elf.time-trace \
7 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
10 # Test specified trace file name
11 # RUN: ld.lld --time-trace --time-trace-file=%t2.json --time-trace-granularity=0 -o %t2.elf %t.o
13 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
16 # Test trace requested to stdout
17 # RUN: ld.lld --time-trace --time-trace-file=- --time-trace-granularity=0 -o %t3.elf %t.o \
18 # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
21 # CHECK: "beginningOfTime": {{[0-9]{16},}}
22 # CHECK-NEXT: "traceEvents": [
24 # Check one event has correct fields
32 # Check there is an ExecuteLinker event
33 # CHECK: "name": "ExecuteLinker"
35 # Check process_name entry field
36 # CHECK: "name": "ld.lld{{(.exe)?}}"
37 # CHECK: "name": "process_name"
38 # CHECK: "name": "thread_name"