From e32551b18f4560056d2d482f5e1505b1b98fa82a Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 29 Mar 2005 18:07:58 +0000 Subject: *** empty log message *** --- runtime/docs/html/test4_2dtr_8c-source.html | 245 ++++++++++++++++------------ 1 file changed, 139 insertions(+), 106 deletions(-) (limited to 'runtime/docs/html/test4_2dtr_8c-source.html') diff --git a/runtime/docs/html/test4_2dtr_8c-source.html b/runtime/docs/html/test4_2dtr_8c-source.html index 47241e71..2847b88a 100644 --- a/runtime/docs/html/test4_2dtr_8c-source.html +++ b/runtime/docs/html/test4_2dtr_8c-source.html @@ -4,114 +4,147 @@ -
Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages
+
Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

dtr.c

00001 #define HASH_TABLE_BITS 8
 00002 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
 00003 #define BUCKETS 16 /* largest histogram width */
-00004 
-00005 #include "runtime.h"
-00006 #include "io.c"
-00007 #include "map.c"
-00008 #include "probes.c"
-00009 
-00010 MODULE_DESCRIPTION("SystemTap probe: test4");
-00011 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
-00012 
-00013 MAP opens, reads, writes;
-00014 
-00015 asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode)
-00016 {
-00017   _stp_map_key_str (opens, current->comm);
-00018   _stp_map_add_int64 (opens, 1);
-00019   jprobe_return();
-00020   return 0;
-00021 }
-00022 
-00023 asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
-00024 {
-00025   _stp_map_key_str (reads, current->comm);
-00026   _stp_map_stat_add (reads, count);
-00027   jprobe_return();
-00028   return 0;
-00029 }
-00030 
-00031 asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
-00032 {
-00033   _stp_map_key_str (writes, current->comm);
-00034   _stp_map_stat_add (writes, count);
-00035   jprobe_return();
-00036   return 0;
-00037 }
-00038 
-00039 static struct jprobe dtr_probes[] = {
-00040   {
-00041     .kp.addr = (kprobe_opcode_t *)"sys_open",
-00042     .entry = (kprobe_opcode_t *) inst_sys_open
-00043   },
-00044   {
-00045     .kp.addr = (kprobe_opcode_t *)"sys_read",
-00046     .entry = (kprobe_opcode_t *) inst_sys_read
-00047   },
-00048   {
-00049     .kp.addr = (kprobe_opcode_t *)"sys_write",
-00050     .entry = (kprobe_opcode_t *) inst_sys_write
-00051   },
-00052 };
-00053 
-00054 #define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe))
-00055 
-00056 static int init_dtr(void)
-00057 {
-00058   int ret;
-00059   
-00060   opens = _stp_map_new (1000, INT64);
-00061   reads = _stp_map_new (1000, STAT);
-00062   writes = _stp_map_new (1000, STAT);
-00063 
-00064   ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00065 
-00066   dlog("instrumentation is enabled...\n");
-00067   return ret;
-00068 
-00069 }
-00070 
-00071 static void cleanup_dtr(void)
-00072 {
-00073   struct map_node_stat *st;
-00074   struct map_node_int64 *ptr;
-00075 
-00076   _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00077 
-00078   for (ptr = (struct map_node_int64 *)_stp_map_start(opens); ptr; 
-00079        ptr = (struct map_node_int64 *)_stp_map_iter (opens,(struct map_node *)ptr))
-00080     dlog ("opens[%s] = %lld\n", key1str(ptr), ptr->val); 
-00081   dlog ("\n");
-00082 
-00083   for (st = (struct map_node_stat *)_stp_map_start(reads); st; 
-00084        st = (struct map_node_stat *)_stp_map_iter (reads,(struct map_node *)st))
-00085     dlog ("reads[%s] = [count=%lld  sum=%lld   min=%lld   max=%lld]\n", key1str(st), st->stats.count, st->stats.sum,
-00086             st->stats.min, st->stats.max);
-00087   dlog ("\n");
-00088 
-00089   for (st = (struct map_node_stat *)_stp_map_start(writes); st; 
-00090        st = (struct map_node_stat *)_stp_map_iter (writes,(struct map_node *)st))
-00091     dlog ("writes[%s] = [count=%lld  sum=%lld   min=%lld   max=%lld]\n", key1str(st), st->stats.count, st->stats.sum,
-00092             st->stats.min, st->stats.max);
-00093   dlog ("\n");
-00094 
-00095   _stp_map_del (opens);
-00096   _stp_map_del (reads);
-00097   _stp_map_del (writes);
-00098 
-00099   dlog("EXIT\n");
-00100 }
-00101 
-00102 module_init(init_dtr);
-00103 module_exit(cleanup_dtr);
-00104 MODULE_LICENSE("GPL");
-00105 
-

