Subversion Repositories shark

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/**
20
 ------------
21
 CVS :        $Id: status.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1.1.1 $
25
 Last update: $Date: 2002-03-29 14:12:52 $
26
 ------------
27
 
28
 This file contains the sys_status stuffs
29
 
30
**/
31
 
32
/*
33
 * Copyright (C) 2000 Paolo Gai
34
 *
35
 * This program is free software; you can redistribute it and/or modify
36
 * it under the terms of the GNU General Public License as published by
37
 * the Free Software Foundation; either version 2 of the License, or
38
 * (at your option) any later version.
39
 *
40
 * This program is distributed in the hope that it will be useful,
41
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43
 * GNU General Public License for more details.
44
 *
45
 * You should have received a copy of the GNU General Public License
46
 * along with this program; if not, write to the Free Software
47
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
48
 *
49
 */
50
 
51
#include <stdarg.h>
52
#include <ll/ll.h>
53
#include <ll/stdlib.h>
54
#include <ll/stdio.h>
55
#include <ll/string.h>
56
#include <kernel/config.h>
57
#include <kernel/model.h>
58
#include <kernel/const.h>
59
#include <sys/types.h>
60
#include <kernel/types.h>
61
#include <kernel/descr.h>
62
#include <errno.h>
63
#include <kernel/var.h>
64
#include <kernel/func.h>
65
 
66
/*+ Convert a status in a string. Useful for sys_status and level_status +*/
67
char *status_to_a(WORD status)
68
{
69
  switch (status) {
70
    case FREE      : return "Free";
71
    case EXE       : return "Exe";
72
    case SLEEP     : return "Sleep";
73
    case WAIT_JOIN : return "Waiting on join";
74
    default        : return "Unknown";
75
  }
76
}
77
 
78
/*+ this primitive prints the status of the system +*/
79
void sys_status(DWORD cw)
80
{
81
  SYS_FLAGS f;        /* used with VM_save */
82
  LEVEL l;            /* a counter */
83
  struct timespec t;  /* the current time */
84
 
85
  f = kern_fsave();
86
 
87
  if (cw & CLOCK_STATUS) {
88
    ll_gettime(TIME_EXACT,&t);
89
    kern_printf("Time (EXACT) : %lus %luns\n", t.tv_sec, t.tv_nsec);
90
  }
91
 
92
  if (cw & SCHED_STATUS) {
93
    for (l=0; l<sched_levels; l++) {
94
      kern_printf("< Level %d : %s Code: %d Version: %d >\n", l,
95
                level_table[l]->level_name,
96
                level_table[l]->level_code,
97
                level_table[l]->level_version);
98
      level_table[l]->level_status(l);
99
    }
100
  }
101
 
102
  if (cw & MEM_STATUS) {
103
    kern_printf("< Memory Dump >\n");
104
    kern_mem_dump();
105
  }
106
 
107
  kern_frestore(f);
108
}