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

4.104.114.84.95
Last change on this file since e49e84c9 was e49e84c9, checked in by Joel Sherrill <joel.sherrill@…>, on 05/21/07 at 20:28:02

2007-05-21 Joel Sherrill <joel.sherrill@…>

  • libmisc/Makefile.am, libmisc/cpuuse/README: Split remaining CPU Usage functionality into multiple files to eliminate unnecessary cohesion. Update README.
  • libmisc/cpuuse/cpuusagereport.c, libmisc/cpuuse/cpuusagereset.c: New files.
  • libmisc/cpuuse/cpuuse.c: Removed.
  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 *  CPU Usage Reporter
3 *
4 *  COPYRIGHT (c) 1989-2007
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
20#include <stdlib.h>
21#include <ctype.h>
22#include <inttypes.h>
23
24#include <rtems/cpuuse.h>
25
26static void CPU_usage_Per_thread_handler(
27  Thread_Control *the_thread
28)
29{
30  #ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
31    the_thread->cpu_time_used.tv_sec  = 0;
32    the_thread->cpu_time_used.tv_nsec = 0;
33  #else
34    the_thread->ticks_executed = 0;
35  #endif
36}
37
38/*
39 *  rtems_cpu_usage_reset
40 */
41void rtems_cpu_usage_reset( void )
42{
43  #ifndef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
44    extern uint32_t   CPU_usage_Ticks_at_last_reset;
45
46    CPU_usage_Ticks_at_last_reset = _Watchdog_Ticks_since_boot;
47  #endif
48
49  rtems_iterate_over_all_threads(CPU_usage_Per_thread_handler);
50}
Note: See TracBrowser for help on using the repository browser.