ia64/xen-unstable

view tools/internal/xi_list @ 522:07cb518caf2f

bitkeeper revision 1.289 (3f09877bT-kkJTOM1WvHevpN2wY-qw)

Prune old code
author rac61@labyrinth.cl.cam.ac.uk
date Mon Jul 07 14:45:15 2003 +0000 (2003-07-07)
parents 316a46d203dd
children
line source
1 #!/bin/bash
2 #
3 # xi_list
4 #
5 # This is a silly little script to dump the currently running domains.
6 # The output format is a series of space-separate fields for each domain:
7 #
8 # 1. Domain id
9 # 2. Processor
10 # 3. Has CPU (1 => true, 0 => false)
11 # 4. State (integer)
12 # 5. State (RUNNING, INTERRUPTABLE, UNINTERRUPTABLE, WAIT, SUSPENDED, DYING)
13 # 6. MCU advance
14 # 7. Total pages
15 # 8. Name
17 INPUT_FILE=/proc/xeno/domains
19 awk -f - $INPUT_FILE <<EOF
20 {
21 dom_id = \$1;
23 processor = \$2;
25 has_cpu = \$3;
27 state = "UNKNOWN";
29 if (\$4 == 0) state = "RUNNING";
30 if (\$4 == 1) state = "INTERRUPTIBLE";
31 if (\$4 == 2) state = "UNINTERRUPTABLE";
32 if (\$4 == 4) state = "WAIT";
33 if (\$4 == 8) state = "SUSPENDED";
34 if (\$4 == 16) state = "DYING";
36 mcu_advance = \$6;
38 tot_pages = \$8;
40 printf "%d %d %d %d %s %d %d %s", dom_id, processor, has_cpu, \$4, state, mcu_advance, tot_pages, \$9;
41 for (i = 10; i < NF; i ++) {
42 printf " %s", \$i;
43 }
44 printf "\n";
45 }
46 EOF