xref: /minix3/minix/servers/pm/profile.c (revision 1dcfbcd17383a5c335ef7172dc751771716b632d)
1*433d6423SLionel Sambuc /* This file implements entry points for system profiling.
2*433d6423SLionel Sambuc  *
3*433d6423SLionel Sambuc  * The entry points in this file are:
4*433d6423SLionel Sambuc  *   do_sprofile:   start/stop statistical profiling
5*433d6423SLionel Sambuc  *
6*433d6423SLionel Sambuc  * Changes:
7*433d6423SLionel Sambuc  *   14 Aug, 2006  Created (Rogier Meurs)
8*433d6423SLionel Sambuc  */
9*433d6423SLionel Sambuc 
10*433d6423SLionel Sambuc #include <minix/config.h>
11*433d6423SLionel Sambuc #include <minix/profile.h>
12*433d6423SLionel Sambuc #include "pm.h"
13*433d6423SLionel Sambuc #include <sys/wait.h>
14*433d6423SLionel Sambuc #include <minix/callnr.h>
15*433d6423SLionel Sambuc #include <minix/com.h>
16*433d6423SLionel Sambuc #include <signal.h>
17*433d6423SLionel Sambuc #include "mproc.h"
18*433d6423SLionel Sambuc 
19*433d6423SLionel Sambuc /*===========================================================================*
20*433d6423SLionel Sambuc  *				do_sprofile				     *
21*433d6423SLionel Sambuc  *===========================================================================*/
do_sprofile(void)22*433d6423SLionel Sambuc int do_sprofile(void)
23*433d6423SLionel Sambuc {
24*433d6423SLionel Sambuc #if SPROFILE
25*433d6423SLionel Sambuc 
26*433d6423SLionel Sambuc   int r;
27*433d6423SLionel Sambuc 
28*433d6423SLionel Sambuc   switch(m_in.m_lc_pm_sprof.action) {
29*433d6423SLionel Sambuc 
30*433d6423SLionel Sambuc   case PROF_START:
31*433d6423SLionel Sambuc 	return sys_sprof(PROF_START, m_in.m_lc_pm_sprof.mem_size,
32*433d6423SLionel Sambuc 		m_in.m_lc_pm_sprof.freq, m_in.m_lc_pm_sprof.intr_type, who_e,
33*433d6423SLionel Sambuc 		m_in.m_lc_pm_sprof.ctl_ptr, m_in.m_lc_pm_sprof.mem_ptr);
34*433d6423SLionel Sambuc 
35*433d6423SLionel Sambuc   case PROF_STOP:
36*433d6423SLionel Sambuc 	return sys_sprof(PROF_STOP,0,0,0,0,0,0);
37*433d6423SLionel Sambuc 
38*433d6423SLionel Sambuc   default:
39*433d6423SLionel Sambuc 	return EINVAL;
40*433d6423SLionel Sambuc   }
41*433d6423SLionel Sambuc 
42*433d6423SLionel Sambuc #else
43*433d6423SLionel Sambuc 	return ENOSYS;
44*433d6423SLionel Sambuc #endif
45*433d6423SLionel Sambuc }
46