Lines Matching refs:mch

79 prepare_kpc(struct machine *mch, bool config, uint64_t event)  in prepare_kpc()  argument
87 size_t ncpus_sz = sizeof(mch->ncpus); in prepare_kpc()
88 int ret = sysctlbyname("hw.logicalcpu_max", &mch->ncpus, &ncpus_sz, in prepare_kpc()
93 T_ASSERT_GT(mch->ncpus, 0, "must have some number of CPUs"); in prepare_kpc()
103 mch->nfixed = kpc_get_counter_count(KPC_CLASS_FIXED_MASK); in prepare_kpc()
104 mch->nconfig = kpc_get_counter_count(KPC_CLASS_CONFIGURABLE_MASK); in prepare_kpc()
106 T_LOG("machine: ncpus = %d, nfixed = %d, nconfig = %d", mch->ncpus, in prepare_kpc()
107 mch->nfixed, mch->nconfig); in prepare_kpc()
129 struct machine mch = {}; in kpc_reset_atend() local
130 prepare_kpc(&mch, true, 0); in kpc_reset_atend()
131 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods)); in kpc_reset_atend()
150 start_threads(const struct machine *mch, void *(*func)(void *), void *arg) in start_threads() argument
154 pthread_t *threads = calloc((unsigned int)mch->ncpus, in start_threads()
157 for (unsigned int i = 0; i < mch->ncpus; i++) { in start_threads()
168 end_threads(const struct machine *mch, pthread_t *threads) in end_threads() argument
170 for (unsigned int i = 0; i < mch->ncpus; i++) { in end_threads()
253 struct machine mch = {}; variable
254 prepare_kpc(&mch, true, CYCLES_EVENT);
257 pthread_t *threads = start_threads(&mch, spin, &until);
265 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
266 struct tally *tly = calloc(mch.ncpus * mch.nconfig, sizeof(*tly));
277 check_counters(mch.ncpus, mch.nconfig, tly, counts);
286 check_tally(mch.ncpus, mch.nconfig, tly);
289 end_threads(&mch, threads);
368 struct machine mch = {}; variable
369 prepare_kpc(&mch, true, CYCLES_EVENT);
373 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
381 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
397 struct cpu *cpus = calloc(mch.ncpus, sizeof(*cpus));
496 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
497 struct tally *tly = calloc(mch.ncpus * (mch.nconfig + mch.nfixed),
523 check_counters(mch.ncpus, mch.nfixed + mch.nconfig, tly, counts);
528 (void)start_threads(&mch, spin, &stop);
533 check_tally(mch.ncpus, mch.nfixed + mch.nconfig, tly);
556 for (unsigned int i = 0; i < mch.ncpus; i++) {
580 unsigned int ctr = i * (mch.nfixed + mch.nconfig) + mch.nfixed;
600 cpu_sample_count, mch.ncpus);
601 T_EXPECT_EQ(cpu_sample_count, mch.ncpus,
659 struct machine mch = {}; variable
660 prepare_kpc(&mch, true, DTLB_MISS_EVENT);
664 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
666 for (unsigned int i = 0; i < mch.nconfig; i++) {
679 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
680 for (unsigned int i = 0; i < mch.nconfig; i++) {