Lines Matching +full:row +full:- +full:hold
2 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
66 def removesuffix(s: str, suffix: str) -> str:
72 return s[0:-len(suffix)] if s.endswith(suffix) else s
76 dirname: str) -> str:
82 return tblname.replace('-', '_')
85 def c_len(s: str) -> int:
97 utf = s.encode(encoding='utf-8',errors='strict')
101 return len(utf) - utf.count(b'\\') + utf.count(b'\\\\') - (utf.count(b'\\000') * 2)
104 """A class to hold many strings concatenated together.
106 Generating a large number of stand-alone C strings creates a large
113 strings are merged. If a longer string ends-with the same value as a
129 def add(self, s: str, metric: bool) -> None:
138 def compute(self) -> None:
144 sorted_reversed_strings = sorted([x[::-1] for x in self.strings])
160 folded_strings[s[::-1]] = sorted_reversed_strings[best_pos][::-1]
169 # being appended to - comments, etc. don't count. big_string is
177 def string_cmp_key(s: str) -> Tuple[bool, int, str]:
197 self.offsets[s] = self.offsets[folded_s] + c_len(folded_s) - c_len(s)
207 def llx(x: int) -> str:
211 def fixdesc(s: str) -> str:
219 def convert_aggr_mode(aggr_mode: str) -> Optional[str]:
229 def convert_metric_constraint(metric_constraint: str) -> Optional[str]:
242 def lookup_msr(num: str) -> Optional[str]:
254 def real_event(name: str, event: str) -> Optional[str]:
270 def unit_to_pmu(unit: str) -> Optional[str]:
280 'iMPH-U': 'uncore_arb',
281 'CPU-M-CF': 'cpum_cf',
282 'CPU-M-SF': 'cpum_sf',
283 'PAI-CRYPTO' : 'pai_crypto',
284 'PAI-EXT' : 'pai_ext',
304 def is_zero(val: str) -> bool:
313 def canonicalize_value(val: str) -> str:
417 def __repr__(self) -> str:
425 def build_c_string(self, metric: bool) -> str:
441 def to_c_string(self, metric: bool) -> str:
444 def fix_comment(s: str) -> str:
452 def read_json_events(path: str, topic: str) -> Sequence[JsonEvent]:
462 if event.metric_name and '-' not in event.metric_name:
474 def preprocess_arch_std_files(archpath: str) -> None:
490 def add_events_table_entries(item: os.DirEntry, topic: str) -> None:
499 def print_pending_events() -> None:
502 def event_cmp_key(j: JsonEvent) -> Tuple[str, str, bool, str, str]:
503 def fix_none(s: Optional[str]) -> str:
559 def print_pending_metrics() -> None:
562 def metric_cmp_key(j: JsonEvent) -> Tuple[bool, str, str]:
563 def fix_none(s: Optional[str]) -> str:
614 def get_topic(topic: str) -> str:
617 return removesuffix(topic, '.json').replace('-', ' ')
619 def preprocess_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
655 def process_one_file(parents: Sequence[str], item: os.DirEntry) -> None:
657 def is_leaf_dir_ignoring_sys(path: str) -> bool:
693 def print_mapping_table(archs: Sequence[str]) -> None:
710 * cpuid field, which is an arch-specific identifier for the CPU.
711 * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
759 for row in table:
760 # Skip the first row or any row beginning with #.
761 if not first and len(row) > 0 and not row[0].startswith('#'):
762 event_tblname = file_name_to_table_name('pmu_events_', [], row[2].replace('/', '_'))
768 metric_tblname = file_name_to_table_name('pmu_metrics_', [], row[2].replace('/', '_'))
776 cpuid = row[0].replace('\\', '\\\\')
802 def print_system_mapping_table() -> None:
854 _args.output_file.write(f'\n\tpe->{attr} = ')
856 _args.output_file.write("*p - '0';\n")
859 if attr == _json_event_attributes[-1]:
872 _args.output_file.write(f'\n\tpm->{attr} = ')
874 _args.output_file.write("*p - '0';\n")
877 if attr == _json_metric_attributes[-1]:
892 .pmu = &big_c_string[pmu->pmu_name.offset],
895 for (uint32_t i = 0; i < pmu->num_entries; i++) {
896 decompress_event(pmu->entries[i].offset, &pe);
913 .pmu = &big_c_string[pmu->pmu_name.offset],
915 int low = 0, high = pmu->num_entries - 1;
920 decompress_event(pmu->entries[mid].offset, &pe);
930 high = mid - 1;
940 high = mid - 1;
954 for (size_t i = 0; i < table->num_pmus; i++) {
955 const struct pmu_table_entry *table_pmu = &table->pmus[i];
956 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
975 for (size_t i = 0; i < table->num_pmus; i++) {
976 const struct pmu_table_entry *table_pmu = &table->pmus[i];
977 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
995 for (size_t i = 0; i < table->num_pmus; i++) {
996 const struct pmu_table_entry *table_pmu = &table->pmus[i];
997 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
1000 count += table_pmu->num_entries;
1012 .pmu = &big_c_string[pmu->pmu_name.offset],
1015 for (uint32_t i = 0; i < pmu->num_entries; i++) {
1016 decompress_metric(pmu->entries[i].offset, &pm);
1033 .pmu = &big_c_string[pmu->pmu_name.offset],
1035 int low = 0, high = pmu->num_entries - 1;
1040 decompress_metric(pmu->entries[mid].offset, &pm);
1050 high = mid - 1;
1060 high = mid - 1;
1073 for (size_t i = 0; i < table->num_pmus; i++) {
1074 int ret = pmu_metrics_table__for_each_metric_pmu(table, &table->pmus[i],
1089 for (size_t i = 0; i < table->num_pmus; i++) {
1090 const struct pmu_table_entry *table_pmu = &table->pmus[i];
1091 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
1139 if (!map->arch) {
1144 if (!strcmp_cpuid_str(map->cpuid, cpuid))
1161 struct perf_cpu cpu = {-1};
1167 if (!strcmp(pmu_name, pmu->name)) {
1170 while (strcmp("common", map->arch))
1175 cpu = perf_cpu_map__min(pmu->cpus);
1188 return &map->event_table;
1190 for (size_t i = 0; i < map->event_table.num_pmus; i++) {
1191 const struct pmu_table_entry *table_pmu = &map->event_table.pmus[i];
1192 const char *pmu_name = &big_c_string[table_pmu->pmu_name.offset];
1195 return &map->event_table;
1202 struct perf_cpu cpu = {-1};
1205 return map ? &map->metric_table : NULL;
1211 tables->arch;
1213 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid))
1214 return &tables->event_table;
1222 tables->arch;
1224 if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cpuid))
1225 return &tables->metric_table;
1233 tables->arch;
1235 int ret = pmu_events_table__for_each_event(&tables->event_table,
1247 tables->arch;
1249 int ret = pmu_metrics_table__for_each_metric(&tables->metric_table, fn, data);
1260 tables->name;
1262 if (!strcmp(tables->name, name))
1263 return &tables->event_table;
1271 tables->name;
1273 int ret = pmu_events_table__for_each_event(&tables->event_table,
1285 tables->name;
1287 int ret = pmu_metrics_table__for_each_metric(&tables->metric_table, fn, data);
1296 def print_metricgroups() -> None:
1310 int low = 0, high = (int)ARRAY_SIZE(metricgroups) - 1;
1322 high = mid - 1;
1329 def main() -> None:
1332 def dir_path(path: str) -> str:
1339 action: Callable[[Sequence[str], os.DirEntry], None]) -> None:
1361 such as "arm/cortex-a34".''',
1369 'output_file', type=argparse.FileType('w', encoding='utf-8'), nargs='?', default=sys.stdout)
1373 /* SPDX-License-Identifier: GPL-2.0 */
1377 #include <pmu-events/pmu-events.h>