Skip to content

Commit

Permalink
chore: Add dTLB walk duration perf event in cycles (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkenney9801 authored Dec 10, 2024
1 parent 96915d4 commit 515a788
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/kernmlops/data_schema/perf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down
46 changes: 46 additions & 0 deletions python/kernmlops/data_schema/perf/tlb_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,49 @@ 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 []

0 comments on commit 515a788

Please sign in to comment.