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()
308 struct machine mch = {}; variable
309 prepare_kpc(&mch, 0, "CORE_ACTIVE_CYCLE", 0);
312 pthread_t *threads = start_threads(&mch, spin, &until);
320 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
321 struct tally *tly = calloc(mch.ncpus * mch.nconfig, sizeof(*tly));
332 check_counters(mch.ncpus, mch.nconfig, tly, counts);
341 check_tally(mch.ncpus, mch.nconfig, tly);
344 end_threads(&mch, threads);
426 struct machine mch = {}; variable
427 prepare_kpc(&mch, 1, "CORE_ACTIVE_CYCLE", PMI_PERIOD);
431 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
447 struct cpu *cpus = calloc(mch.ncpus, sizeof(*cpus));
472 mch.selector & UINT16_MAX,
546 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
547 struct tally *tly = calloc(mch.ncpus * (mch.nconfig + mch.nfixed),
573 check_counters(mch.ncpus, mch.nfixed + mch.nconfig, tly, counts);
578 (void)start_threads(&mch, spin, &stop);
583 check_tally(mch.ncpus, mch.nfixed + mch.nconfig, tly);
606 for (unsigned int i = 0; i < mch.ncpus; i++) {
630 unsigned int ctr = i * (mch.nfixed + mch.nconfig) + mch.nfixed;
650 cpu_sample_count, mch.ncpus);
651 T_EXPECT_EQ(cpu_sample_count, mch.ncpus,
710 struct machine mch = {}; variable
711 prepare_kpc(&mch, 0, "INST_BRANCH_TAKEN", PMI_PERIOD);
715 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
717 for (unsigned int i = 0; i < mch.nconfig; i++) {
730 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
731 for (unsigned int i = 0; i < mch.nconfig; i++) {
770 T_ASSERT_EQ(KPC_DESC_CONFIG(desc), mch.selector,