Add output format options to a parser.
(parser, include_compression=True, include_binary=True)
| 438 | |
| 439 | |
| 440 | def _add_format_options(parser, include_compression=True, include_binary=True): |
| 441 | """Add output format options to a parser.""" |
| 442 | output_group = parser.add_argument_group("Output options") |
| 443 | format_group = output_group.add_mutually_exclusive_group() |
| 444 | format_group.add_argument( |
| 445 | "--pstats", |
| 446 | action="store_const", |
| 447 | const="pstats", |
| 448 | dest="format", |
| 449 | help="Generate pstats output (default)", |
| 450 | ) |
| 451 | format_group.add_argument( |
| 452 | "--collapsed", |
| 453 | action="store_const", |
| 454 | const="collapsed", |
| 455 | dest="format", |
| 456 | help="Generate collapsed stack traces for flamegraphs", |
| 457 | ) |
| 458 | format_group.add_argument( |
| 459 | "--flamegraph", |
| 460 | action="store_const", |
| 461 | const="flamegraph", |
| 462 | dest="format", |
| 463 | help="Generate interactive HTML flamegraph visualization", |
| 464 | ) |
| 465 | format_group.add_argument( |
| 466 | "--gecko", |
| 467 | action="store_const", |
| 468 | const="gecko", |
| 469 | dest="format", |
| 470 | help="Generate Gecko format for Firefox Profiler", |
| 471 | ) |
| 472 | format_group.add_argument( |
| 473 | "--heatmap", |
| 474 | action="store_const", |
| 475 | const="heatmap", |
| 476 | dest="format", |
| 477 | help="Generate interactive HTML heatmap visualization with line-level sample counts", |
| 478 | ) |
| 479 | format_group.add_argument( |
| 480 | "--diff-flamegraph", |
| 481 | metavar="BASELINE", |
| 482 | action=DiffFlamegraphAction, |
| 483 | help="Generate differential flamegraph comparing current profile to BASELINE binary file", |
| 484 | ) |
| 485 | if include_binary: |
| 486 | format_group.add_argument( |
| 487 | "--binary", |
| 488 | action="store_const", |
| 489 | const="binary", |
| 490 | dest="format", |
| 491 | help="Generate high-performance binary format (use 'replay' command to convert)", |
| 492 | ) |
| 493 | parser.set_defaults(format="pstats", diff_baseline=None) |
| 494 | |
| 495 | if include_compression: |
| 496 | output_group.add_argument( |
| 497 | "--compression", |
no test coverage detected
searching dependent graphs…