00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 MAP mymap = map_new(100, INT64);
00044
00045
00046 map_key_str (mymap, "birth year");
00047 map_set_int64 (mymap, 2000);
00048 \endcode
00049
00050 All elements have a default value of 0 (or NULL). Elements are only saved to the map when their value is set
00051 to something nonzero. This means that querying for the existance of a key is inexpensive because
00052 no element is created, just a hash table lookup.
00053
00054 @subsection list_sec Lists
00055 A list is a special map which has internally ascending long integer keys. Adding a value to
00056 a list does not require setting a key first. Create a list with _stp_list_new(). Add to it
00057 with _stp_list_add_str() and _stp_list_add_int64(). Clear it with _stp_list_clear().
00058
00059 @subsection string_sec Strings
00060 One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack.
00061 It is also not a good idea to dynamically allocate space for strings with kmalloc(). That leaves us with
00062 statically allocated space for strings. This is what is implemented in the String module. Strings use
00063 preallocated per-cpu buffers and are safe to use (unlike C strings).
00064
00065 @subsection io_sec I/O
00066 Generally things are written to a "print buffer" using the internal
00067 functions _stp_print_xxx().
00068 \code
00069 _stp_print ("Output is: ");
00070 _stp_printf ("pid is %d ", current->pid);
00071 _stp_printf ("name is %s", current->comm);
00072 \endcode
00073 before the probe returns it must call _stp_print_flush(). This
00074 timestamps the accumulated print buffer and sends it to relayfs.
00075 When relayfs fills an internal buffer, the user-space daemon is notified
00076 data is ready and reads a bug per-cpu chunk, which contains a line like:
00077 \verbatim
00078 [123456.000002] Output is: pid is 1234 name is bash
00079 \endverbatim
00080
00081 The user-daemon (stpd) saves this data to a file named something like
00082 "stpd_cpu2". When the user hits ^c, a timer expires, or the probe
00083 module notifies stpd (through a netlink command channel) that it wants
00084 to terminate, stpd does "system(rmmod)" then collects the last output
00085 before exiting.
00086 As an option, if we don't need bulk per-cpu data, we can put
00087 \code
00088 #define STP_NETLINK_ONLY
00089 \endcode
00090 at the top of the module and all output will go over a netlink channel.
00091 In the SystemTap language, we will provide some simple functions to control the buffering policy, which
00092 will control the use of netlink and parameters to relayfs and stpd.
00093
00094 @section status_sec Status
00095 @li Maps are implemented and tested. Histograms are not yet finished.
00096 @li Copy_From_User functions are done.
00097 @li If maps overflow or memory runs out for some reason, globals are set but nothing is done yet.
00098 I expect to implement a function to tell the system to either ignore it or unload the module and quit.
00099 @li Stack functions need much improvement.
00100
00101 @section probe_sec Example Probes
00102
00103 Working sample probe code using the runtime is in runtime/probes.
00104 <a href="dir_000000.html"> Browse probes.</a>
00105
00106 @section todo_sec ToDo
00107 \link todo Click Here for Complete List \endlink
00108
00109 @section links Links
00110 <a href="http:
00111 */