| 721 | } |
| 722 | |
| 723 | void |
| 724 | profclock(int cnt, int usermode, uintfptr_t pc) |
| 725 | { |
| 726 | struct thread *td; |
| 727 | #ifdef GPROF |
| 728 | struct gmonparam *g; |
| 729 | uintfptr_t i; |
| 730 | #endif |
| 731 | |
| 732 | td = curthread; |
| 733 | if (usermode) { |
| 734 | /* |
| 735 | * Came from user mode; CPU was in user state. |
| 736 | * If this process is being profiled, record the tick. |
| 737 | * if there is no related user location yet, don't |
| 738 | * bother trying to count it. |
| 739 | */ |
| 740 | if (td->td_proc->p_flag & P_PROFIL) |
| 741 | addupc_intr(td, pc, cnt); |
| 742 | } |
| 743 | #ifdef GPROF |
| 744 | else { |
| 745 | /* |
| 746 | * Kernel statistics are just like addupc_intr, only easier. |
| 747 | */ |
| 748 | g = &_gmonparam; |
| 749 | if (g->state == GMON_PROF_ON && pc >= g->lowpc) { |
| 750 | i = PC_TO_I(g, pc); |
| 751 | if (i < g->textsize) { |
| 752 | KCOUNT(g, i) += cnt; |
| 753 | } |
| 754 | } |
| 755 | } |
| 756 | #endif |
| 757 | #ifdef HWPMC_HOOKS |
| 758 | if (td->td_intr_frame != NULL) |
| 759 | PMC_SOFT_CALL_TF( , , clock, prof, td->td_intr_frame); |
| 760 | #endif |
| 761 | } |
| 762 | |
| 763 | /* |
| 764 | * Return information about system clocks. |
no test coverage detected