aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-06-04 01:10:23 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-06-04 01:10:23 +0000
commit5de96e33d68b091cd1c8d682799606e2a3d8f6fa (patch)
tree908d529e4f5c3103c7c3d8c4196b2178799a7a34 /sys/kern/subr_trap.c
parente52d92164754cbfff84767d4c6eb3cc93e8c21ae (diff)
downloadsrc-5de96e33d68b091cd1c8d682799606e2a3d8f6fa.tar.gz
src-5de96e33d68b091cd1c8d682799606e2a3d8f6fa.zip
hwpmc: support sampling both kernel and user stacks when interrupted in kernel
This adds the -U options to pmcstat which will attribute in-kernel samples back to the user stack that invoked the system call. It is not the default, because when looking at kernel profiles it is generally more desirable to merge all instances of a given system call together. Although heavily revised, this change is directly derived from D7350 by Jonathan T. Looney. Obtained from: jtl Sponsored by: Juniper Networks, Limelight Networks
Notes
Notes: svn path=/head/; revision=334595
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 64c9c9251ea3..72a0b8f8d481 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -145,6 +145,11 @@ userret(struct thread *td, struct trapframe *frame)
*/
if (p->p_flag & P_PROFIL)
addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio);
+
+#ifdef HWPMC_HOOKS
+ if (PMC_THREAD_HAS_SAMPLES(td))
+ PMC_CALL_HOOK(td, PMC_FN_THR_USERRET, NULL);
+#endif
/*
* Let the scheduler adjust our priority etc.
*/