]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/jdb_rcupdate.cpp
a3f081852e652cf394ba0063cab6e2e84431a88e
[l4.git] / kernel / fiasco / src / jdb / jdb_rcupdate.cpp
1 IMPLEMENTATION:
2
3 #include <climits>
4 #include <cstring>
5 #include <cstdio>
6
7 #include "jdb.h"
8 #include "jdb_core.h"
9 #include "jdb_module.h"
10 #include "jdb_screen.h"
11 #include "kernel_console.h"
12 #include "keycodes.h"
13 #include "ram_quota.h"
14 #include "simpleio.h"
15 #include "rcupdate.h"
16 #include "static_init.h"
17
18 class Jdb_rcupdate : public Jdb_module
19 {
20 public:
21   Jdb_rcupdate() FIASCO_INIT;
22 };
23
24 IMPLEMENT
25 Jdb_rcupdate::Jdb_rcupdate()
26   : Jdb_module("INFO")
27 {}
28
29 PRIVATE static
30 void
31 Jdb_rcupdate::print_batch(Rcu_batch const &b)
32 {
33   printf("#%ld", b._b);
34 }
35
36 PUBLIC
37 Jdb_module::Action_code
38 Jdb_rcupdate::action(int cmd, void *&, char const *&, int &)
39 { printf("\nRCU--------------------------\n");
40   if (cmd == 0)
41     {
42       printf("RCU:\n  current batch=");
43       print_batch(Rcu::_rcu._current); puts("");
44       printf("  completed=");
45       print_batch(Rcu::_rcu._completed); puts("");
46       printf("  next_pending=%s\n"
47              "  cpus=", Rcu::_rcu._next_pending?"yes":"no");
48       for (unsigned i = 0; i < Config::Max_num_cpus; ++i)
49         printf("%s%s", Rcu::_rcu._cpus.get(i)?"1":"0", i%4 == 3?" ":"");
50
51       puts("");
52
53       for (unsigned i = 0; i < Config::Max_num_cpus; ++i)
54         {
55           if (!Cpu::online(i))
56             continue;
57
58           printf("  CPU[%2u]:", i);
59           Rcu_data const *d = &Rcu::_rcu_data.cpu(i);
60           printf("    quiescent batch=");
61           print_batch(d->_q_batch); puts("");
62           printf("    quiescent state passed: %s\n", d->_q_passed?"yes":"no");
63           printf("    wait for quiescent state: %s\n", d->_pending?"yes":"no");
64           printf("    batch=");
65           print_batch(d->_batch); puts("");
66           printf("    next list:    h=%p len=%ld\n", d->_n.front(), d->_len);
67           printf("    current list: h=%p \n", d->_c.front());
68           printf("    done list:    h=%p\n", d->_d.front());
69         }
70
71       return NOTHING;
72     }
73   return NOTHING;
74 }
75
76 PUBLIC
77 Jdb_module::Cmd const *
78 Jdb_rcupdate::cmds() const
79 {
80   static Cmd cs[] =
81     {
82         { 0, 0, "rcupdate", "", "rcupdate\tshow RCU information", 0},
83     };
84   return cs;
85 }
86   
87 PUBLIC
88 int
89 Jdb_rcupdate::num_cmds() const
90 { return 1; }
91
92 static Jdb_rcupdate jdb_rcupdate INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
93
94