1. 25 Oct, 2016 2 commits
    • Sasha Goldshtein's avatar
      python: Grab all keys before zeroing · 6031ccbd
      Sasha Goldshtein authored
      To avoid a potential race with the key zeroing modifying
      the next hash key retrieved by the loop in `Table.zero()`,
      retrieve all the keys in user space first before starting
      the zeroing loop. See discussion on #780.
      
      Tested with `funccount 'SyS_*' -i 1` while running a heavy
      read/write test application (`dd`) in the background for
      several minutes with no visible issues.
      6031ccbd
    • Sasha Goldshtein's avatar
      funccount: Switch to BPF array instead of hash · dd7ec5a3
      Sasha Goldshtein authored
      Because we know the number of probes in advance before
      attaching them, we can simply preinitialize a fixed-size
      array instead of using a BPF map. This avoids potential
      deadlocks/hangs/race conditions with the Python program
      and internally in the kernel. See also #415, #665, #233
      for more discussion.
      dd7ec5a3
  2. 20 Oct, 2016 2 commits
    • Sasha Goldshtein's avatar
      funccount: Do not prepopulate location cache · 4e9289b1
      Sasha Goldshtein authored
      Avoiding the prepopulation of the location cache allows us
      to get rid of the `zero()` call at the end of each interval,
      which would hang the program at full CPU. Replaced the
      prepopulation with a `lookup_or_init` and the `zero()` call
      with a call to `clear()`.
      4e9289b1
    • Sasha Goldshtein's avatar
      python: Filter duplicate in get_kprobe_functions · 06fb0fa7
      Sasha Goldshtein authored
      `BPF.get_kprobe_functions` does not filter duplicates, and
      as a result may return the same function name more than
      once if it appears in /sys/kernel/debug/tracing/available_filter_functions
      more than once. Change the function's behavior to filter
      out duplicates before returning, so we don't end up
      attaching the same kprobe more than once.
      06fb0fa7
  3. 21 Oct, 2016 3 commits
  4. 20 Oct, 2016 10 commits
  5. 19 Oct, 2016 6 commits
    • Brendan Gregg's avatar
      Merge pull request #763 from goldshtn/enhanced-funccount · 56ddca09
      Brendan Gregg authored
      funccount: Generalized for uprobes, tracepoints, and USDT
      56ddca09
    • Sasha Goldshtein's avatar
      python: Fix kprobe quota test breakage, add uprobes · 367234ad
      Sasha Goldshtein authored
      As part of the funccount work, the kprobe quota test doesn't fail
      early when adding multiple kprobes at once (with `event_re`), but
      rather only when the 1000th probe is being added. Revert to the old
      behavior, which fixes the `test_probe_quota` test. Add similar test
      for uprobes, `test_uprobe_quota`, which tests the recently-added
      uprobe regex support.
      367234ad
    • Sasha Goldshtein's avatar
      funccount: Generalize for uprobes, tracepoints, and USDT · ff3b9f37
      Sasha Goldshtein authored
      This commit updates `funccount` to support attaching to a set of
      user functions, kernel tracepoints, or USDT probes using familiar
      syntax. Along the way, the implementation has been updated to use
      a separate BPF function for each target function, because using
      the instruction pointer to determine the function name doesn't
      work for anything other than kprobes. Even though the BPF program
      can now be potentially larger, testing with 40-50 attach points
      shows no significant overhead compared to the previous version.
      
      Examples of what's now possible:
      
      ```
      funccount t:block:*
      funccount u:node:gc*
      funccount -r 'c:(read|write)$'
      funccount -p 142 u:ruby:object__create
      ```
      ff3b9f37
    • Sasha Goldshtein's avatar
      bcc: Make regex helpers publicly accessible · e84febdf
      Sasha Goldshtein authored
      Make the `get_user_functions`, `get_kprobe_functions`, and
      `get_tracepoints` methods publicly accessible from the BPF class.
      These can then be used by tools that need to do their own work
      before attaching programs to a set of functions or tracepoints.
      e84febdf
    • Sasha Goldshtein's avatar
      b778ccd9
    • Brendan Gregg's avatar
      ac297c1e
  6. 18 Oct, 2016 9 commits
    • Brendan Gregg's avatar
      add output notes to doc (#765) · 5845ef9c
      Brendan Gregg authored
      5845ef9c
    • Sasha Goldshtein's avatar
      Tools lint cleanup (#764) · f41ae861
      Sasha Goldshtein authored
      * argdist: linter cleanup
      
      * cpudist: linter cleanup
      
      * execsnoop: linter cleanup
      
      * funclatency: linter cleanup
      
      * gethostlatency: linter cleanup
      
      * hardirqs: linter cleanup
      
      * memleak: linter cleanup
      
      * mountsnoop: linter cleanup
      
      * offcputime: linter cleanup
      
      * softirqs: linter cleanup
      
      * solisten: linter cleanup and u+x mode
      
      * stacksnoop: linter cleanup
      
      * tplist: linter cleanup
      
      * trace: linter cleanup
      f41ae861
    • Brenden Blanco's avatar
      Merge pull request #752 from goldshtn/mysqld-slower-fix · 78a3341c
      Brenden Blanco authored
      mysqld_slower: Fix breakage after USDT API change
      78a3341c
    • Brendan Gregg's avatar
      add slabratetop (#759) · 203b4c91
      Brendan Gregg authored
      203b4c91
    • Sasha Goldshtein's avatar
      trace, argdist: -I switch for trace and miscellaneous fixes (#761) · 4725a726
      Sasha Goldshtein authored
      * trace: Additional include files support
      
      Similarly to `argdist`, `trace` now has a `-I` option for adding
      include files that can be used in filter and print expressions.
      This also required a slight modification to `argdist`'s syntax
      for consistency: where previously we would allow `-I header1 header2`,
      we now require `-I header1 -I header2` to avoid any mixups with
      which argument is a header file and which is a probe for `trace`.
      
      This is very unlikely to break anyone, because I haven't seen the
      `-I` option used at all, not to mention extensively with multiple
      headers.
      
      Also made sure the man and example pages are up to date.
      
      * argdist: Update -C and -H switches for consistency
      
      This commit updates `argdist`'s `-H` and `-C` switches for consistency
      with the `-I` switch and `trace`'s switches. Specifically, each probe
      needs an explicit `-C` or `-H` specifier in front of it. This also
      allows safe and understandable mixing of histogram and counting probes,
      for example:
      
      ```
      argdist -C 'p:c:write()' -H 'p::vfs__write(int fd, const void *buf, size_t size):size_t:size#write sizes'
      ```
      
      * trace: Fix stack trace support for tracepoints
      
      Tracepoint probes don't have a `ctx` argument, it's called `args`
      instead. The recently-added stack trace support code didn't take
      this into account, and consequently didn't work for tracepoints.
      This commit fixes the issue, so we can now do things like
      `trace -K t:block:block_rq_complete`.
      4725a726
    • Brenden Blanco's avatar
      Merge pull request #701 from dkronst/master · 2035edb3
      Brenden Blanco authored
      Making selection of kernel headers type automatic
      2035edb3
    • Sasha Goldshtein's avatar
      cc: Support glob+offset format in USDT arguments (#753) · 163a73fa
      Sasha Goldshtein authored
      Modern versions of USDT probes (such as what's found in
      PostgreSQL when compiled with `--enable-dtrace`) may have
      the offset listed after the global symbol for USDT
      arguments of the format `4@symbol+8(%rip)`. This commit
      extends the argument parser to support these cases, adds
      tests for these cases, and makes sure that in case of a
      parse error, the parser always moves forward and consumes
      at least one character. Presently, the parser would get
      stuck on the problematic position and enter an infinite
      loop.
      163a73fa
    • Brenden Blanco's avatar
      Merge pull request #754 from iovisor/dkalani_dev · 6ac44b5a
      Brenden Blanco authored
      Add vxlan gbp header
      6ac44b5a
    • Dina Goldshtein's avatar
      Support filtering by process ID in the filesystem slower tools (#756) · c8b9ae3a
      Dina Goldshtein authored
      * Filter by process ID in ex4slower
      
      * Updated the rest of the tools to filter by process ID
      c8b9ae3a
  7. 17 Oct, 2016 4 commits
    • Sasha Goldshtein's avatar
      argdist: STRCMP helper function · c8f752f7
      Sasha Goldshtein authored
      argdist filter expressions can now use the STRCMP helper
      function to compare strings. The first string must be a
      compile-time constant literal string, and the second string
      can be determined at runtime. This is a workaround until
      BPF introduces a kernel builtin for strcmp.
      
      Example:
      
      ```
      argdist -H 'r:c:open(char *file):u64:$latency:STRCMP("test.txt",file)'
      ```
      c8f752f7
    • Sasha Goldshtein's avatar
      trace: STRCMP helper function · f4797b0c
      Sasha Goldshtein authored
      `trace` filters and print expressions can now use the
      magic STRCMP helper function to compare strings. The first
      string must be a compile-time constant literal string,
      such as "test", and the second string can be determined at
      runtime (e.g., from a function argument). The codegen for
      STRCMP is on a case-by-case basis for each literal string,
      and it generates an inline function with a constant-length
      loop that compares the string's characters. This is a
      decent workaround until we get something more reasonable
      from the kernel side, such as a `bpf_strcmp` helper.
      
      Usage example:
      
      ```
      trace 'p:c:open (STRCMP("test.txt", arg1)) "%s", arg1'
      ``
      f4797b0c
    • Sasha Goldshtein's avatar
      Update examples and docs to use the new USDT API · a2370ab5
      Sasha Goldshtein authored
      The BPF class constructor now accepts an array of USDT
      contexts instead of just one object. Update the examples
      in **examples/tracing** and docs in **docs** to reflect
      this change.
      a2370ab5
    • Sasha Goldshtein's avatar
      mysqld_slower: Fix breakage after USDT API change · 54c1d6f1
      Sasha Goldshtein authored
      A recent PR to the USDT infrastructure changed the BPF
      module constructor to accept an array of USDT contexts.
      This commit updates `mysqld_slower` to use that new
      constructor.
      54c1d6f1
  8. 16 Oct, 2016 2 commits
  9. 15 Oct, 2016 1 commit
  10. 11 Oct, 2016 1 commit
    • Sasha Goldshtein's avatar
      trace: Add %K and %U format specifiers (#742) · accd4cf5
      Sasha Goldshtein authored
      The %K and %U format specifiers can be used in a trace
      format string to resolve kernel and user symbols,
      respectively. For example, the pthread_create USDT probe
      has an argument pointing to the new thread's function.
      To trace pthread_create and print the symbolic name of
      the new thread's function, use:
      
      ```
      trace 'u:pthread:pthread_create "%U", arg3'
      ```
      
      The %U specifier resolves addresses in the event's process,
      while the %K specifier resolves kernel addresses.
      accd4cf5