]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/jdb_rcupdate.cpp
update
[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 {
40   printf("\nRCU--------------------------\n");
41
42   if (cmd == 0)
43     {
44       printf("RCU:\n  current batch=");
45       print_batch(Rcu::_rcu._current); puts("");
46       printf("  completed=");
47       print_batch(Rcu::_rcu._completed); puts("");
48       printf("  next_pending=%s\n"
49              "  cpus=", Rcu::_rcu._next_pending?"yes":"no");
50       Jdb::cpu_mask_print(Rcu::_rcu._cpus);
51       puts("");
52       printf("  active cpus=");
53       Jdb::cpu_mask_print(Rcu::_rcu._active_cpus);
54       puts("");
55       printf("  active cpus=");
56       Jdb::cpu_mask_print(Rcu::_rcu._active_cpus);
57       puts("");
58
59       for (Cpu_number i = Cpu_number::first(); i < Config::max_num_cpus(); ++i)
60         {
61           if (!Cpu::online(i))
62             continue;
63
64           printf("  CPU[%2u]:", cxx::int_value<Cpu_number>(i));
65           Rcu_data const *d = &Rcu::_rcu_data.cpu(i);
66           printf("    quiescent batch=");
67           print_batch(d->_q_batch); puts("");
68           printf("    quiescent state passed: %s\n", d->_q_passed?"yes":"no");
69           printf("    wait for quiescent state: %s\n", d->_pending?"yes":"no");
70           printf("    batch=");
71           print_batch(d->_batch); puts("");
72           printf("    next list:    h=%p len=%ld\n", d->_n.front(), d->_len);
73           printf("    current list: h=%p \n", d->_c.front());
74           printf("    done list:    h=%p\n", d->_d.front());
75         }
76     }
77   return NOTHING;
78 }
79
80 PUBLIC
81 Jdb_module::Cmd const *
82 Jdb_rcupdate::cmds() const
83 {
84   static Cmd cs[] =
85     {
86         { 0, 0, "rcupdate", "", "rcupdate\tshow RCU information", 0},
87     };
88   return cs;
89 }
90   
91 PUBLIC
92 int
93 Jdb_rcupdate::num_cmds() const
94 { return 1; }
95
96 static Jdb_rcupdate jdb_rcupdate INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
97
98