Lines Matching defs:pm
336 static void perf_monitor_free(void *pm) {
337 zfree(perf_small_zone, pm);
340 static void perf_monitor_init(perf_monitor_t pm, int cpu) {
341 assert(pm);
343 pm->object = NULL;
345 bzero(&(pm->methods), sizeof(perf_monitor_methods_t));
347 pm->useCount = 1; /* initial retain count of 1, for caller */
349 pm->reservedCounters = 0;
351 pm->cpu = cpu;
353 pm->link.next = pm->link.prev = (queue_entry_t)NULL;
354 pm->cpu_link.next = pm->cpu_link.prev = (queue_entry_t)NULL;
361 static void perf_monitor_dequeue(perf_monitor_t pm) {
364 if (pm->methods.flags & PERFMON_FLAG_REQUIRES_IDLE_NOTIFICATIONS) {
368 queue_remove(cpu_monitor_queues[pm->cpu], pm, perf_monitor_t, cpu_link);
372 * remove the @pm object from the @perf_monitor_queue queue (it is of type
375 queue_remove(perf_monitors_queue, pm, perf_monitor_t, link);
386 static void perf_monitor_enqueue(perf_monitor_t pm) {
391 if (pm->cpu >= 0) {
418 queue_enter(cpu_monitor_queues[pm->cpu], pm, perf_monitor_t, cpu_link);
421 queue_enter(perf_monitors_queue, pm, perf_monitor_t, link);
432 static void perf_monitor_reference(perf_monitor_t pm) {
433 assert(pm);
435 OSIncrementAtomic(&(pm->useCount));
443 static void perf_monitor_deallocate(perf_monitor_t pm) {
444 assert(pm);
447 if(1 == OSDecrementAtomic(&(pm->useCount))) {
449 perf_monitor_free(pm);
489 static void perf_monitor_add_pmc(perf_monitor_t pm, pmc_t pmc __unused) {
490 assert(pm);
494 perf_monitor_reference(pm);
501 static void perf_monitor_remove_pmc(perf_monitor_t pm, pmc_t pmc __unused) {
502 assert(pm);
506 perf_monitor_deallocate(pm);
1810 perf_monitor_t pm = perf_monitor_alloc();
1811 if(!pm) {
1816 perf_monitor_init(pm, cpu);
1819 pm->object = monitor;
1820 memcpy(&(pm->methods), methods, sizeof(perf_monitor_methods_t));
1823 perf_monitor_enqueue(pm);
1826 PRINT_PERF_MON(pm);
1845 perf_monitor_t pm = perf_monitor_find(monitor);
1846 if(pm) {
1848 perf_monitor_dequeue(pm);
1851 perf_monitor_deallocate(pm);
1854 perf_monitor_deallocate(pm);
1858 COUNTER_DEBUG("could not find a registered pm that matches!\n");
1916 perf_monitor_t pm = perf_monitor_find(monitor);
1917 if(!pm) {
1926 perf_monitor_deallocate(pm);
1939 pmc->monitor = pm;
1947 perf_monitor_deallocate(pm);