Lines Matching refs:mch
96 prepare_kpc(struct machine *mch, unsigned int n, const char *event_name, in prepare_kpc() argument
115 size_t ncpus_sz = sizeof(mch->ncpus); in prepare_kpc()
116 ret = sysctlbyname("hw.logicalcpu_max", &mch->ncpus, &ncpus_sz, in prepare_kpc()
121 T_ASSERT_GT(mch->ncpus, 0, "must have some number of CPUs"); in prepare_kpc()
131 mch->nfixed = kpc_get_counter_count(KPC_CLASS_FIXED_MASK); in prepare_kpc()
132 mch->nconfig = kpc_get_counter_count(KPC_CLASS_CONFIGURABLE_MASK); in prepare_kpc()
134 T_LOG("machine: ncpus = %d, nfixed = %d, nconfig = %d", mch->ncpus, in prepare_kpc()
135 mch->nfixed, mch->nconfig); in prepare_kpc()
159 mch->selector = configs[i]; in prepare_kpc()
163 T_QUIET; T_ASSERT_NE(mch->selector, 0ULL, "found event selector to check"); in prepare_kpc()
203 start_threads(const struct machine *mch, void *(*func)(void *), void *arg) in start_threads() argument
207 pthread_t *threads = calloc((unsigned int)mch->ncpus, in start_threads()
210 for (unsigned int i = 0; i < mch->ncpus; i++) { in start_threads()
221 end_threads(const struct machine *mch, pthread_t *threads) in end_threads() argument
223 for (unsigned int i = 0; i < mch->ncpus; i++) { in end_threads()
310 struct machine mch = {}; variable
311 prepare_kpc(&mch, 0, "CORE_ACTIVE_CYCLE", 0);
314 pthread_t *threads = start_threads(&mch, spin, &until);
322 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
323 struct tally *tly = calloc(mch.ncpus * mch.nconfig, sizeof(*tly));
334 check_counters(mch.ncpus, mch.nconfig, tly, counts);
343 check_tally(mch.ncpus, mch.nconfig, tly);
346 end_threads(&mch, threads);
430 struct machine mch = {}; variable
431 prepare_kpc(&mch, 1, "CORE_ACTIVE_CYCLE", PMI_PERIOD);
435 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
451 struct cpu *cpus = calloc(mch.ncpus, sizeof(*cpus));
476 mch.selector & UINT16_MAX,
550 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
551 struct tally *tly = calloc(mch.ncpus * (mch.nconfig + mch.nfixed),
577 check_counters(mch.ncpus, mch.nfixed + mch.nconfig, tly, counts);
582 (void)start_threads(&mch, spin, &stop);
587 check_tally(mch.ncpus, mch.nfixed + mch.nconfig, tly);
610 for (unsigned int i = 0; i < mch.ncpus; i++) {
634 unsigned int ctr = i * (mch.nfixed + mch.nconfig) + mch.nfixed;
654 cpu_sample_count, mch.ncpus);
655 T_EXPECT_EQ(cpu_sample_count, mch.ncpus,
714 struct machine mch = {}; variable
715 prepare_kpc(&mch, 0, "INST_BRANCH_TAKEN", PMI_PERIOD);
719 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
721 for (unsigned int i = 0; i < mch.nconfig; i++) {
734 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
735 for (unsigned int i = 0; i < mch.nconfig; i++) {
774 T_ASSERT_EQ(KPC_DESC_CONFIG(desc), mch.selector,