tools/perf/pmu-events/arm64_metrics.py
Source file repositories/reference/linux-study-clean/tools/perf/pmu-events/arm64_metrics.py
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/pmu-events/arm64_metrics.py- Extension
.py- Size
- 1421 bytes
- Lines
- 50
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/usr/bin/env python3
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
import argparse
import os
from metric import (JsonEncodeMetric, JsonEncodeMetricGroupDescriptions, LoadEvents,
MetricGroup)
from common_metrics import Cycles
# Global command line arguments.
_args = None
def main() -> None:
global _args
def dir_path(path: str) -> str:
"""Validate path is a directory for argparse."""
if os.path.isdir(path):
return path
raise argparse.ArgumentTypeError(
f'\'{path}\' is not a valid directory')
parser = argparse.ArgumentParser(description="ARM perf json generator")
parser.add_argument(
"-metricgroups", help="Generate metricgroups data", action='store_true')
parser.add_argument("vendor", help="e.g. arm")
parser.add_argument("model", help="e.g. neoverse-n1")
parser.add_argument(
'events_path',
type=dir_path,
help='Root of tree containing architecture directories containing json files'
)
_args = parser.parse_args()
directory = f"{_args.events_path}/arm64/{_args.vendor}/{_args.model}/"
LoadEvents(directory)
all_metrics = MetricGroup("", [
Cycles(),
])
if _args.metricgroups:
print(JsonEncodeMetricGroupDescriptions(all_metrics))
else:
print(JsonEncodeMetric(all_metrics))
if __name__ == '__main__':
main()
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.