Lines Matching +full:jd +full:- +full:invert
51 #include "pmu-events.h"
80 return -1; in convert()
124 strncat(*dst, map + bt->start, blen); in addfield()
138 --e; in fixdesc()
140 --e; in fixdesc()
199 { "Invert", "inv=" },
213 for (i = newval->start; i < newval->end; i++) { in cut_comma()
215 newval->end = i; in cut_comma()
225 for (f = fields; f->field; f++) in match_field()
226 if (json_streq(map, field, f->field) && nz) { in match_field()
228 addfield(map, event, ",", f->kernel, &newval); in match_field()
247 json_len(val), map + val->start); in lookup_msr()
259 { "iMPH-U", "uncore_arb" },
260 { "CPU-M-CF", "cpum_cf" },
261 { "CPU-M-SF", "cpum_sf" },
284 if (!(t)->start && (t) > tokens) \
285 loc = (t) - 1; \
289 err = -EIO; \
310 if (c == '-') in get_topic()
328 return -ENOMEM; in add_topic()
349 FILE *outfp = pd->outfp; in print_events_table_entry()
350 char *topic = pd->topic; in print_events_table_entry()
358 if (je->name) in print_events_table_entry()
359 fprintf(outfp, "\t.name = \"%s\",\n", je->name); in print_events_table_entry()
360 if (je->event) in print_events_table_entry()
361 fprintf(outfp, "\t.event = \"%s\",\n", je->event); in print_events_table_entry()
362 fprintf(outfp, "\t.desc = \"%s\",\n", je->desc); in print_events_table_entry()
364 if (je->long_desc && je->long_desc[0]) in print_events_table_entry()
365 fprintf(outfp, "\t.long_desc = \"%s\",\n", je->long_desc); in print_events_table_entry()
366 if (je->pmu) in print_events_table_entry()
367 fprintf(outfp, "\t.pmu = \"%s\",\n", je->pmu); in print_events_table_entry()
368 if (je->unit) in print_events_table_entry()
369 fprintf(outfp, "\t.unit = \"%s\",\n", je->unit); in print_events_table_entry()
370 if (je->perpkg) in print_events_table_entry()
371 fprintf(outfp, "\t.perpkg = \"%s\",\n", je->perpkg); in print_events_table_entry()
372 if (je->aggr_mode) in print_events_table_entry()
373 fprintf(outfp, "\t.aggr_mode = \"%d\",\n", convert(je->aggr_mode)); in print_events_table_entry()
374 if (je->metric_expr) in print_events_table_entry()
375 fprintf(outfp, "\t.metric_expr = \"%s\",\n", je->metric_expr); in print_events_table_entry()
376 if (je->metric_name) in print_events_table_entry()
377 fprintf(outfp, "\t.metric_name = \"%s\",\n", je->metric_name); in print_events_table_entry()
378 if (je->metric_group) in print_events_table_entry()
379 fprintf(outfp, "\t.metric_group = \"%s\",\n", je->metric_group); in print_events_table_entry()
380 if (je->deprecated) in print_events_table_entry()
381 fprintf(outfp, "\t.deprecated = \"%s\",\n", je->deprecated); in print_events_table_entry()
382 if (je->metric_constraint) in print_events_table_entry()
383 fprintf(outfp, "\t.metric_constraint = \"%s\",\n", je->metric_constraint); in print_events_table_entry()
406 #define ADD_EVENT_FIELD(field) do { if (je->field) { \
407 es->field = strdup(je->field); \
408 if (!es->field) \
412 #define FREE_EVENT_FIELD(field) free(es->field)
414 #define TRY_FIXUP_FIELD(field) do { if (es->field && !je->field) {\
415 je->field = strdup(es->field); \
416 if (!je->field) \
417 return -ENOMEM; \
443 list_del_init(&es->list); in free_arch_std_events()
454 return -ENOMEM; in save_arch_std_events()
457 list_add_tail(&es->list, &arch_std_events); in save_arch_std_events()
462 return -ENOMEM; in save_arch_std_events()
514 if (!strcmp(arch_std, es->name)) { in try_fixup()
516 *event = je->event; in try_fixup()
523 return -1; in try_fixup()
539 return -ENOENT; in json_events()
543 return -EIO; in json_events()
544 EXPECT(tokens->type == JSMN_ARRAY, tokens, "expected top level array"); in json_events()
546 for (i = 0; i < tokens->size; i++) { in json_events()
558 EXPECT(obj->type == JSMN_OBJECT, obj, "expected object"); in json_events()
559 for (j = 0; j < obj->size; j += 2) { in json_events()
565 EXPECT(field->type == JSMN_STRING, tok + j, in json_events()
568 EXPECT(val->type == JSMN_STRING, tok + j + 1, in json_events()
667 addfield(map, &event, ",", msr->pname, msrval); in json_events()
704 EXPECT(tok - tokens == len, tok, "unexpected objects at end"); in json_events()
733 if (c == '-' || c == '/') in file_name_to_table_name()
798 return -1; in process_mapfile()
805 return -1; in process_mapfile()
827 if (line[strlen(line)-1] != '\n') { in process_mapfile()
831 ret = -1; in process_mapfile()
834 line[strlen(line)-1] = '\0'; in process_mapfile()
886 fprintf(outfp, "#include \"pmu-events/pmu-events.h\"\n"); in create_empty_mapping()
920 if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) in is_leaf_dir()
923 if (dir->d_type == DT_DIR) { in is_leaf_dir()
926 } else if (dir->d_type == DT_UNKNOWN) { in is_leaf_dir()
930 sprintf(path, "%s/%s", fpath, dir->d_name); in is_leaf_dir()
953 suffix = name + strlen(name) - 5; in is_json_file()
963 int level = ftwbuf->level; in preprocess_arch_std_files()
978 int level = ftwbuf->level; in process_one_file()
987 bname = (char *) fpath + ftwbuf->base - 2; in process_one_file()
991 bname--; in process_one_file()
995 bname = (char *) fpath + ftwbuf->base; in process_one_file()
997 pr_debug("%s %d %7jd %-20s %s\n", in process_one_file()
999 level, sb->st_size, bname, fpath); in process_one_file()
1021 return -1; in process_one_file()
1057 return -ENOMEM; in process_one_file()
1068 * i.e. if JSON file name cannot be mapped to C-style table name, in process_one_file()
1093 * From each JSON file, create a C-style "PMU events table" from the
1099 * Write out the PMU events tables and the mapping table to pmu-event.c.
1141 /* Include pmu-events.h first */ in main()
1142 fprintf(eventsfp, "#include \"pmu-events/pmu-events.h\"\n"); in main()
1146 * so, not sure if there is a need for symlinks within the pmu-events in main()
1173 pr_info("%s: No CPU->JSON mapping?\n", prog); in main()