| OLD | NEW |
| 1 # Startup Tracing with MemoryInfra | 1 This document has moved to [//docs/memory-infra/memory_infra_startup_tracing.md]
(/docs/memory-infra/memory_infra_startup_tracing.md). |
| 2 | 2 |
| 3 [MemoryInfra](memory_infra.md) supports startup tracing. | |
| 4 | |
| 5 ## The Simple Way | |
| 6 | |
| 7 Start Chrome as follows: | |
| 8 | |
| 9 $ chrome --no-sandbox \ | |
| 10 --trace-startup=-*,disabled-by-default-memory-infra \ | |
| 11 --trace-startup-file=/tmp/trace.json \ | |
| 12 --trace-startup-duration=7 | |
| 13 | |
| 14 On Android, enable startup tracing and start Chrome as follows: | |
| 15 | |
| 16 $ build/android/adb_chrome_public_command_line \ | |
| 17 --trace-startup=-*,disabled-by-default-memory-infra \ | |
| 18 --trace-startup-file=/sdcard/Download/trace.json \ | |
| 19 --trace-startup-duration=7 | |
| 20 | |
| 21 $ build/android/adb_run_chrome_public | |
| 22 | |
| 23 $ adb pull /sdcard/Download/trace.json # After tracing. | |
| 24 | |
| 25 Note that startup tracing will be enabled upon every Chrome launch until you | |
| 26 delete the command-line flags: | |
| 27 | |
| 28 $ build/android/adb_chrome_public_command_line "" | |
| 29 | |
| 30 This will use the default configuration: one memory dump every 250 ms with a | |
| 31 detailed dump ever two seconds. | |
| 32 | |
| 33 ## The Advanced Way | |
| 34 | |
| 35 If you need more control over the granularity of the memory dumps, you can | |
| 36 specify a custom trace config file as follows: | |
| 37 | |
| 38 $ cat > /tmp/trace.config | |
| 39 { | |
| 40 "startup_duration": 4, | |
| 41 "result_file": "/tmp/trace.json", | |
| 42 "trace_config": { | |
| 43 "included_categories": ["disabled-by-default-memory-infra"], | |
| 44 "excluded_categories": ["*"], | |
| 45 "memory_dump_config": { | |
| 46 "triggers": [ | |
| 47 { "mode": "light", "periodic_interval_ms": 50 }, | |
| 48 { "mode": "detailed", "periodic_interval_ms": 1000 } | |
| 49 ] | |
| 50 } | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 $ chrome --no-sandbox --trace-config-file=/tmp/trace.config | |
| 55 | |
| 56 On Android, the config file has to be pushed to a fixed file location: | |
| 57 | |
| 58 $ adb root | |
| 59 $ adb push /tmp/trace.config /data/local/chrome-trace-config.json | |
| 60 | |
| 61 $ build/android/adb_run_chrome_public | |
| 62 | |
| 63 $ adb pull /sdcard/Download/trace.json # After tracing. | |
| 64 | |
| 65 Make sure that the "result_file" location is writable by the Chrome process on | |
| 66 Android (e.g. "/sdcard/Download/trace.json"). Note that startup tracing will be | |
| 67 enabled upon every Chrome launch until you delete the config file: | |
| 68 | |
| 69 $ adb shell rm /data/local/chrome-trace-config.json | |
| 70 | |
| 71 ## Related Pages | |
| 72 | |
| 73 * [General information about startup tracing](https://sites.google.com/a/chromi
um.org/dev/developers/how-tos/trace-event-profiling-tool/recording-tracing-runs) | |
| 74 * [Memory tracing with MemoryInfra](memory_infra.md) | |
| OLD | NEW |