From ba1875a48864fb144467d2adc57fc4a9a219910b Mon Sep 17 00:00:00 2001 From: patrickkenney9801 Date: Tue, 10 Dec 2024 13:29:47 -0600 Subject: [PATCH] chore: Add dTLB walk duration perf event in cycles --- python/kernmlops/data_schema/perf/__init__.py | 8 +++- python/kernmlops/data_schema/perf/tlb_perf.py | 48 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/python/kernmlops/data_schema/perf/__init__.py b/python/kernmlops/data_schema/perf/__init__.py index 5ec1cfb..a968d77 100644 --- a/python/kernmlops/data_schema/perf/__init__.py +++ b/python/kernmlops/data_schema/perf/__init__.py @@ -4,12 +4,18 @@ CustomHWEventID, PerfCollectionTable, ) -from data_schema.perf.tlb_perf import DTLBPerfTable, ITLBPerfTable, TLBFlushPerfTable +from data_schema.perf.tlb_perf import ( + DTLBPerfTable, + DTLBWalkDurationPerfTable, + ITLBPerfTable, + TLBFlushPerfTable, +) perf_table_types: Mapping[str, type[PerfCollectionTable]] = { DTLBPerfTable.name(): DTLBPerfTable, ITLBPerfTable.name(): ITLBPerfTable, TLBFlushPerfTable.name(): TLBFlushPerfTable, + DTLBWalkDurationPerfTable.name(): DTLBWalkDurationPerfTable, } __all__ = [ diff --git a/python/kernmlops/data_schema/perf/tlb_perf.py b/python/kernmlops/data_schema/perf/tlb_perf.py index 257a160..13f095d 100644 --- a/python/kernmlops/data_schema/perf/tlb_perf.py +++ b/python/kernmlops/data_schema/perf/tlb_perf.py @@ -275,3 +275,51 @@ def with_graph_engine(cls, graph_engine: GraphEngine) -> CollectionGraph | None: perf_table=perf_table ) return None + + +class DTLBWalkDurationPerfTable(PerfCollectionTable): + + @classmethod + def name(cls) -> str: + return "dtlb_walk_duration" + + @classmethod + def ev_type(cls) -> int: + return PerfType.RAW + + @classmethod + def ev_config(cls) -> int: + return 0 + + @classmethod + def hw_ids(cls) -> list[CustomHWEventID]: + return [ + CustomHWEventID(name="DTLB_LOAD_MISSES", umask="WALK_DURATION"), + ] + + @classmethod + def component_name(cls) -> str: + return "dTLB" + + @classmethod + def measured_event_name(cls) -> str: + return "Walk Durations" + + @classmethod + def from_df(cls, table: pl.DataFrame) -> "DTLBWalkDurationPerfTable": + return DTLBWalkDurationPerfTable(table=table.cast(cls.schema(), strict=True)) # pyright: ignore [reportArgumentType] + + def __init__(self, table: pl.DataFrame): + self._table = table + + @property + def table(self) -> pl.DataFrame: + return self._table + + def filtered_table(self) -> pl.DataFrame: + return self.table + + def graphs(self) -> list[type[CollectionGraph]]: + return [] + +