• Home
  • Raw
  • Download

Lines Matching +full:monitor +full:- +full:script +full:- +full:pid

6 # usage: trace [-h] [-p PID] [-L TID] [-v] [-Z STRING_SIZE] [-S] [-c cgroup_path]
7 # [-M MAX_EVENTS] [-s SYMBOLFILES] [-T] [-t] [-K] [-U] [-a] [-I header]
8 # [-A]
39 tgid = -1
40 pid = -1 variable in Probe
41 uid = -1
58 cls.tgid = args.tgid or -1
59 cls.pid = args.pid or -1
60 cls.uid = args.uid or -1
66 raise ValueError("-M/--max-events should be specified"
67 " with -A/--aggregate")
83 self.probe_name = re.sub(r'[^A-Za-z0-9_]', '_',
114 # filter/print part, or not. Find the probe specifier first --
119 # --------- ---------- --
125 self.signature = sig[1:-1] if sig else None
141 balance -= 1
186 if "+" in parts[-1]:
187 parts[-1], self.offset = self._parse_offset(parts[-1])
203 self.library = ':'.join(parts[1:-1])
204 self.function = parts[-1]
213 target = Probe.pid if Probe.pid and Probe.pid != -1 \
215 self.usdt = USDT(path=self.library, pid=target)
289 "$pid": "(unsigned)(bpf_get_current_pid_tgid() & 0xffffffff)",
296 # Find the occurances of any arg[1-6]@user. Use it later to
298 for matches in re.finditer(r'(arg[1-6])(@user)', expr):
303 expr = re.sub(r'(arg[1-6])@user', r'\1', expr)
370 u32 pid;
392 self.usdt_name, arg_index - 1)
428 self.usdt_name, arg_index - 1)
442 if Probe.pid != -1:
445 """ % Probe.pid
446 # uprobes can have a built-in tgid filter passed to
447 # attach_uprobe, hence the check here -- for kprobes, we
449 elif len(self.library) == 0 and Probe.tgid != -1:
460 if Probe.uid != -1:
524 __data.pid = __pid;
542 offset = 1e-9 * (timestamp_ns - cls.first_ts)
567 stackstr += ('%s\n' % (symstr.decode('utf-8')))
585 values[sp] = values[sp].decode('utf-8', 'replace')
591 print("%s-->COUNT %d\n\n" % (k, v), end="")
607 eventstr += ("%-17s " % time[:17])
609 eventstr += ("%-8s " % time[:8])
611 eventstr += ("%-3s " % event.cpu)
612 eventstr += ("%-7d %-7d %-15s %-16s %s\n" %
613 (event.tgid, event.pid,
614 event.comm.decode('utf-8', 'replace'),
618 eventstr += self._stack_to_string(bpf, event.kernel_stack_id, -1)
673 pid=Probe.tgid)
678 pid=Probe.tgid,
696 trace 'do_sys_open "%s", arg2@user' -n main
698 trace 'do_sys_open "%s", arg2@user' --uid 1001
700 trace 'do_sys_open "%s", arg2@user' -f config
711 Trace the write() call from libc to monitor writes to STDOUT
715 Trace returns from malloc and print non-NULL allocated buffers
716 trace 't:block:block_rq_complete "sectors=%d", args->nr_sector'
719 Trace the USDT probe pthread_create when its 4th argument is non-zero
722 trace 'p::SyS_nanosleep(struct timespec *ts) "sleep for %lld ns", ts->tv_nsec'
724 trace -c /sys/fs/cgroup/system.slice/workload.service '__x64_sys_nanosleep' '__x64_sys_clone'
727 trace -I 'linux/fs.h' \\
728 'p::uprobe_register(struct inode *inode) "a_ops = %llx", inode->i_mapping->a_ops'
731 trace -I 'kernel/sched/sched.h' \\
732 'p::__account_cfs_rq_runtime(struct cfs_rq *cfs_rq) "%d", cfs_rq->runtime_remaining'
734 in kernel/sched/sched.h which is in kernel source tree and not in kernel-devel
737 trace -I 'net/sock.h' \\
738 'udpv6_sendmsg(struct sock *sk) (sk->sk_dport == 13568)'
741 trace -I 'linux/fs_struct.h' 'mntns_install "users = %d", $task->fs->users'
743 trace -s /lib/x86_64-linux-gnu/libc.so.6,/bin/ping 'p:c:inet_pton' -U
753 parser.add_argument("-b", "--buffer-pages", type=int,
757 # we'll refer to the userspace concepts of "pid" and "tid" by
758 # their kernel names -- tgid and pid -- inside the script
759 parser.add_argument("-p", "--pid", type=int, metavar="PID",
761 parser.add_argument("-L", "--tid", type=int, metavar="TID",
762 dest="pid", help="id of the thread to trace (optional)")
763 parser.add_argument("--uid", type=int, metavar="UID",
765 parser.add_argument("-v", "--verbose", action="store_true",
767 parser.add_argument("-Z", "--string-size", type=int,
769 parser.add_argument("-S", "--include-self",
771 help="do not filter trace's own pid from the trace")
772 parser.add_argument("-M", "--max-events", type=int,
774 parser.add_argument("-t", "--timestamp", action="store_true",
776 parser.add_argument("-u", "--unix-timestamp", action="store_true",
777 help="print UNIX timestamp instead of offset from trace start, requires -t")
778 parser.add_argument("-T", "--time", action="store_true",
780 parser.add_argument("-C", "--print_cpu", action="store_true",
782 parser.add_argument("-c", "--cgroup-path", type=str,
785 parser.add_argument("-n", "--name", type=str,
787 parser.add_argument("-f", "--msg-filter", type=str, dest="msg_filter",
789 parser.add_argument("-B", "--bin_cmp", action="store_true",
791 parser.add_argument('-s', "--sym_file_list", type=str,
795 parser.add_argument("-K", "--kernel-stack",
797 parser.add_argument("-U", "--user-stack",
799 parser.add_argument("-a", "--address", action="store_true",
803 parser.add_argument("-I", "--include", action="append",
809 parser.add_argument("-A", "--aggregate", action="store_true",
811 parser.add_argument("--ebpf", action="store_true",
814 if self.args.tgid and self.args.pid:
815 parser.error("only one of -p and -L may be specified")
889 col_fmt = "%-17s " if self.args.unix_timestamp else "%-8s "
892 print("%-3s " % "CPU", end="")
893 print("%-7s %-7s %-15s %-16s %s" %
894 ("PID", "TID", "COMM", "FUNC",
895 "-" if not all_probes_trivial else ""))