source: rtems/c/src/tests/libtests/cpuuse/tswitch.c @ 17177e2c

4.104.114.84.95
Last change on this file since 17177e2c was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*  Task_switch
2 *
3 *  This routine is the tswitch user extension.  It determines which
4 *  task is being switched to and displays a message indicating the
5 *  time and date that it gained control.
6 *
7 *  Input parameters:
8 *    unused  - pointer to currently running TCB
9 *    heir    - pointer to heir TCB
10 *
11 *  Output parameters:  NONE
12 *
13 *  COPYRIGHT (c) 1989-1999.
14 *  On-Line Applications Research Corporation (OAR).
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include "system.h"
24
25#include <rtems/cpuuse.h>
26
27rtems_extension Task_switch(
28  rtems_tcb *unused,
29  rtems_tcb *heir
30)
31{
32  rtems_unsigned32  index;
33  rtems_time_of_day time;
34  rtems_status_code status;
35
36  index = task_number( heir->Object.id );
37
38  switch( index ) {
39    case 1:
40    case 2:
41    case 3:
42      Run_count[ index ] += 1;
43
44      status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
45      directive_failed( status, "rtems_clock_get" );
46
47      put_name( Task_name[ index ], FALSE );
48      print_time( "- ", &time, "\n" );
49
50      if ( time.second >= 16 ) {
51        CPU_usage_Dump();
52        puts( "*** END OF CPU USAGE LIBRARY TEST ***" );
53        exit( 0 );
54      }
55      break;
56
57    case 0:
58    default:
59      break;
60  }
61}
Note: See TracBrowser for help on using the repository browser.