Message type for SYS_TIMES
Change-Id: Ia408aa7d76c47da9f600a724f82b347ba6ac641b
This commit is contained in:
parent
dcb7493a05
commit
1ca0b449b2
6 changed files with 49 additions and 44 deletions
|
@ -338,13 +338,7 @@
|
|||
# define GET_REGS 24 /* get general process registers */
|
||||
# define GET_RUSAGE 25 /* get resource usage */
|
||||
|
||||
/* Field names for SYS_TIMES. */
|
||||
#define T_ENDPT m4_l1 /* process to request time info for */
|
||||
#define T_USER_TIME m4_l1 /* user time consumed by process */
|
||||
#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
|
||||
#define T_BOOTTIME m4_ll1 /* Boottime in seconds (also for SYS_STIME) */
|
||||
#define T_REAL_TICKS m4_l4 /* number of wall clock ticks since boottime */
|
||||
#define T_BOOT_TICKS m4_l5 /* number of hard clock ticks since boottime */
|
||||
|
||||
/* Field names for SYS_SETTIME. */
|
||||
#define T_SETTIME_NOW m4_l2 /* non-zero for immediate, 0 for adjtime */
|
||||
|
|
|
@ -784,6 +784,24 @@ typedef struct {
|
|||
} mess_lsys_krn_sys_setalarm;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_setalarm);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t endpt;
|
||||
|
||||
uint8_t padding[52];
|
||||
} mess_lsys_krn_sys_times;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_times);
|
||||
|
||||
typedef struct {
|
||||
clock_t real_ticks;
|
||||
clock_t boot_ticks;
|
||||
clock_t boot_time;
|
||||
clock_t user_time;
|
||||
clock_t system_time;
|
||||
|
||||
uint8_t padding[36];
|
||||
} mess_krn_lsys_sys_times;
|
||||
_ASSERT_MSG_SIZE(mess_krn_lsys_sys_times);
|
||||
|
||||
typedef struct {
|
||||
endpoint_t src_endpt;
|
||||
int segment;
|
||||
|
@ -1490,6 +1508,7 @@ typedef struct {
|
|||
mess_krn_lsys_schedule m_krn_lsys_schedule;
|
||||
mess_krn_lsys_sys_getwhoami m_krn_lsys_sys_getwhoami;
|
||||
mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl;
|
||||
mess_krn_lsys_sys_times m_krn_lsys_sys_times;
|
||||
mess_krn_lsys_sys_umap m_krn_lsys_sys_umap;
|
||||
mess_krn_lsys_sys_vumap m_krn_lsys_sys_vumap;
|
||||
|
||||
|
@ -1576,6 +1595,7 @@ typedef struct {
|
|||
mess_lsys_krn_sys_memset m_lsys_krn_sys_memset;
|
||||
mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio;
|
||||
mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm;
|
||||
mess_lsys_krn_sys_times m_lsys_krn_sys_times;
|
||||
mess_lsys_krn_sys_umap m_lsys_krn_sys_umap;
|
||||
mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio;
|
||||
mess_lsys_krn_sys_vumap m_lsys_krn_sys_vumap;
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
* m_type: SYS_TIMES
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* m4_l1: T_ENDPT (get info for this process)
|
||||
* m4_l1: T_USER_TIME (return values ...)
|
||||
* m4_l2: T_SYSTEM_TIME
|
||||
* m4_ll1: T_BOOTTIME
|
||||
* m4_l5: T_BOOT_TICKS
|
||||
* m_lsys_krn_sys_times.endpt (get info for this process)
|
||||
* m_krn_lsys_sys_times.user_time (return values ...)
|
||||
* m_krn_lsys_sys_times.system_time
|
||||
* m_krn_lsys_sys_times.boot_time
|
||||
* m_krn_lsys_sys_times.boot_ticks
|
||||
* m_krn_lsys_sys_times.real_ticks
|
||||
*/
|
||||
|
||||
#include "kernel/system.h"
|
||||
|
@ -29,17 +30,17 @@ int do_times(struct proc * caller, message * m_ptr)
|
|||
* The clock's interrupt handler may run to update the user or system time
|
||||
* while in this code, but that cannot do any harm.
|
||||
*/
|
||||
e_proc_nr = (m_ptr->T_ENDPT == SELF) ? caller->p_endpoint : m_ptr->T_ENDPT;
|
||||
e_proc_nr = (m_ptr->m_lsys_krn_sys_times.endpt == SELF) ?
|
||||
caller->p_endpoint : m_ptr->m_lsys_krn_sys_times.endpt;
|
||||
if(e_proc_nr != NONE && isokendpt(e_proc_nr, &proc_nr)) {
|
||||
rp = proc_addr(proc_nr);
|
||||
m_ptr->T_USER_TIME = rp->p_user_time;
|
||||
m_ptr->T_SYSTEM_TIME = rp->p_sys_time;
|
||||
m_ptr->m_krn_lsys_sys_times.user_time = rp->p_user_time;
|
||||
m_ptr->m_krn_lsys_sys_times.system_time = rp->p_sys_time;
|
||||
}
|
||||
m_ptr->T_BOOT_TICKS = get_monotonic();
|
||||
m_ptr->T_REAL_TICKS = get_realtime();
|
||||
m_ptr->T_BOOTTIME = boottime;
|
||||
m_ptr->m_krn_lsys_sys_times.boot_ticks = get_monotonic();
|
||||
m_ptr->m_krn_lsys_sys_times.real_ticks = get_realtime();
|
||||
m_ptr->m_krn_lsys_sys_times.boot_time = boottime;
|
||||
return(OK);
|
||||
}
|
||||
|
||||
#endif /* USE_TIMES */
|
||||
|
||||
|
|
|
@ -4,19 +4,14 @@
|
|||
* getuptime *
|
||||
*===========================================================================*/
|
||||
int getticks(ticks)
|
||||
clock_t *ticks; /* monotonic time in ticks */
|
||||
clock_t *ticks; /* monotonic time in ticks */
|
||||
{
|
||||
message m;
|
||||
int s;
|
||||
|
||||
m.m_type = SYS_TIMES; /* request time information */
|
||||
m.T_ENDPT = NONE; /* ignore process times */
|
||||
m.m_type = SYS_TIMES; /* request time information */
|
||||
m.m_lsys_krn_sys_times.endpt = NONE; /* ignore process times */
|
||||
s = _kernel_call(SYS_TIMES, &m);
|
||||
*ticks = m.T_BOOT_TICKS;
|
||||
*ticks = m.m_krn_lsys_sys_times.boot_ticks;
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,23 +4,18 @@
|
|||
* getuptime *
|
||||
*===========================================================================*/
|
||||
int getuptime(ticks, realtime, boottime)
|
||||
clock_t *ticks; /* monotonic time in ticks */
|
||||
clock_t *realtime; /* wall time in ticks */
|
||||
clock_t *ticks; /* monotonic time in ticks */
|
||||
clock_t *realtime; /* wall time in ticks */
|
||||
time_t *boottime;
|
||||
{
|
||||
message m;
|
||||
int s;
|
||||
|
||||
m.m_type = SYS_TIMES; /* request time information */
|
||||
m.T_ENDPT = NONE; /* ignore process times */
|
||||
m.m_type = SYS_TIMES; /* request time information */
|
||||
m.m_lsys_krn_sys_times.endpt = NONE; /* ignore process times */
|
||||
s = _kernel_call(SYS_TIMES, &m);
|
||||
*ticks = m.T_BOOT_TICKS;
|
||||
*realtime = m.T_REAL_TICKS;
|
||||
*boottime = m.T_BOOTTIME;
|
||||
*ticks = m.m_krn_lsys_sys_times.boot_ticks;
|
||||
*realtime = m.m_krn_lsys_sys_times.real_ticks;
|
||||
*boottime = m.m_krn_lsys_sys_times.boot_time;
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ time_t *boottime; /* boot time */
|
|||
message m;
|
||||
int r;
|
||||
|
||||
m.T_ENDPT = proc_ep;
|
||||
m.m_lsys_krn_sys_times.endpt = proc_ep;
|
||||
r = _kernel_call(SYS_TIMES, &m);
|
||||
if (user_time) *user_time = m.T_USER_TIME;
|
||||
if (sys_time) *sys_time = m.T_SYSTEM_TIME;
|
||||
if (uptime) *uptime = m.T_BOOT_TICKS;
|
||||
if (boottime) *boottime = m.T_BOOTTIME;
|
||||
if (user_time) *user_time = m.m_krn_lsys_sys_times.user_time;
|
||||
if (sys_time) *sys_time = m.m_krn_lsys_sys_times.system_time;
|
||||
if (uptime) *uptime = m.m_krn_lsys_sys_times.boot_ticks;
|
||||
if (boottime) *boottime = m.m_krn_lsys_sys_times.boot_time;
|
||||
return(r);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue