Commit a6c02f6
Fix topdown parameter and result parsing due to external changes
Summary:
More context: https://fb.workplace.com/groups/1943855219377055/permalink/2289387328157174/
**Problem:** ARM's topdown-tool changed its interface:
* **Old behavior:** We use flags "-a, -i, --csv", wrote results directly to a CSV file
* **New behavior:** Flags are removed, new flags are added "--csv-output-path", "--cpu-generate-csv". Creates a directory structure with timestamp subdirectories containing the CSV file at `<output_dir>/<timestamp>/cpu/<dynamic_filename>_metrics.csv`
**Changes Made:**
### 1. Updated `run()` method (lines 469-485)
Modified the topdown-tool command-line arguments:
* Removed: `-a` flag
* Changed: `-i` → `-I` (capital I for interval)
* Changed: `--csv` → `--csv-output-path`
* Added: `--cpu-generate-csv` and `"metrics"` positional argument
### 2. Updated `write_csv()` method (lines 488-598)
Implemented comprehensive directory cleanup and CSV extraction:
* **Finds latest timestamp:** Searches for timestamp directories (e.g., `2025_11_17_22_34_34`) and selects the most recent
* **Dynamic CSV detection:** Searches for files matching `*core_aggregate*_metrics.csv` pattern instead of using hardcoded filenames (handles different core configurations like `neoverse_v2_core_aggregate_(0,25-71)_metrics.csv`)
* **Directory cleanup:**
1. Reads the CSV data from `<csvpath>/<timestamp>/cpu/<dynamic_csv_name>`
2. Copies CSV to temporary location
3. Removes entire directory structure using `shutil.rmtree()`
4. Moves CSV file back to `self.csvpath` location (now as a file, not a directory)
* **Error handling:** Added comprehensive error handling with logging for all operations
* **Maintains existing functionality:** Still processes and writes transposed CSV as before
**Result:** The tool now correctly handles the new ARM topdown-tool output format while ensuring only a CSV file remains at the expected location instead of a directory structure.
Reviewed By: YifanYuan3
Differential Revision: D87276904
fbshipit-source-id: 4efcee755d5e970cbb2ce31647879cd2816ba5fb1 parent 1a08cca commit a6c02f6
1 file changed
+95
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
477 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
478 | 479 | | |
479 | | - | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
| |||
488 | 489 | | |
489 | 490 | | |
490 | 491 | | |
491 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
492 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
493 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
494 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
495 | 586 | | |
496 | | - | |
497 | 587 | | |
498 | 588 | | |
499 | 589 | | |
| |||
0 commit comments