cregit-Linux how code gets into the kernel

Release 4.10 tools/perf/tests/evsel-roundtrip-name.c

Directory: tools/perf/tests
#include "evlist.h"
#include "evsel.h"
#include "parse-events.h"
#include "tests.h"
#include "debug.h"


static int perf_evsel__roundtrip_cache_name_test(void) { char name[128]; int type, op, err = 0, ret = 0, i, idx; struct perf_evsel *evsel; struct perf_evlist *evlist = perf_evlist__new(); if (evlist == NULL) return -ENOMEM; for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { /* skip invalid cache type */ if (!perf_evsel__is_cache_op_valid(type, op)) continue; for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { __perf_evsel__hw_cache_type_op_res_name(type, op, i, name, sizeof(name)); err = parse_events(evlist, name, NULL); if (err) ret = err; } } } idx = 0; evsel = perf_evlist__first(evlist); for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { /* skip invalid cache type */ if (!perf_evsel__is_cache_op_valid(type, op)) continue; for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { __perf_evsel__hw_cache_type_op_res_name(type, op, i, name, sizeof(name)); if (evsel->idx != idx) continue; ++idx; if (strcmp(perf_evsel__name(evsel), name)) { pr_debug("%s != %s\n", perf_evsel__name(evsel), name); ret = -1; } evsel = perf_evsel__next(evsel); } } } perf_evlist__delete(evlist); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa28799.65%266.67%
namhyung kimnamhyung kim10.35%133.33%
Total288100.00%3100.00%


static int __perf_evsel__name_array_test(const char *names[], int nr_names) { int i, err; struct perf_evsel *evsel; struct perf_evlist *evlist = perf_evlist__new(); if (evlist == NULL) return -ENOMEM; for (i = 0; i < nr_names; ++i) { err = parse_events(evlist, names[i], NULL); if (err) { pr_debug("failed to parse event '%s', err %d\n", names[i], err); goto out_delete_evlist; } } err = 0; evlist__for_each_entry(evlist, evsel) { if (strcmp(perf_evsel__name(evsel), names[evsel->idx])) { --err; pr_debug("%s != %s\n", perf_evsel__name(evsel), names[evsel->idx]); } } out_delete_evlist: perf_evlist__delete(evlist); return err; }

Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa15097.40%240.00%
arnaldo carvalho de meloarnaldo carvalho de melo31.95%240.00%
namhyung kimnamhyung kim10.65%120.00%
Total154100.00%5100.00%

#define perf_evsel__name_array_test(names) \ __perf_evsel__name_array_test(names, ARRAY_SIZE(names))
int test__perf_evsel__roundtrip_name_test(int subtest __maybe_unused) { int err = 0, ret = 0; err = perf_evsel__name_array_test(perf_evsel__hw_names); if (err) ret = err; err = __perf_evsel__name_array_test(perf_evsel__sw_names, PERF_COUNT_SW_DUMMY + 1); if (err) ret = err; err = perf_evsel__roundtrip_cache_name_test(); if (err) ret = err; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa6595.59%266.67%
arnaldo carvalho de meloarnaldo carvalho de melo34.41%133.33%
Total68100.00%3100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
jiri olsajiri olsa52598.50%450.00%
arnaldo carvalho de meloarnaldo carvalho de melo61.13%337.50%
namhyung kimnamhyung kim20.38%112.50%
Total533100.00%8100.00%
Directory: tools/perf/tests
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.