/////////////////////////////////////////////////////////////////////////////// /// fork_exit.stp ///////////////////////////////////////////////////////////// /* * fork_exit.stp - Overlooks sched_fork()/exit_exit() for satprocess/satthread * and prints some information * * Copyright (C) 2007 Satoru Takeuchi * Copyright (C) 2007 Vitaly Mayatskikh * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. */ function is_my_testpro(comm) { if (comm == "satthread" || comm == "satprocess" || comm == "thread-stress") return 1 else return 0 } function get_creators_timeslice:long(cpid:long) %{ struct task_struct* creator = 0; if (THIS->cpid) creator = find_task_by_pid_type(PIDTYPE_PID, THIS->cpid); if (creator) THIS->__retvalue = creator->time_slice; else THIS->__retvalue = 0; %} probe kernel.function("sched_exit") { if (is_my_testpro(kernel_string($p->comm))) printf("sched_exit/enter: pid = %d, tgid = %d, ppid = %d, creator = %d, avail. timeslice = %d, creator's timeslice = %d\n", $p->pid, $p->tgid, $p->parent->pid, $p->cpid, $p->time_slice, get_creators_timeslice($p->cpid)); } probe kernel.function("sched_exit").return { if (is_my_testpro(kernel_string($p->comm))) printf("sched_exit/return: pid = %d, tgid = %d, ppid = %d, creator = %d, creator's adjusted timeslice = %d\n", $p->pid, $p->tgid, $p->parent->pid, $p->cpid, get_creators_timeslice($p->cpid) ); }