2006-10-30 16:53:38 +01:00
|
|
|
/* This file implements entry points for system profiling.
|
|
|
|
*
|
|
|
|
* The entry points in this file are:
|
|
|
|
* do_sprofile: start/stop statistical profiling
|
|
|
|
* do_cprofile: get/reset call profiling tables
|
|
|
|
*
|
|
|
|
* Changes:
|
|
|
|
* 14 Aug, 2006 Created (Rogier Meurs)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <minix/config.h>
|
|
|
|
#include <minix/profile.h>
|
|
|
|
#include "pm.h"
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <minix/callnr.h>
|
|
|
|
#include <minix/com.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include "mproc.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* do_sprofile *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
int do_sprofile(void)
|
2006-10-30 16:53:38 +01:00
|
|
|
{
|
|
|
|
#if SPROFILE
|
|
|
|
|
|
|
|
int r;
|
|
|
|
|
2014-07-25 18:13:49 +02:00
|
|
|
switch(m_in.m_lc_pm_sprof.action) {
|
2006-10-30 16:53:38 +01:00
|
|
|
|
|
|
|
case PROF_START:
|
2014-07-25 18:13:49 +02:00
|
|
|
return sys_sprof(PROF_START, m_in.m_lc_pm_sprof.mem_size,
|
|
|
|
m_in.m_lc_pm_sprof.freq, m_in.m_lc_pm_sprof.intr_type, who_e,
|
|
|
|
m_in.m_lc_pm_sprof.ctl_ptr, m_in.m_lc_pm_sprof.mem_ptr);
|
2006-10-30 16:53:38 +01:00
|
|
|
|
|
|
|
case PROF_STOP:
|
2010-09-23 12:49:42 +02:00
|
|
|
return sys_sprof(PROF_STOP,0,0,0,0,0,0);
|
2006-10-30 16:53:38 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
return ENOSYS;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* do_cprofile *
|
|
|
|
*===========================================================================*/
|
2012-03-25 20:25:53 +02:00
|
|
|
int do_cprofile(void)
|
2006-10-30 16:53:38 +01:00
|
|
|
{
|
|
|
|
#if CPROFILE
|
|
|
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
switch(m_in.PROF_ACTION) {
|
|
|
|
|
|
|
|
case PROF_GET:
|
|
|
|
return sys_cprof(PROF_GET, m_in.PROF_MEM_SIZE, who_e,
|
|
|
|
m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR);
|
|
|
|
|
|
|
|
case PROF_RESET:
|
|
|
|
return sys_cprof(PROF_RESET,0,0,0,0);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
return ENOSYS;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|