source: rtems/cpukit/libmisc/cpuuse/cpuusagereset.c @ dca9a82

4.104.115
Last change on this file since dca9a82 was dca9a82, checked in by Glenn Humphrey <glenn.humphrey@…>, on 12/02/09 at 18:22:19

2009-12-02 Glenn Humphrey <glenn.humphrey@…>

  • libcsupport/src/times.c, libmisc/cpuuse/cpuusagedata.c, libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c, rtems/include/rtems/rtems/types.h, rtems/src/ratemongetstatistics.c, rtems/src/ratemonreportstatistics.c, score/src/threaddispatch.c, score/src/threadinitialize.c, score/src/threadtickletimeslice.c: Updated copyright line.
  • Property mode set to 100644
File size: 1.3 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 <rtems.h>
19#include <rtems/score/timestamp.h>
20
21#include <stdlib.h>
22#include <ctype.h>
23#include <inttypes.h>
24
25#include <rtems/cpuuse.h>
26
27static void CPU_usage_Per_thread_handler(
28  Thread_Control *the_thread
29)
30{
31  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
32    _Timestamp_Set_to_zero( &the_thread->cpu_time_used );
33  #else
34    the_thread->cpu_time_used = 0;
35  #endif
36}
37
38/*
39 * External data that is shared by cpu usage code but not declared in .h files.
40 */
41#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
42  extern Timestamp_Control CPU_usage_Uptime_at_last_reset;
43#else
44  extern uint32_t   CPU_usage_Ticks_at_last_reset;
45#endif
46
47/*
48 *  rtems_cpu_usage_reset
49 */
50void rtems_cpu_usage_reset( void )
51{
52  #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
53    _TOD_Get_uptime( &CPU_usage_Uptime_at_last_reset );
54    _Thread_Time_of_last_context_switch = CPU_usage_Uptime_at_last_reset;
55  #else
56    CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
57  #endif
58
59  rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
60}
Note: See TracBrowser for help on using the repository browser.