1 /* This file implements entry points for system profiling. 2 * 3 * The entry points in this file are: 4 * do_sprofile: start/stop statistical profiling 5 * do_cprofile: get/reset call profiling tables 6 * 7 * Changes: 8 * 14 Aug, 2006 Created (Rogier Meurs) 9 */ 10 11 #include <minix/config.h> 12 #include <minix/profile.h> 13 #include "pm.h" 14 #include <sys/wait.h> 15 #include <minix/callnr.h> 16 #include <minix/com.h> 17 #include <signal.h> 18 #include "mproc.h" 19 20 /*===========================================================================* 21 * do_sprofile * 22 *===========================================================================*/ 23 int do_sprofile(void) 24 { 25 #if SPROFILE 26 27 int r; 28 29 switch(m_in.m_lc_pm_sprof.action) { 30 31 case PROF_START: 32 return sys_sprof(PROF_START, m_in.m_lc_pm_sprof.mem_size, 33 m_in.m_lc_pm_sprof.freq, m_in.m_lc_pm_sprof.intr_type, who_e, 34 m_in.m_lc_pm_sprof.ctl_ptr, m_in.m_lc_pm_sprof.mem_ptr); 35 36 case PROF_STOP: 37 return sys_sprof(PROF_STOP,0,0,0,0,0,0); 38 39 default: 40 return EINVAL; 41 } 42 43 #else 44 return ENOSYS; 45 #endif 46 } 47 48 49 /*===========================================================================* 50 * do_cprofile * 51 *===========================================================================*/ 52 int do_cprofile(void) 53 { 54 #if CPROFILE 55 56 int r; 57 58 switch(m_in.m_lc_pm_cprof.action) { 59 60 case PROF_GET: 61 return sys_cprof(PROF_GET, m_in.m_lc_pm_cprof.mem_size, who_e, 62 m_in.m_lc_pm_cprof.ctl_ptr, m_in.m_lc_pm_cprof.mem_ptr); 63 64 case PROF_RESET: 65 return sys_cprof(PROF_RESET,0,0,0,0); 66 67 default: 68 return EINVAL; 69 } 70 71 #else 72 return ENOSYS; 73 #endif 74 } 75 76