Lines Matching +full:row +full:- +full:hold
2 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
63 def removesuffix(s: str, suffix: str) -> str:
69 return s[0:-len(suffix)] if s.endswith(suffix) else s
73 dirname: str) -> str:
79 return tblname.replace('-', '_')
82 def c_len(s: str) -> int:
94 utf = s.encode(encoding='utf-8',errors='strict')
98 return len(utf) - utf.count(b'\\') + utf.count(b'\\\\') - (utf.count(b'\\000') * 2)
101 """A class to hold many strings concatenated together.
103 Generating a large number of stand-alone C strings creates a large
110 strings are merged. If a longer string ends-with the same value as a
126 def add(self, s: str, metric: bool) -> None:
135 def compute(self) -> None:
141 sorted_reversed_strings = sorted([x[::-1] for x in self.strings])
157 folded_strings[s[::-1]] = sorted_reversed_strings[best_pos][::-1]
166 # being appended to - comments, etc. don't count. big_string is
174 def string_cmp_key(s: str) -> Tuple[bool, int, str]:
194 self.offsets[s] = self.offsets[folded_s] + c_len(folded_s) - c_len(s)
204 def llx(x: int) -> str:
208 def fixdesc(s: str) -> str:
216 def convert_aggr_mode(aggr_mode: str) -> Optional[str]:
226 def convert_metric_constraint(metric_constraint: str) -> Optional[str]:
238 def lookup_msr(num: str) -> Optional[str]:
250 def real_event(name: str, event: str) -> Optional[str]:
266 def unit_to_pmu(unit: str) -> Optional[str]:
276 'iMPH-U': 'uncore_arb',
277 'CPU-M-CF': 'cpum_cf',
278 'CPU-M-SF': 'cpum_sf',
279 'PAI-CRYPTO' : 'pai_crypto',
280 'PAI-EXT' : 'pai_ext',
299 def is_zero(val: str) -> bool:
308 def canonicalize_value(val: str) -> str:
406 def __repr__(self) -> str:
414 def build_c_string(self, metric: bool) -> str:
430 def to_c_string(self, metric: bool) -> str:
433 def fix_comment(s: str) -> str:
441 def read_json_events(path: str, topic: str) -> Sequence[JsonEvent]:
451 if event.metric_name and '-' not in event.metric_name:
463 def preprocess_arch_std_files(archpath: str) -> None:
479 def add_events_table_entries(item: os.DirEntry, topic: str) -> None:
488 def print_pending_events() -> None:
491 def event_cmp_key(j: JsonEvent) -> Tuple[str, str, bool, str, str]:
492 def fix_none(s: Optional[str]) -> str:
548 def print_pending_metrics() -> None:
551 def metric_cmp_key(j: JsonEvent) -> Tuple[bool, str, str]:
552 def fix_none(s: Optional[str]) -> str:
603 def get_topic(topic: str) -> str:
606 return removesuffix(topic, '.json').replace('-', ' ')
608 def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
644 def process_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
646 def is_leaf_dir_ignoring_sys(path: str) -> bool:
682 def print_mapping_table(archs: Sequence[str]) -> None:
699 * cpuid field, which is an arch-specific identifier for the CPU.
700 * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
748 for row in table:
749 # Skip the first row or any row beginning with #.
750 if not first and len(row) > 0 and not row[0].startswith('#'):
751 event_tblname = file_name_to_table_name('pmu_events_', [], row[2].replace('/', '_'))
757 metric_tblname = file_name_to_table_name('pmu_metrics_', [], row[2].replace('/', '_'))
765 cpuid = row[0].replace('\\', '\\\\')
791 def print_system_mapping_table() -> None:
843 _args.output_file.write(f'\n\tpe->{attr} = ')
845 _args.output_file.write("*p - '0';\n")
848 if attr == _json_event_attributes[-1]:
861 _args.output_file.write(f'\n\tpm->{attr} = ')
863 _args.output_file.write("*p - '0';\n")
866 if attr == _json_metric_attributes[-1]:
881 .pmu = &big_c_string[pmu->pmu_name.offset],
884 for (uint32_t i = 0; i < pmu->num_entries; i++) {
885 decompress_event(pmu->entries[i].offset, &pe);
902 .pmu = &big_c_string[pmu->pmu_name.offset],
904 int low = 0, high = pmu->num_entries - 1;
909 decompress_event(pmu->entries[mid].offset, &pe);
919 high = mid - 1;
929 high = mid - 1;
943 for (size_t i = 0; i < table->num_pmus; i++) {
944 const struct pmu_table_entry *table_pmu = &table->pmus[i];
945 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
964 for (size_t i = 0; i < table->num_pmus; i++) {
965 const struct pmu_table_entry *table_pmu = &table->pmus[i];
966 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
984 for (size_t i = 0; i < table->num_pmus; i++) {
985 const struct pmu_table_entry *table_pmu = &table->pmus[i];
986 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
989 count += table_pmu->num_entries;
1001 .pmu = &big_c_string[pmu->pmu_name.offset],
1004 for (uint32_t i = 0; i < pmu->num_entries; i++) {
1005 decompress_metric(pmu->entries[i].offset, &pm);
1019 for (size_t i = 0; i < table->num_pmus; i++) {
1020 int ret = pmu_metrics_table__for_each_metric_pmu(table, &table->pmus[i],
1064 if (!map->arch) {
1069 if (!strcmp_cpuid_str(map->cpuid, cpuid))
1086 struct perf_cpu cpu = {-1};
1089 cpu = perf_cpu_map__min(pmu->cpus);
1101 return &map->event_table;
1103 for (size_t i = 0; i < map->event_table.num_pmus; i++) {
1104 const struct pmu_table_entry *table_pmu = &map->event_table.pmus[i];
1105 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
1108 return &map->event_table;
1115 struct perf_cpu cpu = {-1};
1118 return map ? &map->metric_table : NULL;
1124 tables->arch;
1126 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid))
1127 return &tables->event_table;
1135 tables->arch;
1137 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid))
1138 return &tables->metric_table;
1146 tables->arch;
1148 int ret = pmu_events_table__for_each_event(&tables->event_table,
1160 tables->arch;
1162 int ret = pmu_metrics_table__for_each_metric(&tables->metric_table, fn, data);
1173 tables->name;
1175 if (!strcmp(tables->name, name))
1176 return &tables->event_table;
1184 tables->name;
1186 int ret = pmu_events_table__for_each_event(&tables->event_table,
1198 tables->name;
1200 int ret = pmu_metrics_table__for_each_metric(&tables->metric_table, fn, data);
1209 def print_metricgroups() -> None:
1223 int low = 0, high = (int)ARRAY_SIZE(metricgroups) - 1;
1235 high = mid - 1;
1242 def main() -> None:
1245 def dir_path(path: str) -> str:
1252 action: Callable[[Sequence[str], os.DirEntry], None]) -> None:
1274 such as "arm/cortex-a34".''',
1282 'output_file', type=argparse.FileType('w', encoding='utf-8'), nargs='?', default=sys.stdout)
1286 /* SPDX-License-Identifier: GPL-2.0 */
1290 #include <pmu-events/pmu-events.h>