Message type for SYS_SPROF and PM_SPROF.

Change-Id: I598f88af47737be0172236fa9ad24058b50d3942
This commit is contained in:
Lionel Sambuc 2014-07-25 18:13:49 +02:00
parent 9ea21ea158
commit 8ad307eeed
6 changed files with 64 additions and 36 deletions

View file

@ -365,9 +365,7 @@
/* Field names for SYS_SPROF, _CPROF, _PROFBUF. */ /* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
#define PROF_ACTION m7_i1 /* start/stop/reset/get */ #define PROF_ACTION m7_i1 /* start/stop/reset/get */
#define PROF_MEM_SIZE m7_i2 /* available memory for data */ #define PROF_MEM_SIZE m7_i2 /* available memory for data */
#define PROF_FREQ m7_i3 /* sample frequency */
#define PROF_ENDPT m7_i4 /* endpoint of caller */ #define PROF_ENDPT m7_i4 /* endpoint of caller */
#define PROF_INTR_TYPE m7_i5 /* interrupt type */
#define PROF_CTL_PTR m7_p1 /* location of info struct */ #define PROF_CTL_PTR m7_p1 /* location of info struct */
#define PROF_MEM_PTR m7_p2 /* location of profiling data */ #define PROF_MEM_PTR m7_p2 /* location of profiling data */

View file

