1. 18 Jul, 2016 1 commit
  2. 17 Jul, 2016 2 commits
    • Mark Drayton's avatar
      Move open_{kprobes,uprobes,tracepoints} into BPF object · cb679d7b
      Mark Drayton authored
      * for #605, this diff moves probe storage from the BPF module to the BPF object,
        letting each instantiation clean up its own probes. A module-level counter
        for all open probes is provided for the quota check. It also adds a
        `cleanup()` function to force cleanup before the `atexit` handler runs.
      
      * for #614, it removes the `len(open_kprobes) == 0` check that prevented more
        than one autoload probe working. It fixes the tests that this change breaks by
        calling the `cleanup()` function added.
      cb679d7b
    • Mark Drayton's avatar
      Store kprobes with string keys, fix num_open_kprobes · 8fa8c0e8
      Mark Drayton authored
      Prior to this diff we used inconsistent types for keys in `open_kprobes`. The
      results from the regex match (`attach_kprobe(event_re=..)`) and the automatic
      `kprobe__` features were passed through `str.decode()`, yielding unicode keys,
      but specific matches (i.e. from `attach_kprobe(event=..)`) were stored with
      string keys passed down from the caller. Only probes under string keys were
      released in `cleanup_kprobes`, leaving attached probes on program exit.
      
      This diff makes all the keys regular strings. I erred on the side of using
      regular strings over `str.decode()`ing them because a) this data isn't passed
      outside of Python, b) it's more Python 3 compatible (there is no `.decode()` on
      a regular string object in Python 3 so such a change would ultimately need
      removing again).
      
      I also cleaned up a few other things:
      
      * removed the call to `awk` for getting probable functions
      
      * removed the `isinstance` checks when cleaning uprobes/tracepoints -- we
        should only have string keys in these dicts
      
      * made `num_open_kprobes` skip the perf_events buffers. People likely use this
        to check that the right number of probes have been placed so counting
        perf_events buffers doesn't make sense here
      8fa8c0e8
  3. 14 Jul, 2016 2 commits
  4. 13 Jul, 2016 5 commits
  5. 12 Jul, 2016 2 commits
  6. 11 Jul, 2016 3 commits
  7. 09 Jul, 2016 3 commits
    • Sasha Goldshtein's avatar
      tests: Test new tracepoint support · d9c243e6
      Sasha Goldshtein authored
      d9c243e6
    • Sasha Goldshtein's avatar
      cc: Rewrite probe functions that refer to tracepoint structures · fab68e3a
      Sasha Goldshtein authored
      When a probe function refers to a tracepoint arguments structure,
      such as `struct tracepoint__irq__irq_handler_entry`, add that structure
      on-the-fly using a Clang frontend action that runs before any other
      steps take place.
      
      Typically, the user will create tracepoint probe functions using
      the TRACEPOINT_PROBE macro, which avoids the need for specifying
      the tracepoint category and event twice in the signature of the
      probe function.
      fab68e3a
    • Sasha Goldshtein's avatar
      bcc: Auto-tracepoints similar to auto-kprobes · 619fc140
      Sasha Goldshtein authored
      When a function in the BPF program starts with "tracepoint__", parse
      the rest of the name as a tracepoint category and name and attach the
      tracepoint automatically. For example:
      
      ```
      int tracepoint__sched__sched_switch(...)
      ```
      
      As a result, the sched:sched_switch tracepoint is enabled and the function
      is attached to that tracepoint.
      619fc140
  8. 08 Jul, 2016 3 commits
  9. 02 Jul, 2016 1 commit
  10. 01 Jul, 2016 2 commits
  11. 30 Jun, 2016 10 commits
    • Brenden Blanco's avatar
      Merge pull request #586 from goldshtn/offcpudist · 97712b05
      Brenden Blanco authored
      cpudist: Support off-cpu time reports
      97712b05
    • Brenden Blanco's avatar
      Merge pull request #590 from goldshtn/bcc-tp-support · d1b62087
      Brenden Blanco authored
      bcc: Tracepoint support in libbpf and BPF
      d1b62087
    • Sasha Goldshtein's avatar
      bcc: Add test for tracepoint support · 79809330
      Sasha Goldshtein authored
      The test asserts that we can enable the sched_switch tracepoint and read
      some events from it. The test is also marked to require kernel 4.7 or
      later, because that's where the BPF support for tracepoints was introduced.
      79809330
    • Sasha Goldshtein's avatar
      cpudist: Protect against potentially negative time deltas · bee8d360
      Sasha Goldshtein authored
      It seems from experimentation that the calculated timestamps between
      on- and off-CPU switch events can produce incorrect results, with a
      later event having a smaller timestamp. Discard events when the
      resulting delta time would be negative.
      bee8d360
    • Sasha Goldshtein's avatar
      cpudist: Use `finish_task_switch` kprobe instead of `sched_switch` tracepoint · 06d90d3d
      Sasha Goldshtein authored
      The `sched_switch` tracepoint approach requires storing the previous
      task's tgid in a map and fetching it from there, because it is not
      available as a tracepoint argument. Instead, placing a kprobe on the
      `finish_task_switch` function allows cleanly fetching the previous
      task's pid and tgid from the task_struct.
      06d90d3d
    • Sasha Goldshtein's avatar
      cpudist: Fix extraneous filtering of descheduled tasks · 3c976bbd
      Sasha Goldshtein authored
      When the `-O` switch was provided, cpudist was unnecessarily filtering
      out scheduling events arising from a task waking up when the previous
      task was not running. On an idle system, this happens a lot, and causes
      events to be missed. This is now fixed.
      3c976bbd
    • Sasha Goldshtein's avatar
      cpudist: Attempt to resolve pid to command · 4b72f052
      Sasha Goldshtein authored
      Use `/proc/$PID/comm`, which may fail, for example if the original
      process already exited. This may also produce misleading results
      if another process got the same pid, but there's no way around this.
      4b72f052
    • Sasha Goldshtein's avatar
      cpudist: Support off-cpu time reports · 9972f27b
      Sasha Goldshtein authored
      Add -O switch, which directs cpudist to collect off-CPU time
      statistics. Also restructure the code slightly and added examples
      as appropriate.
      9972f27b
    • Sasha Goldshtein's avatar
      bcc: Tracepoint support in libbpf and BPF · 1198c3c6
      Sasha Goldshtein authored
      Introduce tracepoint support in libbpf via new `bpf_attach_tracepoint`
      API, which takes the tracepoint category and name (e.g. "sched",
      "sched_switch"). Attach the tracing program to the tracepoint's id
      and proceed as usual.
      
      Add `attach_tracepoint` API to Python BPF module, which takes the
      tracepoint description as a single string (e.g. "sched:sched_switch").
      Load the BPF program with bpf_prog_type set to TRACEPOINT and then
      call `bpf_attach_tracepoint` to attach it.
      1198c3c6
    • Sasha Goldshtein's avatar
      trace: Specifying a pid with a kernel probe now works (#589) · de34c25b
      Sasha Goldshtein authored
      Due to an incorrectly referenced global variable, specifying a pid
      to filter with a kernel probe produced an error. This is now fixed,
      for example:
      
      ```
      TIME     PID    COMM         FUNC
      23:46:00 29967  bash         sched_switch
      23:46:01 29967  bash         sched_switch
      23:46:01 29967  bash         sched_switch
      ^C
      ```
      de34c25b
  12. 29 Jun, 2016 1 commit
    • Sasha Goldshtein's avatar
      cpudist: Summarize task on-CPU time as histograms (#585) · 40975ab3
      Sasha Goldshtein authored
      * cpudist: summarize on-CPU time per task as a histogram
      
      This is the initial implementation of the tool itself, which uses
      the sched:sched_switch tracepoint to probe task switches. This is
      a slightly more robust approach than using a kernel function, such
      as finish_task_switch.
      
      When native BCC support for tracepoints is introduced, this tool
      can be reimplemented and reliance on the current Tracepoint module
      can be removed.
      
      * cpudist: add man page and examples
      40975ab3
  13. 27 Jun, 2016 4 commits
  14. 26 Jun, 2016 1 commit
    • Mark Drayton's avatar
      IPv6 support for tcp* tools (#582) · 11de2985
      Mark Drayton authored
      * tcpretrans: support full IPv6 addresses, fix --lossprobe
      
      * tcpaccept: support full IPv6 addresses, fix timestamps
      
      * tcpconnect: support full IPv6 addresses, fix timestamps
      
      * tcpconnlat: support full IPv6 addresses, fix timestamps
      11de2985