diff --git a/scalpels/agents/base.py b/scalpels/agents/base.py index a0a18ee..d90c7f0 100644 --- a/scalpels/agents/base.py +++ b/scalpels/agents/base.py @@ -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, ) diff --git a/scalpels/cli/actions/start.py b/scalpels/cli/actions/start.py index 86e476d..27826aa 100644 --- a/scalpels/cli/actions/start.py +++ b/scalpels/cli/actions/start.py @@ -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): diff --git a/scripts/oslo-lock.stp b/scripts/oslo-lock.stp new file mode 100755 index 0000000..02ad952 --- /dev/null +++ b/scripts/oslo-lock.stp @@ -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; +}