-Generated on Tue Mar 22 10:27:36 2005 for SystemTap. - +00004 #include <linux/module.h> +00005 #include <linux/interrupt.h> +00006 #include <net/sock.h> +00007 +00008 #include "runtime.h" +00009 #include "io.c" +00010 #include "map.c" +00011 #include "probes.c" +00012 #include "stack.c" +00013 +00014 MODULE_DESCRIPTION("SystemTap probe: test4"); +00015 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>"); +00016 +00017 static char tbuffer[2][50000]; +00018 static void stp_helper(void *); +00019 static DECLARE_WORK(stp_work, stp_helper, tbuffer); +00020 +00021 MAP opens, reads, writes, traces; +00022 static int bufcount = 0; +00023 +00024 static void stp_helper (void *data) +00025 { +00026 dlog ("HELPER\n"); +00027 } +00028 +00029 asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode) +00030 { +00031 _stp_map_key_str (opens, current->comm); +00032 _stp_map_add_int64 (opens, 1); +00033 jprobe_return(); +00034 return 0; +00035 } +00036 +00037 asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count) +00038 { +00039 _stp_map_key_str (reads, current->comm); +00040 _stp_map_stat_add (reads, count); +00041 jprobe_return(); +00042 return 0; +00043 } +00044 +00045 asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count) +00046 { +00047 _stp_map_key_str (writes, current->comm); +00048 _stp_map_stat_add (writes, count); +00049 jprobe_return(); +00050 return 0; +00051 } +00052 +00053 int inst_show_cpuinfo(struct seq_file *m, void *v) +00054 { +00055 _stp_stack_print (0,0); +00056 _stp_stack_print (1,0); +00057 +00058 _stp_scbuf_clear(); +00059 _stp_list_add (traces, _stp_stack_sprint(0,0)); +00060 if (bufcount++ == 0) +00061 schedule_work (&stp_work); +00062 +00063 jprobe_return(); +00064 return 0; +00065 } +00066 +00067 +00068 static struct jprobe dtr_probes[] = { +00069 { +00070 .kp.addr = (kprobe_opcode_t *)"sys_open", +00071 .entry = (kprobe_opcode_t *) inst_sys_open +00072 }, +00073 { +00074 .kp.addr = (kprobe_opcode_t *)"sys_read", +00075 .entry = (kprobe_opcode_t *) inst_sys_read +00076 }, +00077 { +00078 .kp.addr = (kprobe_opcode_t *)"sys_write", +00079 .entry = (kprobe_opcode_t *) inst_sys_write +00080 }, +00081 { +00082 .kp.addr = (kprobe_opcode_t *)"show_cpuinfo", +00083 .entry = (kprobe_opcode_t *) inst_show_cpuinfo, +00084 }, +00085 }; +00086 +00087 #define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe)) +00088 +00089 static int init_dtr(void) +00090 { +00091 int ret; +00092 +00093 opens = _stp_map_new (1000, INT64); +00094 reads = _stp_map_new (1000, STAT); +00095 writes = _stp_map_new (1000, STAT); +00096 traces = _stp_list_new (1000, STRING); +00097 +00098 ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE); +00099 +00100 dlog("instrumentation is enabled...\n"); +00101 return ret; +00102 +00103 } +00104 +00105 static void cleanup_dtr(void) +00106 { +00107 struct map_node_stat *st; +00108 struct map_node_int64 *ptr; +00109 struct map_node_str *sptr; +00110 +00111 _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE); +00112 +00113 foreach (traces, sptr) +00114 dlog ("trace: %s\n", sptr->str); +00115 +00116 foreach (opens, ptr) +00117 dlog ("opens[%s] = %lld\n", key1str(ptr), ptr->val); +00118 dlog ("\n"); +00119 +00120 foreach (reads, st) +00121 dlog ("reads[%s] = [count=%lld sum=%lld min=%lld max=%lld]\n", key1str(st), +00122 st->stats.count, st->stats.sum, st->stats.min, st->stats.max); +00123 dlog ("\n"); +00124 +00125 foreach (writes, st) +00126 dlog ("writes[%s] = [count=%lld sum=%lld min=%lld max=%lld]\n", key1str(st), +00127 st->stats.count, st->stats.sum, st->stats.min, st->stats.max); +00128 dlog ("\n"); +00129 +00130 _stp_map_del (opens); +00131 _stp_map_del (reads); +00132 _stp_map_del (writes); +00133 +00134 dlog("EXIT\n"); +00135 } +00136 +00137 module_init(init_dtr); +00138 module_exit(cleanup_dtr); +00139 MODULE_LICENSE("GPL"); +00140 + -- cgit