Skip to content

Commit d1fbaca

Browse files
committed
modify readme
1 parent 9a2de5f commit d1fbaca

File tree

2 files changed

+54
-12
lines changed

2 files changed

+54
-12
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,46 @@ Other Graphs
5656
============
5757
![callgraph of sdopen(simplify version)](/examples/images/sdopen.simplify.cg.png)
5858

59+
Advances
60+
========
61+
The gen_stap.sh tool is used to generate systemtap scripts for advanced feature like probing more modules.
62+
You could add '-m' with modules name.
63+
For instance, add '-m target_core_mod.ko,iscsi_target_mod.ko,target_core_file.ko' for probing target core module, iscsi module and file-based backstore target module.
64+
65+
You could do as you need.
66+
67+
1. Usage
68+
----------
69+
```
70+
$ ./gen_stap.sh -h
71+
72+
Usage:
73+
-e, --entry func, must options here
74+
-m, --modules modules, put multi modules splitted with comma(,)
75+
-f, --force_cache
76+
-o, --out_stap
77+
-v, --verbose, probe suffix ?
78+
```
79+
80+
2. Create stap as your want
81+
-------
82+
```
83+
$ ./gen_stap.sh -m target_core_mod.ko,iscsi_target_mod.ko,target_core_file.ko -e iscsi_sw_tcp_conn_create -o test.stp
84+
Entry func: module("iscsi_tcp").function("iscsi_sw_tcp_conn_create")
85+
Inject modules: target_core_mod.ko,iscsi_target_mod.ko,target_core_file.ko,iscsi_tcp
86+
Out_stap: test.stp
87+
Force cache: 0
88+
Probe check: 0
89+
```
90+
91+
3. Run stap
92+
------------
93+
94+
```
95+
$ bash ./iscsi_sw_tcp_conn_create.stap -v
96+
or
97+
$ bash ./iscsi_sw_tcp_conn_create.stap
98+
```
5999

60100
Details
61101
=======
@@ -97,4 +137,4 @@ You can go to `example/log/` and play.
97137
Contact
98138
=======
99139
Alex Feng
100-
lifeng1519@gmail.com
140+
lifeng1519@gmail.com

gen_stap.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ function usage() {
44
echo $1
55
echo "Usage:"
66
echo " -e, --entry func, must options here"
7-
echo " -m, --modules modules, put multi modules splited with comma(,)"
7+
echo " -m, --modules modules, put multi modules splitted with comma(,)"
88
echo " -f, --force_cache"
9+
echo " -o, --out_stap"
10+
echo " -v, --verbose, probe suffix ?"
911
}
1012
function make_caches() {
1113
cache_dir=~/.kernel_visualization.cache
@@ -62,7 +64,7 @@ done
6264

6365

6466
[[ -z $entry ]] && usage && exit
65-
[[ -z $out ]] && out=$entry.stap
67+
[[ -z $out_stap ]] && out_stap=$entry.stap
6668

6769
calls=""
6870
returns=""
@@ -102,19 +104,19 @@ if [ -z "$calls" ];then
102104
returns="probe kernel.function(\"*\").return?"
103105
fi
104106

105-
echo "Entry func: $probe"
106-
echo "Inject modules: $modules"
107-
echo "Out_stap: $out"
108-
echo "Force cache: $force_cache"
109-
echo "Probe check: $verbose"
107+
echo "[+] Entry func: $probe"
108+
echo "[+] Inject modules: $modules"
109+
echo "[+] Out_stap: $out_stap"
110+
echo "[+] Force cache: $force_cache"
111+
echo "[+] Probe check: $verbose"
110112

111113

112-
sed -e "s/\$1/$probe/g" -e "s/probe \$2.call/$calls/g" -e "s/probe \$2.return/$returns/g" stap_base.stp >$out
113-
cat >>$out <<EOF
114+
sed -e "s/\$1/$probe/g" -e "s/probe \$2.call/$calls/g" -e "s/probe \$2.return/$returns/g" stap_base.stp >$out_stap
115+
cat >>$out_stap <<EOF
114116
##############################################################################
115117
# Generated by gen_stap.sh using cmd:
116118
# $cmd
117119
# Author: Feng Li (lifeng1519@gmail.com)
118120
EOF
119-
chmod a+x $out
120-
cat $out
121+
chmod a+x $out_stap
122+
cat $out_stap

0 commit comments

Comments
 (0)