@ -124,6 +124,18 @@ typedef struct {
} mess_lsys_krn_readbios; } mess_lsys_krn_readbios;
_ASSERT_MSG_SIZE(mess_lsys_krn_readbios); _ASSERT_MSG_SIZE(mess_lsys_krn_readbios);
typedef struct {
int action;
int freq;
int intr_type;
vir_bytes ctl_ptr;
vir_bytes mem_ptr;
size_t mem_size;
uint8_t padding[32];
} mess_lc_pm_sprof;
_ASSERT_MSG_SIZE(mess_lc_pm_sprof);
typedef struct { typedef struct {
int num; int num;
@ -141,6 +153,19 @@ typedef struct {
} mess_lsys_krn_sys_diagctl; } mess_lsys_krn_sys_diagctl;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_diagctl); _ASSERT_MSG_SIZE(mess_lsys_krn_sys_diagctl);
typedef struct {
int action;
int freq;
int intr_type;
endpoint_t endpt;
vir_bytes ctl_ptr;
vir_bytes mem_ptr;
size_t mem_size;
uint8_t padding[28];
} mess_lsys_krn_sys_sprof;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_sprof);
typedef struct { typedef struct {
off_t offset; off_t offset;
void *addr; void *addr;
@ -1978,7 +2003,9 @@ typedef struct {
mess_notify m_notify; mess_notify m_notify;
mess_sigcalls m_sigcalls; mess_sigcalls m_sigcalls;
mess_lc_pm_sprof m_lc_pm_sprof;
mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl; mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl;
mess_lsys_krn_sys_sprof m_lsys_krn_sys_sprof;
mess_lsys_krn_readbios m_lsys_krn_readbios; mess_lsys_krn_readbios m_lsys_krn_readbios;
mess_pm_lsys_sigs_signal m_pm_lsys_sigs_signal; mess_pm_lsys_sigs_signal m_pm_lsys_sigs_signal;
mess_input_tty_event m_input_tty_event; mess_input_tty_event m_input_tty_event;

View file

@ -1,13 +1,14 @@
/* The kernel call that is implemented in this file: /* The kernel call that is implemented in this file:
* m_type: SYS_SPROFILE * m_type: SYS_SPROF
* *
* The parameters for this kernel call are: * The parameters for this kernel call are:
* m7_i1: PROF_ACTION (start/stop profiling) * m_lsys_krn_sys_sprof.action (start/stop profiling)
* m7_i2: PROF_MEM_SIZE (available memory for data) * m_lsys_krn_sys_sprof.mem_size (available memory for data)
* m7_i3: PROF_FREQ (requested sample frequency) * m_lsys_krn_sys_sprof.freq (requested sample frequency)
* m7_i4: PROF_ENDPT (endpoint of caller) * m_lsys_krn_sys_sprof.endpt (endpoint of caller)
* m7_p1: PROF_CTL_PTR (location of info struct) * m_lsys_krn_sys_sprof.ctl_ptr (location of info struct)
* m7_p2: PROF_MEM_PTR (location of memory for data) * m_lsys_krn_sys_sprof.mem_ptr (location of memory for data)
* m_lsys_krn_sys_sprof.intr_type (interrupt source: RTC/NMI)
* *
* Changes: * Changes:
* 14 Aug, 2006 Created (Rogier Meurs) * 14 Aug, 2006 Created (Rogier Meurs)
@ -37,7 +38,7 @@ int do_sprofile(struct proc * caller, message * m_ptr)
int proc_nr; int proc_nr;
int err; int err;
switch(m_ptr->PROF_ACTION) { switch(m_ptr->m_lsys_krn_sys_sprof.action) {
case PROF_START: case PROF_START:
/* Starting profiling. /* Starting profiling.
@ -52,13 +53,13 @@ int do_sprofile(struct proc * caller, message * m_ptr)
} }
/* Test endpoint number. */ /* Test endpoint number. */
if(!isokendpt(m_ptr->PROF_ENDPT, &proc_nr)) if(!isokendpt(m_ptr->m_lsys_krn_sys_sprof.endpt, &proc_nr))
return EINVAL; return EINVAL;
/* Set parameters for statistical profiler. */ /* Set parameters for statistical profiler. */
sprof_ep = m_ptr->PROF_ENDPT; sprof_ep = m_ptr->m_lsys_krn_sys_sprof.endpt;
sprof_info_addr_vir = (vir_bytes) m_ptr->PROF_CTL_PTR; sprof_info_addr_vir = m_ptr->m_lsys_krn_sys_sprof.ctl_ptr;
sprof_data_addr_vir = (vir_bytes) m_ptr->PROF_MEM_PTR; sprof_data_addr_vir = m_ptr->m_lsys_krn_sys_sprof.mem_ptr;
sprof_info.mem_used = 0; sprof_info.mem_used = 0;
sprof_info.total_samples = 0; sprof_info.total_samples = 0;
@ -66,15 +67,17 @@ int do_sprofile(struct proc * caller, message * m_ptr)
sprof_info.system_samples = 0; sprof_info.system_samples = 0;
sprof_info.user_samples = 0; sprof_info.user_samples = 0;
sprof_mem_size = m_ptr->PROF_MEM_SIZE < SAMPLE_BUFFER_SIZE ? sprof_mem_size =
m_ptr->PROF_MEM_SIZE : SAMPLE_BUFFER_SIZE; m_ptr->m_lsys_krn_sys_sprof.mem_size < SAMPLE_BUFFER_SIZE ?
m_ptr->m_lsys_krn_sys_sprof.mem_size : SAMPLE_BUFFER_SIZE;
switch (sprofiling_type = m_ptr->PROF_INTR_TYPE) { switch (sprofiling_type = m_ptr->m_lsys_krn_sys_sprof.intr_type) {
case PROF_RTC: case PROF_RTC:
init_profile_clock(m_ptr->PROF_FREQ); init_profile_clock(m_ptr->m_lsys_krn_sys_sprof.freq);
break; break;
case PROF_NMI: case PROF_NMI:
err = nmi_watchdog_start_profiling(m_ptr->PROF_FREQ); err = nmi_watchdog_start_profiling(
_ptr->m_lsys_krn_sys_sprof.freq);
if (err) if (err)
return err; return err;
break; break;

View file

@ -19,12 +19,12 @@ int sprofile(int action,
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.PROF_ACTION = action; m.m_lc_pm_sprof.action = action;
m.PROF_MEM_SIZE = size; m.m_lc_pm_sprof.mem_size = size;
m.PROF_FREQ = freq; m.m_lc_pm_sprof.freq = freq;
m.PROF_INTR_TYPE = type; m.m_lc_pm_sprof.intr_type = type;
m.PROF_CTL_PTR = (void *) ctl_ptr; m.m_lc_pm_sprof.ctl_ptr = ctl_ptr;
m.PROF_MEM_PTR = (void *) mem_ptr; m.m_lc_pm_sprof.mem_ptr = mem_ptr;
return _syscall(PM_PROC_NR, PM_SPROF, &m); return _syscall(PM_PROC_NR, PM_SPROF, &m);
} }

View file

@ -16,13 +16,13 @@ void *mem_ptr; /* location of profiling memory */
{ {
message m; message m;
m.PROF_ACTION = action; m.m_lsys_krn_sys_sprof.action = action;
m.PROF_MEM_SIZE = size; m.m_lsys_krn_sys_sprof.mem_size = size;
m.PROF_FREQ = freq; m.m_lsys_krn_sys_sprof.freq = freq;
m.PROF_INTR_TYPE = type; m.m_lsys_krn_sys_sprof.intr_type = type;
m.PROF_ENDPT = endpt; m.m_lsys_krn_sys_sprof.endpt = endpt;
m.PROF_CTL_PTR = ctl_ptr; m.m_lsys_krn_sys_sprof.ctl_ptr = ctl_ptr;
m.PROF_MEM_PTR = mem_ptr; m.m_lsys_krn_sys_sprof.mem_ptr = mem_ptr;
return(_kernel_call(SYS_SPROF, &m)); return(_kernel_call(SYS_SPROF, &m));
} }

View file

@ -26,12 +26,12 @@ int do_sprofile(void)
int r; int r;
switch(m_in.PROF_ACTION) { switch(m_in.m_lc_pm_sprof.action) {
case PROF_START: case PROF_START:
return sys_sprof(PROF_START, m_in.PROF_MEM_SIZE, m_in.PROF_FREQ, return sys_sprof(PROF_START, m_in.m_lc_pm_sprof.mem_size,
m_in.PROF_INTR_TYPE, m_in.m_lc_pm_sprof.freq, m_in.m_lc_pm_sprof.intr_type, who_e,
who_e, m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR); m_in.m_lc_pm_sprof.ctl_ptr, m_in.m_lc_pm_sprof.mem_ptr);
case PROF_STOP: case PROF_STOP:
return sys_sprof(PROF_STOP,0,0,0,0,0,0); return sys_sprof(PROF_STOP,0,0,0,0,0,0);