From 6426cb850511923b30258b9993ad181dcdcf0bfb Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 22 Feb 2018 22:00:17 +0545 Subject: [PATCH] scripts: fixes --- scripts/profile_ansible.d | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/profile_ansible.d b/scripts/profile_ansible.d index 70f72c9d..ad66a2c8 100755 --- a/scripts/profile_ansible.d +++ b/scripts/profile_ansible.d @@ -76,6 +76,12 @@ syscall::socket:return self->inet_fds[arg0] = 1; } +syscall::close:entry +/execname == SSH/ +{ + self->inet_fds[arg0] = 0; +} + syscall::write:entry, syscall::write_nocancel:entry { @@ -114,17 +120,24 @@ proc:::lwp-exit { this->nsecs = vtimestamp - self->start_vtime; printf("%d,EXIT,,%d,%d,%s\n", walltimestamp, this->nsecs, pid, execname); + /* Kernel threads are recycled, variables hang around. */ + self->start_vtime = 0; + self->ontime = 0; } sched:::on-cpu /self->start_vtime/ { - self->ontime = vtimestamp; + self->ontime = timestamp; } sched:::off-cpu /self->ontime/ { - this->spent = vtimestamp - self->ontime; - printf("%d,SCHED,,%d,%d,%s\n", walltimestamp, this->spent, pid, execname); + printf("%d,SCHED,,%d,%d,%s\n", + walltimestamp, + timestamp - self->ontime, + pid, + execname + ); }