Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libpmc/pmu-events/jevents.c
Show First 20 Lines • Show All 788 Lines • ▼ Show 20 Lines | process_mapfile(FILE *outfp, char *fpath) | ||||
line = malloc(n); | line = malloc(n); | ||||
if (!line) | if (!line) | ||||
return -1; | return -1; | ||||
mapfp = fopen(fpath, "r"); | mapfp = fopen(fpath, "r"); | ||||
if (!mapfp) { | if (!mapfp) { | ||||
pr_info("%s: Error %s opening %s\n", prog, strerror(errno), | pr_info("%s: Error %s opening %s\n", prog, strerror(errno), | ||||
fpath); | fpath); | ||||
free(line); | |||||
return -1; | return -1; | ||||
} | } | ||||
print_mapping_table_prefix(outfp); | print_mapping_table_prefix(outfp); | ||||
/* Skip first line (header) */ | /* Skip first line (header) */ | ||||
p = fgets(line, n, mapfp); | p = fgets(line, n, mapfp); | ||||
if (!p) | if (!p) | ||||
Show All 40 Lines | while (1) { | ||||
* ignore the type field here also. | * ignore the type field here also. | ||||
*/ | */ | ||||
fprintf(outfp, "\t.table = %s\n", tblname); | fprintf(outfp, "\t.table = %s\n", tblname); | ||||
fprintf(outfp, "},\n"); | fprintf(outfp, "},\n"); | ||||
} | } | ||||
out: | out: | ||||
print_mapping_table_suffix(outfp); | print_mapping_table_suffix(outfp); | ||||
free(line); | |||||
fclose(mapfp); | |||||
return 0; | return 0; | ||||
} | } | ||||
/* | /* | ||||
* If we fail to locate/process JSON and map files, create a NULL mapping | * If we fail to locate/process JSON and map files, create a NULL mapping | ||||
* table. This would at least allow perf to build even if we can't find/use | * table. This would at least allow perf to build even if we can't find/use | ||||
* the aliases. | * the aliases. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 422 Lines • Show Last 20 Lines |