1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Add clocks for process and child execute and system time.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-05-15 00:59:37 +02:00
parent 5da12519cd
commit 04f797490d
2 changed files with 9 additions and 1 deletions

View file

@ -34,7 +34,11 @@ __BEGIN_DECLS
#define CLOCK_BOOT 2 /* Time since system boot (uptime). */
#define CLOCK_INIT 3 /* Time since 'init' process began. */
#define CLOCK_PROCESS_CPUTIME_ID 4
#define CLOCK_THREAD_CPUTIME_ID 5
#define CLOCK_PROCESS_SYSTIME_ID 5
#define CLOCK_CHILD_CPUTIME_ID 6
#define CLOCK_CHILD_SYSTIME_ID 7
#define CLOCK_THREAD_CPUTIME_ID 8
#define CLOCK_THREAD_SYSTIME_ID 9
__END_DECLS

View file

@ -61,6 +61,10 @@ Clock* GetClock(clockid_t clock)
case CLOCK_BOOT: return uptime_clock;
case CLOCK_INIT: return uptime_clock;
case CLOCK_MONOTONIC: return uptime_clock;
case CLOCK_PROCESS_CPUTIME_ID: return &CurrentProcess()->execute_clock;
case CLOCK_PROCESS_SYSTIME_ID: return &CurrentProcess()->system_clock;
case CLOCK_CHILD_CPUTIME_ID: return &CurrentProcess()->child_execute_clock;
case CLOCK_CHILD_SYSTIME_ID: return &CurrentProcess()->child_system_clock;
default: return errno = ENOTSUP, (Clock*) NULL;
}
}