Lines Matching refs:mch
81 prepare_kpc(struct machine *mch, bool config, uint64_t event) in prepare_kpc() argument
89 size_t ncpus_sz = sizeof(mch->ncpus); in prepare_kpc()
90 int ret = sysctlbyname("hw.logicalcpu_max", &mch->ncpus, &ncpus_sz, in prepare_kpc()
95 T_ASSERT_GT(mch->ncpus, 0, "must have some number of CPUs"); in prepare_kpc()
105 mch->nfixed = kpc_get_counter_count(KPC_CLASS_FIXED_MASK); in prepare_kpc()
106 mch->nconfig = kpc_get_counter_count(KPC_CLASS_CONFIGURABLE_MASK); in prepare_kpc()
108 T_LOG("machine: ncpus = %d, nfixed = %d, nconfig = %d", mch->ncpus, in prepare_kpc()
109 mch->nfixed, mch->nconfig); in prepare_kpc()
131 struct machine mch = {}; in kpc_reset_atend() local
132 prepare_kpc(&mch, true, 0); in kpc_reset_atend()
133 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods)); in kpc_reset_atend()
152 start_threads(const struct machine *mch, void *(*func)(void *), void *arg) in start_threads() argument
156 pthread_t *threads = calloc((unsigned int)mch->ncpus, in start_threads()
159 for (unsigned int i = 0; i < mch->ncpus; i++) { in start_threads()
170 end_threads(const struct machine *mch, pthread_t *threads) in end_threads() argument
172 for (unsigned int i = 0; i < mch->ncpus; i++) { in end_threads()
257 struct machine mch = {}; variable
258 prepare_kpc(&mch, true, CYCLES_EVENT);
261 pthread_t *threads = start_threads(&mch, spin, &until);
269 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
270 struct tally *tly = calloc(mch.ncpus * mch.nconfig, sizeof(*tly));
281 check_counters(mch.ncpus, mch.nconfig, tly, counts);
290 check_tally(mch.ncpus, mch.nconfig, tly);
293 end_threads(&mch, threads);
375 struct machine mch = {}; variable
376 prepare_kpc(&mch, true, CYCLES_EVENT);
380 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
388 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
404 struct cpu *cpus = calloc(mch.ncpus, sizeof(*cpus));
503 memset(counts, 0, sizeof(*counts) * mch.ncpus * (mch.nfixed + mch.nconfig));
504 struct tally *tly = calloc(mch.ncpus * (mch.nconfig + mch.nfixed),
530 check_counters(mch.ncpus, mch.nfixed + mch.nconfig, tly, counts);
535 (void)start_threads(&mch, spin, &stop);
540 check_tally(mch.ncpus, mch.nfixed + mch.nconfig, tly);
563 for (unsigned int i = 0; i < mch.ncpus; i++) {
587 unsigned int ctr = i * (mch.nfixed + mch.nconfig) + mch.nfixed;
607 cpu_sample_count, mch.ncpus);
608 T_EXPECT_EQ(cpu_sample_count, mch.ncpus,
669 struct machine mch = {}; variable
670 prepare_kpc(&mch, true, DTLB_MISS_EVENT);
674 uint64_t *periods = calloc(mch.nconfig, sizeof(*periods));
676 for (unsigned int i = 0; i < mch.nconfig; i++) {
689 int32_t *actions = calloc(mch.nconfig, sizeof(*actions));
690 for (unsigned int i = 0; i < mch.nconfig; i++) {