profiling related cleanup
. do not declare any data in <minix/profile.h> . addr check no longer necessary
This commit is contained in:
parent
c6a2f353c3
commit
cfe1ed4df4
3 changed files with 7 additions and 43 deletions
|
@ -21,7 +21,7 @@ struct sprof_info_s {
|
||||||
int idle_samples;
|
int idle_samples;
|
||||||
int system_samples;
|
int system_samples;
|
||||||
int user_samples;
|
int user_samples;
|
||||||
} sprof_info_inst;
|
};
|
||||||
|
|
||||||
/* What a profiling sample looks like (used for sizeof()). */
|
/* What a profiling sample looks like (used for sizeof()). */
|
||||||
struct sprof_sample {
|
struct sprof_sample {
|
||||||
|
@ -80,7 +80,7 @@ void profile_register(void *ctl_ptr, void *tbl_ptr);
|
||||||
struct cprof_info_s {
|
struct cprof_info_s {
|
||||||
int mem_used;
|
int mem_used;
|
||||||
int err;
|
int err;
|
||||||
} cprof_info_inst;
|
};
|
||||||
|
|
||||||
/* Data structures for control structure and profiling data table in the
|
/* Data structures for control structure and profiling data table in the
|
||||||
* in the profiled processes.
|
* in the profiled processes.
|
||||||
|
@ -89,14 +89,14 @@ struct cprof_ctl_s {
|
||||||
int reset; /* kernel sets to have table reset */
|
int reset; /* kernel sets to have table reset */
|
||||||
int slots_used; /* proc writes nr slots used in table */
|
int slots_used; /* proc writes nr slots used in table */
|
||||||
int err; /* proc writes errors that occurred */
|
int err; /* proc writes errors that occurred */
|
||||||
} cprof_ctl_inst;
|
};
|
||||||
|
|
||||||
struct cprof_tbl_s {
|
struct cprof_tbl_s {
|
||||||
struct cprof_tbl_s *next; /* next in chain */
|
struct cprof_tbl_s *next; /* next in chain */
|
||||||
char cpath[CPROF_CPATH_MAX_LEN]; /* string with call path */
|
char cpath[CPROF_CPATH_MAX_LEN]; /* string with call path */
|
||||||
int calls; /* nr of executions of path */
|
int calls; /* nr of executions of path */
|
||||||
u64_t cycles; /* execution time of path, in cycles */
|
u64_t cycles; /* execution time of path, in cycles */
|
||||||
} cprof_tbl_inst;
|
};
|
||||||
|
|
||||||
int sprofile(int action, int size, int freq, int type, void *ctl_ptr,
|
int sprofile(int action, int size, int freq, int type, void *ctl_ptr,
|
||||||
void *mem_ptr);
|
void *mem_ptr);
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
#if CPROFILE
|
#if CPROFILE
|
||||||
|
|
||||||
|
static struct cprof_ctl_s cprof_ctl_inst;
|
||||||
|
static struct cprof_tbl_s cprof_tbl_inst;
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_cprofile *
|
* do_cprofile *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
#include "mproc.h"
|
#include "mproc.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
|
||||||
#if SPROFILE || CPROFILE
|
|
||||||
static int check_addrs(int info_size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_sprofile *
|
* do_sprofile *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -34,9 +30,6 @@ int do_sprofile(void)
|
||||||
switch(m_in.PROF_ACTION) {
|
switch(m_in.PROF_ACTION) {
|
||||||
|
|
||||||
case PROF_START:
|
case PROF_START:
|
||||||
if ((r = check_addrs(sizeof(sprof_info_inst)))) /* check pointers */
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return sys_sprof(PROF_START, m_in.PROF_MEM_SIZE, m_in.PROF_FREQ,
|
return sys_sprof(PROF_START, m_in.PROF_MEM_SIZE, m_in.PROF_FREQ,
|
||||||
m_in.PROF_INTR_TYPE,
|
m_in.PROF_INTR_TYPE,
|
||||||
who_e, m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR);
|
who_e, m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR);
|
||||||
|
@ -66,9 +59,6 @@ int do_cprofile(void)
|
||||||
switch(m_in.PROF_ACTION) {
|
switch(m_in.PROF_ACTION) {
|
||||||
|
|
||||||
case PROF_GET:
|
case PROF_GET:
|
||||||
if (r = check_addrs(sizeof(cprof_info_inst))) /* check user pointers */
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return sys_cprof(PROF_GET, m_in.PROF_MEM_SIZE, who_e,
|
return sys_cprof(PROF_GET, m_in.PROF_MEM_SIZE, who_e,
|
||||||
m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR);
|
m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR);
|
||||||
|
|
||||||
|
@ -84,32 +74,3 @@ int do_cprofile(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if SPROFILE || CPROFILE
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* check_addrs *
|
|
||||||
*===========================================================================*/
|
|
||||||
static int check_addrs(info_size)
|
|
||||||
int info_size;
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
phys_bytes p;
|
|
||||||
|
|
||||||
/* Check if supplied pointers point into user process. */
|
|
||||||
if ((r = sys_umap_remote(who_e, SELF, VM_D, (vir_bytes) m_in.PROF_CTL_PTR,
|
|
||||||
1, &p)) != OK) {
|
|
||||||
printf("PM: PROFILE: umap failed for process %d\n", who_e);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((r =sys_umap_remote(who_e, SELF, VM_D, (vir_bytes) m_in.PROF_MEM_PTR,
|
|
||||||
1, &p)) != OK) {
|
|
||||||
printf("PM: PROFILE: umap failed for process %d\n", who_e);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue