support times
This commit is contained in:
@@ -347,7 +347,7 @@ typedef void pgio_func_t(void *arg);
|
||||
* special "init" process */
|
||||
struct process {
|
||||
struct list_head hash_list;
|
||||
mcs_rwlock_lock_t update_lock; // lock for parent, status, ...?
|
||||
mcs_rwlock_lock_t update_lock; // lock for parent, status, cpu time...
|
||||
|
||||
// process vm
|
||||
struct process_vm *vm;
|
||||
@@ -431,6 +431,10 @@ struct process {
|
||||
|
||||
ihk_spinlock_t mckfd_lock;
|
||||
struct mckfd *mckfd;
|
||||
|
||||
// cpu time (summary)
|
||||
struct timespec stime;
|
||||
struct timespec utime;
|
||||
};
|
||||
|
||||
void hold_thread(struct thread *ftn);
|
||||
@@ -518,6 +522,11 @@ struct thread {
|
||||
unsigned long *ptrace_debugreg; /* debug registers for ptrace */
|
||||
struct sig_pending *ptrace_recvsig;
|
||||
struct sig_pending *ptrace_sendsig;
|
||||
|
||||
// cpu time
|
||||
struct timespec stime;
|
||||
struct timespec utime;
|
||||
struct timespec btime;
|
||||
};
|
||||
|
||||
struct process_vm {
|
||||
|
||||
@@ -337,4 +337,7 @@ struct tod_data_s {
|
||||
};
|
||||
extern struct tod_data_s tod_data; /* residing in arch-dependent file */
|
||||
|
||||
void reset_cputime();
|
||||
void set_cputime(int mode);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,5 +53,27 @@ struct timezone
|
||||
int tz_dsttime; /* Nonzero if DST is ever in effect. */
|
||||
};
|
||||
|
||||
static inline void
|
||||
ts_add(struct timespec *ats, const struct timespec *bts)
|
||||
{
|
||||
ats->tv_sec += bts->tv_sec;
|
||||
ats->tv_nsec += bts->tv_nsec;
|
||||
while(ats->tv_nsec >= 1000000000){
|
||||
ats->tv_sec++;
|
||||
ats->tv_nsec -= 1000000000;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
ts_sub(struct timespec *ats, const struct timespec *bts)
|
||||
{
|
||||
ats->tv_sec -= bts->tv_sec;
|
||||
ats->tv_nsec -= bts->tv_nsec;
|
||||
while(ats->tv_nsec < 0){
|
||||
ats->tv_sec--;
|
||||
ats->tv_nsec += 1000000000;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __TIME_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user