From cfe1ed4df40c7ed268f94502108a54cf2d4bbca9 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sat, 16 Jun 2012 16:38:31 +0000 Subject: [PATCH] profiling related cleanup . do not declare any data in . addr check no longer necessary --- include/minix/profile.h | 8 ++++---- kernel/system/do_cprofile.c | 3 +++ servers/pm/profile.c | 39 ------------------------------------- 3 files changed, 7 insertions(+), 43 deletions(-) diff --git a/include/minix/profile.h b/include/minix/profile.h index c84efc182..aa94dd567 100644 --- a/include/minix/profile.h +++ b/include/minix/profile.h @@ -21,7 +21,7 @@ struct sprof_info_s { int idle_samples; int system_samples; int user_samples; -} sprof_info_inst; +}; /* What a profiling sample looks like (used for sizeof()). */ struct sprof_sample { @@ -80,7 +80,7 @@ void profile_register(void *ctl_ptr, void *tbl_ptr); struct cprof_info_s { int mem_used; int err; -} cprof_info_inst; +}; /* Data structures for control structure and profiling data table in the * in the profiled processes. @@ -89,14 +89,14 @@ struct cprof_ctl_s { int reset; /* kernel sets to have table reset */ int slots_used; /* proc writes nr slots used in table */ int err; /* proc writes errors that occurred */ -} cprof_ctl_inst; +}; struct cprof_tbl_s { struct cprof_tbl_s *next; /* next in chain */ char cpath[CPROF_CPATH_MAX_LEN]; /* string with call path */ int calls; /* nr of executions of path */ 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, void *mem_ptr); diff --git a/kernel/system/do_cprofile.c b/kernel/system/do_cprofile.c index c661a871e..b9f01d9f3 100644 --- a/kernel/system/do_cprofile.c +++ b/kernel/system/do_cprofile.c @@ -18,6 +18,9 @@ #if CPROFILE +static struct cprof_ctl_s cprof_ctl_inst; +static struct cprof_tbl_s cprof_tbl_inst; + /*===========================================================================* * do_cprofile * *===========================================================================*/ diff --git a/servers/pm/profile.c b/servers/pm/profile.c index 0f0bc04ce..27ff0c260 100644 --- a/servers/pm/profile.c +++ b/servers/pm/profile.c @@ -18,10 +18,6 @@ #include "mproc.h" #include "param.h" -#if SPROFILE || CPROFILE -static int check_addrs(int info_size); -#endif - /*===========================================================================* * do_sprofile * *===========================================================================*/ @@ -34,9 +30,6 @@ int do_sprofile(void) switch(m_in.PROF_ACTION) { 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, m_in.PROF_INTR_TYPE, 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) { 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, m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR); @@ -84,32 +74,3 @@ int do_cprofile(void) #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 -