/usr/share/systemtap/examples/process
NameSizeModeActions
auditbt.meta4290644editdlrm
auditbt.stp6220755editdlrm
auditbt.tcl790644editdlrm
chng_cpu.meta7750644editdlrm
chng_cpu.stp10490755editdlrm
chng_cpu.tcl1400644editdlrm
cycle_thief.meta10820644editdlrm
cycle_thief.stp28930755editdlrm
cycle_thief.txt59740644editdlrm
errsnoop.meta5750644editdlrm
errsnoop.stp10150755editdlrm
forktracker.meta5250644editdlrm
forktracker.stp6010755editdlrm
futexes.meta5200644editdlrm
futexes.stp11180755editdlrm
futexes.txt9440644editdlrm
futexes2.meta5930644editdlrm
futexes2.stp20140644editdlrm
ltrace.meta3140644editdlrm
ltrace.stp30070755editdlrm
ltrace.tcl1220644editdlrm
migrate.meta7460644editdlrm
migrate.stp10370755editdlrm
mutex-contention.meta4790644editdlrm
mutex-contention.stp55590755editdlrm
mutex-contention.tcl790644editdlrm
noptrace.meta5120644editdlrm
noptrace.stp22350755editdlrm
noptrace.txt12120644editdlrm
pfiles.meta4500644editdlrm
pfiles.stp245230755editdlrm
plimit.meta3870644editdlrm
plimit.stp30290755editdlrm
procmod_watcher.meta6570644editdlrm
procmod_watcher.stp24060644editdlrm
proctop.meta6010644editdlrm
proctop.stp42450755editdlrm
proctop.txt86540644editdlrm
proc_snoop.stp11330755editdlrm
proc_snoop_parser.xml8180644editdlrm
proc_snoop_parser_instructions.txt21800644editdlrm
psig.meta3540644editdlrm
psig.stp56160755editdlrm
pstrace_exec.meta5450644editdlrm
pstrace_exec.stp4650755editdlrm
pstree.meta4550644editdlrm
pstree.stp19570755editdlrm
rlimit_nofile.meta3190644editdlrm
rlimit_nofile.stp11510755editdlrm
sched-latency.meta4700644editdlrm
sched-latency.stp5080644editdlrm
sched-latency.txt15660644editdlrm
schedtimes.meta8140644editdlrm
schedtimes.stp39490755editdlrm
schedtimes.txt32780644editdlrm
semop-watch.meta2670644editdlrm
semop-watch.stp8220755editdlrm
sigkill.meta5600644editdlrm
sigkill.stp6560755editdlrm
sigmon.meta6690644editdlrm
sigmon.stp9320755editdlrm
sig_by_pid.meta3570644editdlrm
sig_by_pid.stp10780755editdlrm
sig_by_pid.txt15140644editdlrm
sig_by_proc.meta3640644editdlrm
sig_by_proc.stp8510755editdlrm
sig_by_proc.txt9510644editdlrm
sleepingBeauties.meta5810644editdlrm
sleepingBeauties.stp13640755editdlrm
sleepingBeauties.tcl1400644editdlrm
sleeptime.meta6010644editdlrm
sleeptime.stp14690755editdlrm
spawn_seeker.meta8540644editdlrm
spawn_seeker.stp15260755editdlrm
spawn_seeker.txt13180644editdlrm
strace.meta3850644editdlrm
strace.stp20810755editdlrm
strace.txt36720644editdlrm
syscalls_by_pid.meta5140644editdlrm
syscalls_by_pid.stp6330755editdlrm
syscalls_by_pid.txt5970644editdlrm
syscalls_by_proc.meta5310644editdlrm
syscalls_by_proc.stp6920755editdlrm
syscalls_by_proc.txt11300644editdlrm
syscalltimes62910755editdlrm
syscalltimes.meta4540644editdlrm
syscalltimes.txt114590644editdlrm
thread-business.meta3460644editdlrm
thread-business.stp8660755editdlrm
thread-business.txt28230644editdlrm
threadstacks.meta5850644editdlrm
threadstacks.stp17890755editdlrm
threadstacks.tcl790644editdlrm
wait4time.meta6580644editdlrm
wait4time.stp13470755editdlrm
Edit: /usr/share/systemtap/examples/process/plimit.stp (3029B)
# plimit.stp # Copyright (C) 2006 Red Hat, Inc., Eugene Teo # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # Example: # $ stap -g plimit.stp `pgrep udevd` # OR # $ stap -g plimit.stp -x `pgrep udevd` # # plimit.stp prints a variety of resource limits for a given pid. # %{ #include #include %} function getrlimit:string (rlim:long, pid:long) %{ /* pure */ struct task_struct *p; struct list_head *_p, *_n; static char cur_buf[24], max_buf[24]; long int cur, max; list_for_each_safe(_p, _n, ¤t->tasks) { p = list_entry(_p, struct task_struct, tasks); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) cur = p->signal->rlim[STAP_ARG_rlim].rlim_cur; max = p->signal->rlim[STAP_ARG_rlim].rlim_max; #else cur = p->rlim[STAP_ARG_rlim].rlim_cur; max = p->rlim[STAP_ARG_rlim].rlim_max; #endif if (p->pid == (int)STAP_ARG_pid) { if (cur == -1 && max == -1) strcat(STAP_RETVALUE, "unlimited unlimited"); else if (cur == -1) snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%-9s %-9ld", "unlimited", max); else if (max == -1) snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%-9ld %-9s", cur, "unlimited"); else snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%-9ld %-9ld", cur, max); } } %} function task_execname_by_pid:string (pid:long) %{ /* pure */ struct task_struct *p; struct list_head *_p, *_n; list_for_each_safe(_p, _n, ¤t->tasks) { p = list_entry(_p, struct task_struct, tasks); if (p->pid == (int)STAP_ARG_pid) snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%s", p->comm); } %} probe begin { %( $# < 1 %? pid = target() %: pid = $1 %) if (pid == 0) error ("Please provide valid target process-id as $1 or -x PID"); printf("%d: -%s\n", pid, task_execname_by_pid(pid)) /* include/asm-generic/resource.h */ printf(" resource current maximum\n") printf("coredump(blocks) %s\n", getrlimit(4, pid)) printf("data(bytes) %s\n", getrlimit(2, pid)) printf("max nice %s\n", getrlimit(13, pid)) printf("file size(blocks) %s\n", getrlimit(1, pid)) printf("pending signals %s\n", getrlimit(11, pid)) printf("max locked memory(bytes) %s\n", getrlimit(8, pid)) printf("max memory size(bytes) %s\n", getrlimit(5, pid)) printf("open files %s\n", getrlimit(7, pid)) printf("POSIX message queues(bytes) %s\n", getrlimit(12, pid)) printf("max rt priority %s\n", getrlimit(14, pid)) printf("stack size(bytes) %s\n", getrlimit(3, pid)) printf("cpu time(seconds) %s\n", getrlimit(0, pid)) printf("max user processes %s\n", getrlimit(6, pid)) printf("virtual memory(bytes) %s\n", getrlimit(9, pid)) printf("file locks %s\n", getrlimit(10, pid)) exit() }