source: rtems/cpukit/libmisc/cpuuse/cpuusagereset.c @ 82db8e56

4.115
Last change on this file since 82db8e56 was baef6771, checked in by Sebastian Huber <sebastian.huber@…>, on Sep 15, 2011 at 2:34:21 PM

2011-09-15 Sebastian Huber <sebastian.huber@…>

  • cpukit/libmisc/cpuuse/cpuuse.h, cpukit/libmisc/cpuuse/cpuusagedata.c, cpukit/libmisc/cpuuse/cpuusagereport.c, cpukit/libmisc/cpuuse/cpuusagereset.c: Fixed timestamp usage.
  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 *  CPU Usage Reporter
3 *
4 *  COPYRIGHT (c) 1989-2009
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <stdlib.h>
19#include <ctype.h>
20#include <inttypes.h>
21
22#include <rtems/cpuuse.h>
23
24static void CPU_usage_Per_thread_handler(
25  Thread_Control *the_thread
26)
27{
28  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
29    _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
30  #else
31    the_thread->cpu_time_used = 0;
32  #endif
33}
34
35/*
36 *  rtems_cpu_usage_reset
37 */
38void rtems_cpu_usage_reset( void )
39{
40  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
41    _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
42    _Thread_Time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
43  #else
44    CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
45  #endif
46
47  rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
48}
Note: See TracBrowser for help on using the repository browser.