add model save tracer
Change-Id: Idf8e264a4328acdca0fa435f6d9b9b346a2152d4
This commit is contained in:
parent
3cacb3cb76
commit
272792ef58
@ -66,6 +66,13 @@ def parse_rabbit(out):
|
||||
"data": out}
|
||||
return (rbt_ret, )
|
||||
|
||||
def _parse_count_stream(out, name):
|
||||
ret = {"name": name,
|
||||
"unit": "count",
|
||||
"rtype": "stream",
|
||||
"data": out}
|
||||
return (ret, )
|
||||
|
||||
def parse_oslolock(out):
|
||||
"""
|
||||
in:
|
||||
@ -77,8 +84,7 @@ def parse_oslolock(out):
|
||||
unit: Count
|
||||
data: [(ts, 0), ...)
|
||||
"""
|
||||
ret = {"name": "Oslo-Lock",
|
||||
"unit": "count",
|
||||
"rtype": "stream",
|
||||
"data": out}
|
||||
return (ret, )
|
||||
return _parse_count_stream(out, "Oslo-Lock")
|
||||
|
||||
def parse_modelsave(out):
|
||||
return _parse_count_stream(out, "Model-Save")
|
||||
|
@ -41,6 +41,7 @@ agents_map = {
|
||||
"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
|
||||
"modelsave": "stap %s/model-save.stp", # with sudo, need add current user to stapdev group
|
||||
}
|
||||
|
||||
def run(config):
|
||||
|
14
scripts/model-save.stp
Executable file
14
scripts/model-save.stp
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/stap
|
||||
|
||||
global count = 0;
|
||||
global old_count = 0;
|
||||
probe python.function.entry {
|
||||
if ((funcname == "save") && isinstr(filename, "oslo_db/sqlalchemy/models.py") ) {
|
||||
count = count + 1;
|
||||
}
|
||||
}
|
||||
probe timer.ms(1000) {
|
||||
new_count = count - old_count;
|
||||
printf("%d\n", new_count);
|
||||
old_count = count;
|
||||
}
|
Loading…
Reference in New Issue
Block a user