Lines Matching +full:co +full:- +full:processors
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
85 /* Spin-lock protecting profiling statistics. */
103 if (req->flags & SCTL_MASK32) { in sysctl_kern_cp_time()
104 if (!req->oldptr) in sysctl_kern_cp_time()
112 if (!req->oldptr) in sysctl_kern_cp_time()
136 if (!req->oldptr) { in sysctl_kern_cp_times()
138 if (req->flags & SCTL_MASK32) in sysctl_kern_cp_times()
147 cp_time = pcpu->pc_cp_time; in sysctl_kern_cp_times()
152 if (req->flags & SCTL_MASK32) { in sysctl_kern_cp_times()
164 0,0, sysctl_kern_cp_times, "LU", "per-CPU time statistics");
189 MPASS(td->td_blocked != NULL); in deadlres_td_on_lock()
191 tticks = ticks - td->td_blktick; in deadlres_td_on_lock()
216 wchan = td->td_wchan; in deadlres_td_sleep_q()
217 tticks = ticks - td->td_slptick; in deadlres_td_sleep_q()
228 if (!strcmp(blessed[i], td->td_wmesg)) in deadlres_td_sleep_q()
266 if (p->p_state == PRS_NEW) { in deadlkres()
285 pause("-", sleepfreq * hz); in deadlkres()
320 cp_time[j] += pc->pc_cp_time[j]; in read_cpu_time()
364 * Time-of-day is maintained using a "timecounter", which may or may
374 DPCPU_DEFINE_STATIC(long, pcputicks); /* Per-CPU version of ticks. */
382 if ((td->td_proc->p_flag & P_PROFIL) == 0) in ast_oweupc()
384 addupc_task(td, td->td_profil_addr, td->td_profil_ticks); in ast_oweupc()
385 td->td_profil_ticks = 0; in ast_oweupc()
386 td->td_pflags &= ~TDP_OWEUPC; in ast_oweupc()
394 p = td->td_proc; in ast_alrm()
405 p = td->td_proc; in ast_prof()
420 * Set divisors to 1 (normal case) and let the machine-specific in initclocks()
456 p = td->td_proc; in hardclock_itimer()
458 timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) { in hardclock_itimer()
460 if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], in hardclock_itimer()
465 if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) { in hardclock_itimer()
467 if (itimerdecr(&pstats->p_timer[ITIMER_PROF], in hardclock_itimer()
481 struct proc *p = td->td_proc; in hardclock()
485 * Update per-CPU and possibly global ticks values. in hardclock()
491 newticks = *t - global; in hardclock()
493 if (newticks < -1) in hardclock()
494 *t = global - 1; in hardclock()
503 pstats = p->p_stats; in hardclock()
505 timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) || in hardclock()
506 timevalisset(&pstats->p_timer[ITIMER_PROF].it_value))) in hardclock()
512 if (td->td_intr_frame != NULL) in hardclock()
513 PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); in hardclock()
529 left = atomic_fetchadd_long(&watchdog_ticks, -newticks); in hardclock()
566 _Static_assert(TIME_TO_TICKS(INT_MAX / (hz) - 1, 999999, hz) >= 0 && \
567 TIME_TO_TICKS(INT_MAX / (hz) - 1, 999999, hz) < INT_MAX, \
597 * The values passed here may come from user-space and these in tvtohz()
602 if (__predict_false(tv->tv_usec < 0)) { in tvtohz()
603 tv->tv_sec += tv->tv_usec / 1000000; in tvtohz()
604 tv->tv_usec = tv->tv_usec % 1000000; in tvtohz()
606 if (__predict_true(tv->tv_usec < 0)) { in tvtohz()
607 tv->tv_usec += 1000000; in tvtohz()
608 tv->tv_sec -= 1; in tvtohz()
611 } else if (__predict_false(tv->tv_usec >= 1000000)) { in tvtohz()
612 tv->tv_sec += tv->tv_usec / 1000000; in tvtohz()
613 tv->tv_usec = tv->tv_usec % 1000000; in tvtohz()
617 if (__predict_false(tv->tv_sec < 0)) in tvtohz()
620 else if (__predict_false(tv->tv_sec >= tick_seconds_max)) in tvtohz()
624 retval = TIME_TO_TICKS((int)tv->tv_sec, (int)tv->tv_usec, hz); in tvtohz()
641 if (p->p_flag & P_STOPPROF) in startprofclock()
643 if ((p->p_flag & P_PROFIL) == 0) { in startprofclock()
644 p->p_flag |= P_PROFIL; in startprofclock()
660 if (p->p_flag & P_PROFIL) { in stopprofclock()
661 if (p->p_profthreads != 0) { in stopprofclock()
662 while (p->p_profthreads != 0) { in stopprofclock()
663 p->p_flag |= P_STOPPROF; in stopprofclock()
664 msleep(&p->p_profthreads, &p->p_mtx, PPAUSE, in stopprofclock()
668 if ((p->p_flag & P_PROFIL) == 0) in stopprofclock()
670 p->p_flag &= ~P_PROFIL; in stopprofclock()
672 if (--profprocs == 0) in stopprofclock()
682 * This should be called by all active processors.
696 p = td->td_proc; in statclock()
703 td->td_uticks += cnt; in statclock()
704 if (p->p_nice > NZERO) in statclock()
711 * - handling an interrupt, in statclock()
712 * - doing syscall or trap work on behalf of the current in statclock()
714 * - spinning in the idle loop. in statclock()
719 * in ``non-process'' (i.e., interrupt) work. in statclock()
721 if ((td->td_pflags & TDP_ITHREAD) || in statclock()
722 td->td_intr_nesting_level >= 2) { in statclock()
723 td->td_iticks += cnt; in statclock()
726 td->td_pticks += cnt; in statclock()
727 td->td_sticks += cnt; in statclock()
736 MPASS(p->p_vmspace != NULL); in statclock()
737 vm = p->p_vmspace; in statclock()
738 ru = &td->td_ru; in statclock()
739 ru->ru_ixrss += pgtok(vm->vm_tsize) * cnt; in statclock()
740 ru->ru_idrss += pgtok(vm->vm_dsize) * cnt; in statclock()
741 ru->ru_isrss += pgtok(vm->vm_ssize) * cnt; in statclock()
743 if (ru->ru_maxrss < rss) in statclock()
744 ru->ru_maxrss = rss; in statclock()
746 "prio:%d", td->td_priority, "stathz:%d", (stathz)?stathz:hz); in statclock()
747 SDT_PROBE2(sched, , , tick, td, td->td_proc); in statclock()
755 runtime = new_switchtime - PCPU_GET(switchtime); in statclock()
756 td->td_runtime += runtime; in statclock()
757 td->td_incruntime += runtime; in statclock()
763 if (td->td_intr_frame != NULL) in statclock()
764 PMC_SOFT_CALL_TF( , , clock, stat, td->td_intr_frame); in statclock()
781 if (td->td_proc->p_flag & P_PROFIL) in profclock()
785 if (td->td_intr_frame != NULL) in profclock()
786 PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame); in profclock()
820 watchdog_ticks = (1 << (u - WD_TO_1SEC)) * hz; in watchdog_config()