Lines Matching refs:tb

209 	tprof_backend_t *tb;  in tprof_worker()  local
224 tb = tprof_backend; in tprof_worker()
225 shouldstop = (tb == NULL || tb->tb_softc.sc_ctr_running_mask == 0); in tprof_worker()
289 tprof_backend_t *tb; in tprof_getinfo() local
295 if ((tb = tprof_backend) != NULL) in tprof_getinfo()
296 info->ti_ident = tb->tb_ops->tbo_ident(); in tprof_getinfo()
302 tprof_backend_t *tb; in tprof_getncounters() local
304 tb = tprof_backend; in tprof_getncounters()
305 if (tb == NULL) in tprof_getncounters()
308 *ncounters = tb->tb_ops->tbo_ncounters(); in tprof_getncounters()
315 tprof_backend_t *tb = arg1; in tprof_start_cpu() local
318 tb->tb_ops->tbo_start(runmask); in tprof_start_cpu()
324 tprof_backend_t *tb = arg1; in tprof_stop_cpu() local
327 tb->tb_ops->tbo_stop(stopmask); in tprof_stop_cpu()
335 tprof_backend_t *tb; in tprof_start() local
342 tb = tprof_backend; in tprof_start()
343 if (tb == NULL) { in tprof_start()
348 runmask &= ~tb->tb_softc.sc_ctr_running_mask; in tprof_start()
349 runmask &= tb->tb_softc.sc_ctr_configured_mask; in tprof_start()
359 firstrun = (tb->tb_softc.sc_ctr_running_mask == 0); in tprof_start()
361 if (tb->tb_ops->tbo_establish != NULL) { in tprof_start()
362 error = tb->tb_ops->tbo_establish(&tb->tb_softc); in tprof_start()
372 if (tb->tb_ops->tbo_disestablish != NULL) in tprof_start()
373 tb->tb_ops->tbo_disestablish(&tb->tb_softc); in tprof_start()
392 runmask &= tb->tb_softc.sc_ctr_configured_mask; in tprof_start()
393 xc = xc_broadcast(0, tprof_start_cpu, tb, (void *)(uintptr_t)runmask); in tprof_start()
396 tb->tb_softc.sc_ctr_running_mask |= runmask; in tprof_start()
418 tprof_backend_t *tb; in tprof_stop() local
421 tb = tprof_backend; in tprof_stop()
422 if (tb == NULL) in tprof_stop()
426 stopmask &= tb->tb_softc.sc_ctr_running_mask; in tprof_stop()
432 xc = xc_broadcast(0, tprof_stop_cpu, tb, (void *)(uintptr_t)stopmask); in tprof_stop()
435 tb->tb_softc.sc_ctr_running_mask &= ~stopmask; in tprof_stop()
439 if (tb->tb_softc.sc_ctr_running_mask == 0) { in tprof_stop()
448 if (tb->tb_ops->tbo_disestablish != NULL) in tprof_stop()
449 tb->tb_ops->tbo_disestablish(&tb->tb_softc); in tprof_stop()
461 tprof_backend_t *tb = tprof_backend; in tprof_init_percpu_counters_offset() local
462 tprof_param_t *param = &tb->tb_softc.sc_count[counter].ctr_param; in tprof_init_percpu_counters_offset()
469 tprof_backend_t *tb = arg1; in tprof_configure_event_cpu() local
471 tprof_param_t *param = &tb->tb_softc.sc_count[counter].ctr_param; in tprof_configure_event_cpu()
473 tb->tb_ops->tbo_configure_event(counter, param); in tprof_configure_event_cpu()
479 tprof_backend_t *tb; in tprof_configure_event() local
490 tb = tprof_backend; in tprof_configure_event()
491 if (tb == NULL) { in tprof_configure_event()
495 sc = &tb->tb_softc; in tprof_configure_event()
498 if (c >= tb->tb_softc.sc_ncounters) { in tprof_configure_event()
503 if (tb->tb_ops->tbo_valid_event != NULL) { in tprof_configure_event()
504 error = tb->tb_ops->tbo_valid_event(param->p_counter, param); in tprof_configure_event()
510 if (ISSET(c, tb->tb_softc.sc_ctr_running_mask)) in tprof_configure_event()
514 tb->tb_ops->tbo_counter_bitwidth(param->p_counter); in tprof_configure_event()
522 freq = tb->tb_ops->tbo_counter_estimate_freq(c); in tprof_configure_event()
572 percpu_foreach(tb->tb_softc.sc_ctr_offset_percpu, in tprof_configure_event()
575 sc_param->p_value = tb->tb_softc.sc_count[c].ctr_counter_reset_val; in tprof_configure_event()
578 tb, (void *)(uintptr_t)c); in tprof_configure_event()
583 SET(tb->tb_softc.sc_ctr_configured_mask, __BIT(c)); in tprof_configure_event()
584 CLR(tb->tb_softc.sc_ctr_prof_mask, __BIT(c)); in tprof_configure_event()
585 CLR(tb->tb_softc.sc_ctr_ovf_mask, __BIT(c)); in tprof_configure_event()
588 SET(tb->tb_softc.sc_ctr_prof_mask, __BIT(c)); in tprof_configure_event()
589 SET(tb->tb_softc.sc_ctr_ovf_mask, __BIT(c)); in tprof_configure_event()
593 SET(tb->tb_softc.sc_ctr_ovf_mask, __BIT(c)); in tprof_configure_event()
605 tprof_backend_t *tb = arg1; in tprof_getcounts_cpu() local
606 tprof_backend_softc_t *sc = &tb->tb_softc; in tprof_getcounts_cpu()
615 uint64_t ctr = tb->tb_ops->tbo_counter_read(c); in tprof_getcounts_cpu()
629 tprof_backend_t *tb; in tprof_getcounts() local
632 tb = tprof_backend; in tprof_getcounts()
633 if (tb == NULL) in tprof_getcounts()
642 xc = xc_unicast(0, tprof_getcounts_cpu, tb, counts->c_count, ci); in tprof_getcounts()
645 counts->c_ncounters = tb->tb_softc.sc_ncounters; in tprof_getcounts()
646 counts->c_runningmask = tb->tb_softc.sc_ctr_running_mask; in tprof_getcounts()
682 tprof_backend_t *tb; in tprof_backend_lookup() local
686 LIST_FOREACH(tb, &tprof_backends, tb_list) { in tprof_backend_lookup()
687 if (!strcmp(tb->tb_name, name)) { in tprof_backend_lookup()
688 return tb; in tprof_backend_lookup()
739 tprof_backend_t *tb; in tprof_backend_register() local
745 tb = tprof_backend_lookup(name); in tprof_backend_register()
746 if (tb != NULL) { in tprof_backend_register()
756 tb = kmem_zalloc(sizeof(*tb), KM_SLEEP); in tprof_backend_register()
757 tb->tb_name = name; in tprof_backend_register()
758 tb->tb_ops = ops; in tprof_backend_register()
759 LIST_INSERT_HEAD(&tprof_backends, tb, tb_list); in tprof_backend_register()
762 tprof_backend = tb; in tprof_backend_register()
768 tb->tb_softc.sc_ncounters = tb->tb_ops->tbo_ncounters(); in tprof_backend_register()
769 tb->tb_softc.sc_ctr_offset_percpu_size = in tprof_backend_register()
770 sizeof(uint64_t) * tb->tb_softc.sc_ncounters; in tprof_backend_register()
771 tb->tb_softc.sc_ctr_offset_percpu = in tprof_backend_register()
772 percpu_alloc(tb->tb_softc.sc_ctr_offset_percpu_size); in tprof_backend_register()
784 tprof_backend_t *tb; in tprof_backend_unregister() local
787 tb = tprof_backend_lookup(name); in tprof_backend_unregister()
789 if (tb == NULL) { in tprof_backend_unregister()
794 if (tb->tb_softc.sc_ctr_running_mask != 0) { in tprof_backend_unregister()
799 if (tprof_backend == tb) in tprof_backend_unregister()
802 LIST_REMOVE(tb, tb_list); in tprof_backend_unregister()
806 percpu_free(tb->tb_softc.sc_ctr_offset_percpu, in tprof_backend_unregister()
807 tb->tb_softc.sc_ctr_offset_percpu_size); in tprof_backend_unregister()
810 kmem_free(tb, sizeof(*tb)); in tprof_backend_unregister()
848 tprof_backend_t *tb = tprof_backend; in tprof_close() local
849 if (tb != NULL) { in tprof_close()
850 KASSERT(tb->tb_softc.sc_ctr_running_mask == 0); in tprof_close()
851 tb->tb_softc.sc_ctr_configured_mask = 0; in tprof_close()
852 tb->tb_softc.sc_ctr_prof_mask = 0; in tprof_close()
853 tb->tb_softc.sc_ctr_ovf_mask = 0; in tprof_close()