add oslo-lock tracer

Change-Id: I7dbfe8c1b683af8705cadfb7e7aae7a2062040e5
This commit is contained in:
Kun Huang 2015-11-03 20:54:22 +08:00
parent 97b8879739
commit 5646d51268
3 changed files with 32 additions and 0 deletions

View File

@ -65,3 +65,20 @@ def parse_rabbit(out):
"rtype": "log",
"data": out}
return (rbt_ret, )
def parse_oslolock(out):
"""
in:
ts, 4
ts, 0
...
out:
name: Oslo-Lock
unit: Count
data: [(ts, 0), ...)
"""
ret = {"name": "Oslo-Lock",
"unit": "count",
"rtype": "stream",
"data": out}
return (ret, )

View File

@ -40,6 +40,7 @@ agents_map = {
"rabbit": "python %s/rbt-trace.py",
"rpc": "bash %s/port-input-traffic.sh 5672",
"traffic": "bash %s/device-input-traffic.sh eth0",
"oslolock": "stap %s/oslo-lock.stp", # with sudo, need add current user to stapdev group
}
def run(config):

14
scripts/oslo-lock.stp Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/stap
global count = 0;
global old_count = 0;
probe python.function.entry {
if ((funcname == "lock") && isinstr(filename, "oslo_concurrency/lockutils.py") && (lineno == 163)) {
count = count + 1;
}
}
probe timer.ms(1000) {
new_count = count - old_count;
printf("%d\n", new_count);
old_count = count;
}