2297e3a8 |
1 | |
2 | |
3 | Mathieu Desnoyers |
4 | |
5 | March 2006 |
6 | |
7 | Here is a simpler, but slower, version of user space tracing design. |
8 | |
9 | It will be useful on architectures where doing a system call is mandatory, for |
10 | example when CPUs are lacking a 64 bits TSC : it must be worked around by doing |
11 | a system call to the the time or the synthetic MSB of the TSC (yes, disabling |
12 | preemption is at least required). |
13 | |
14 | |
15 | So the design is simple : |
16 | |
17 | Two system calls : |
18 | |
19 | One system call for event logging |
20 | |
21 | |
22 | ltt_trace_generic |
23 | args : |
24 | fac_id |
25 | event_id |
26 | data pointer |
27 | data size |
28 | |
29 | ltt_register_generic |
30 | args: |
31 | struct pointer (in) |
32 | fac_id pointer (out) |
33 | |
34 | #define NAME_MAX 4096 |
35 | |
36 | struct : |
37 | char name[NAME_MAX] |
38 | u32 num_events |
39 | u32 checksum |
40 | u32 alignment |
41 | u32 int_size |
42 | u32 long_size |
43 | u32 pointer_size |
44 | u32 size_t_size |
45 | |
46 | |
47 | If a facility is registered twice, the same handle is used. |
48 | For a facility to be the exact same, it must share _every_ element of the |
49 | struct (even type sizes). |
50 | Potential problem : If a facility is registered, it is never unregistered. |
51 | |
52 | Now.. not being able to free facilities when they are not used is not fun. So |
53 | how can we know every process that has registered a facility have finished using |
54 | it ? If we know that, we might do a cleanup when _all_ the traces are destroyed: |
55 | this is way better than a reboot. |
56 | |
57 | A solution might be to keep a reference count to the fac_id : it would be |
58 | incremented upon registration and decremented when a process exits. To do that, |
59 | a process must keep an array of fac ids it uses. 0 is unset. |
60 | |
61 | CONFIG option : |
62 | |
63 | CONFIG_LTT_USERSPACE_GENERIC |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |