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