RTEMS | Draft: add programmatic interface for data produced by cpuuse (!232)
Kinsey Moore (@opticron)
gitlab at rtems.org
Sat Sep 28 21:01:56 UTC 2024
Kinsey Moore started a new discussion on cpukit/libmisc/cpuuse/cpuusagereport.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/232#note_112679
> +bool cpu_usage_visitor( Thread_Control *the_thread, void *arg )
> +{
> +
> + cpuuse_info cpuuse_data;
> + cpu_usage_context *ctx;
> +
> + ctx = arg;
> + _Thread_Get_name( the_thread, cpuuse_data.name, sizeof( cpuuse_data.name ) );
> +
> + cpuuse_data.time_used_after_last_reset = _Thread_Get_CPU_time_used_after_last_reset(the_thread );
> + _TOD_Get_uptime( &cpuuse_data.uptime );
> + _Timestamp_Subtract( &ctx->uptime_at_last_reset, &cpuuse_data.uptime, &ctx->total );
> + _Timestamp_Divide( &cpuuse_data.time_used_after_last_reset, &ctx->total, &cpuuse_data.ival, &cpuuse_data.fval );
> + cpuuse_data.seconds = _Timestamp_Get_seconds( &cpuuse_data.time_used_after_last_reset );
> + cpuuse_data.nanoseconds = _Timestamp_Get_nanoseconds( &cpuuse_data.time_used_after_last_reset ) /
> + TOD_NANOSECONDS_PER_MICROSECOND;
Make sure that lines don't go over 80 columns and that continuation lines are indented with 2 spaces.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/232#note_112679
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240928/813ddbf5/attachment-0001.htm>
More information about the bugs
mailing list