aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authortlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>2003-05-06 22:50:55 +0000
committertlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>2003-05-06 22:50:55 +0000
commit642bd0999b4d21360384ddc69bbbbbcbc24655fc (patch)
tree3d3d4313aa9925a53f3a8dbf5cd8b2411b30a7d2 /tools
parent0d1658ee2283a6488285251f0116d57304dbc2ea (diff)
downloadxen-642bd0999b4d21360384ddc69bbbbbcbc24655fc.tar.gz
xen-642bd0999b4d21360384ddc69bbbbbcbc24655fc.tar.bz2
xen-642bd0999b4d21360384ddc69bbbbbcbc24655fc.zip
bitkeeper revision 1.210 (3eb83c4fHs_yAKLhRwEjFTSk2RBfhA)
xi_list: new file dom0_core.c, sched.h, domain.c: Add default domain name and xi_list to list all running domains
Diffstat (limited to 'tools')
-rwxr-xr-xtools/internal/xi_list45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/internal/xi_list b/tools/internal/xi_list
new file mode 100755
index 0000000000..bff4633f83
--- /dev/null
+++ b/tools/internal/xi_list
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# xi_list
+#
+# This is a silly little script to dump the currently running domains.
+# The output format is a series of space-separate fields for each domain:
+#
+# 1. Domain id
+# 2. Processor
+# 3. Has CPU (1 => true, 0 => false)
+# 4. State (RUNNING, INTERRUPTABLE, UNINTERRUPTABLE, WAIT, SUSPENDED, DYING)
+# 5. MCU advance
+# 6. Total pages
+# 7. Name
+
+INPUT_FILE=/proc/xeno/domains
+
+awk -f - $INPUT_FILE <<EOF
+{
+ dom_id = \$1;
+
+ processor = \$2;
+
+ has_cpu = \$3;
+
+ state = "UNKNOWN";
+
+ if (\$4 == 0) state = "RUNNING";
+ if (\$4 == 1) state = "INTERRUPTIBLE";
+ if (\$4 == 2) state = "UNINTERRUPTABLE";
+ if (\$4 == 4) state = "WAIT";
+ if (\$4 == 8) state = "SUSPENDED";
+ if (\$4 == 16) state = "DYING";
+
+ mcu_advance = \$6;
+
+ tot_pages = \$8;
+
+ printf "%d %d %d %s %d %d %s", dom_id, processor, has_cpu, state, mcu_advance, tot_pages, \$9;
+ for (i = 10; i < NF; i ++) {
+ printf " %s", \$i;
+ }
+ printf "\n";
+}
+EOF