[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/6] fix rpc time value for 64 bit
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 4/6] fix rpc time value for 64 bit |
Date: |
Sun, 12 Feb 2023 18:28:55 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Luca Dariz, le dim. 12 févr. 2023 18:03:11 +0100, a ecrit:
> * include/mach/task_info.h: use rpc variant of time_value_t
> * include/mach/thread_info.h: Likewise
> * kern/mach_clock.c: use rpc variant of time_value_t in
> read_time_stamp()
> * kern/mach_clock.h: Likewise
> * kern/thread.c: use rpc variant of thread_read_times()
> * kern/timer.h_ add thread_read_times_rpc() by converting time_value_t
> to the corresponding rpc structures inline.
> ---
> include/mach/task_info.h | 10 +++++-----
> include/mach/thread_info.h | 6 +++---
> kern/mach_clock.c | 2 +-
> kern/mach_clock.h | 2 +-
> kern/thread.c | 2 +-
> kern/timer.h | 12 ++++++++++++
> 6 files changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/include/mach/task_info.h b/include/mach/task_info.h
> index 3aaa7cd6..f448ee04 100644
> --- a/include/mach/task_info.h
> +++ b/include/mach/task_info.h
> @@ -56,11 +56,11 @@ struct task_basic_info {
> integer_t base_priority; /* base scheduling priority */
> rpc_vm_size_t virtual_size; /* number of virtual pages */
> rpc_vm_size_t resident_size; /* number of resident pages */
> - time_value_t user_time; /* total user run time for
> + rpc_time_value_t user_time; /* total user run time for
> terminated threads */
> - time_value_t system_time; /* total system run time for
> + rpc_time_value_t system_time; /* total system run time for
> terminated threads */
> - time_value_t creation_time; /* creation time stamp */
> + rpc_time_value_t creation_time; /* creation time stamp */
> };
>
> typedef struct task_basic_info task_basic_info_data_t;
> @@ -89,9 +89,9 @@ typedef struct task_events_info
> *task_events_info_t;
> only accurate if suspended */
>
> struct task_thread_times_info {
> - time_value_t user_time; /* total user run time for
> + rpc_time_value_t user_time; /* total user run time for
> live threads */
> - time_value_t system_time; /* total system run time for
> + rpc_time_value_t system_time; /* total system run time for
> live threads */
> };
>
> diff --git a/include/mach/thread_info.h b/include/mach/thread_info.h
> index 569c8c84..46c1ceca 100644
> --- a/include/mach/thread_info.h
> +++ b/include/mach/thread_info.h
> @@ -55,8 +55,8 @@ typedef integer_t
> thread_info_data_t[THREAD_INFO_MAX];
> #define THREAD_BASIC_INFO 1 /* basic information */
>
> struct thread_basic_info {
> - time_value_t user_time; /* user run time */
> - time_value_t system_time; /* system run time */
> + rpc_time_value_t user_time; /* user run time */
> + rpc_time_value_t system_time; /* system run time */
> integer_t cpu_usage; /* scaled cpu usage percentage */
> integer_t base_priority; /* base scheduling priority */
> integer_t cur_priority; /* current scheduling priority */
> @@ -65,7 +65,7 @@ struct thread_basic_info {
> integer_t suspend_count; /* suspend count for thread */
> integer_t sleep_time; /* number of seconds that thread
> has been sleeping */
> - time_value_t creation_time; /* time stamp of creation */
> + rpc_time_value_t creation_time; /* time stamp of creation */
> };
>
> typedef struct thread_basic_info thread_basic_info_data_t;
> diff --git a/kern/mach_clock.c b/kern/mach_clock.c
> index 09717d16..ed38c76b 100644
> --- a/kern/mach_clock.c
> +++ b/kern/mach_clock.c
> @@ -429,7 +429,7 @@ record_time_stamp(time_value_t *stamp)
> * real-time clock frame.
> */
> void
> -read_time_stamp (const time_value_t *stamp, time_value_t *result)
> +read_time_stamp (const time_value_t *stamp, rpc_time_value_t *result)
> {
> time_value64_t result64;
> TIME_VALUE_TO_TIME_VALUE64(stamp, &result64);
> diff --git a/kern/mach_clock.h b/kern/mach_clock.h
> index 7e8d3046..9a670011 100644
> --- a/kern/mach_clock.h
> +++ b/kern/mach_clock.h
> @@ -98,7 +98,7 @@ extern void record_time_stamp (time_value_t *stamp);
> * Read a timestamp in STAMP into RESULT. Returns values in the
> * real-time clock frame.
> */
> -extern void read_time_stamp (const time_value_t *stamp, time_value_t
> *result);
> +extern void read_time_stamp (const time_value_t *stamp, rpc_time_value_t
> *result);
>
> extern void mapable_time_init (void);
>
> diff --git a/kern/thread.c b/kern/thread.c
> index 17cc458c..4a6b9eda 100644
> --- a/kern/thread.c
> +++ b/kern/thread.c
> @@ -1522,7 +1522,7 @@ kern_return_t thread_info(
>
> /* fill in info */
>
> - thread_read_times(thread,
> + thread_read_times_rpc(thread,
> &basic_info->user_time,
> &basic_info->system_time);
> basic_info->base_priority = thread->priority;
> diff --git a/kern/timer.h b/kern/timer.h
> index 35782b41..89790230 100644
> --- a/kern/timer.h
> +++ b/kern/timer.h
> @@ -134,6 +134,18 @@ extern unsigned timer_delta(timer_t,
> timer_save_t);
> extern void timer_normalize(timer_t);
> extern void timer_init(timer_t);
>
> +static inline void
> +thread_read_times_rpc(thread_t thread,
> + rpc_time_value_t *user_time_p, rpc_time_value_t
> *system_time_p)
> +{
> + time_value_t user_p, system_p;
> + thread_read_times(thread, &user_p, &system_p);
> + user_time_p->seconds = user_p.seconds;
> + user_time_p->microseconds = user_p.microseconds;
> + system_time_p->seconds = system_p.seconds;
> + system_time_p->microseconds = system_p.microseconds;
> +}
> +
> #if STAT_TIME
> /*
> * Macro to bump timer values.
> --
> 2.30.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- [PATCH gnumach 0/6] minor fixes and las 32on64 compatibility issue, Luca Dariz, 2023/02/12
- [PATCH 2/6] fix hardcoded physical address, Luca Dariz, 2023/02/12
- [PATCH 6/6] enable syscalls on x86_64, Luca Dariz, 2023/02/12
- [PATCH 1/6] set unused members of thread state to 0, Luca Dariz, 2023/02/12
- [PATCH 3/6] add L4 kmem cache for x86_64, Luca Dariz, 2023/02/12
- [PATCH 4/6] fix rpc time value for 64 bit, Luca Dariz, 2023/02/12
- Re: [PATCH 4/6] fix rpc time value for 64 bit,
Samuel Thibault <=
- [PATCH 5/6] fix port name size in notifications, Luca Dariz, 2023/02/12