1. 16 May, 2024 3 commits
    • John Kacur's avatar
      rtla: Fix -t\--trace[=file] · 842fc5b8
      John Kacur authored
      The -t option has an optional argument.
      The usual case is for a short option to be specified without an '='
      and for the long version to be specified with an '='
      
      Various forms of this do not work as expected.
      For example:
      rtla timerlat hist -T50 -tfile.txt
      will result in a truncated file name of "ile.txt"
      
      Another example is that the long form without the '=' will result in the
      default file name instead of the requested file name.
      
      This patch properly parses the optional argument with and without '='
      and with and without spaces for the short form.
      
      This patch was also tested using -t and --trace without providing a file
      name both as the last requested option and with a following long and
      short option.
      
      For example:
      
        rtla timerlat hist -T50 -t -u
        rtla timerlat hist -T50 --trace -u
      
      This fix is applied to both timerlat top and hist
      and to osnoise top and hist.
      
      Here is the full testing for rtla timerlat hist.
      Before applying the patch
      
        rtla timerlat hist -T50 -t=file.txt
          Works as expected, "file.txt"
      
        rtla timerlat hist -T50 -tfile.txt
          Truncated file name "ile.txt"
      
        rtla timerlat hist -T50 -t file.txt
          Default file name instead of file.txt
      
        rtla timerlat hist -T50 --trace=file.txt
          Truncated file name "ile.txt"
      
        rtla timerlat hist -T50 --trace file.txt
          Default file name "timerlat_trace.txt" instead of "file.txt"
      
      After applying the patch:
      
        rtla timerlat hist -T50 -t=file.txt
          Works as expected, "file.txt"
      
        rtla timerlat hist -T50 -tfile.txt
          Works as expected, "file.txt"
      
        rtla timerlat hist -T50 -t file.txt
          Works as expected, "file.txt"
      
        rtla timerlat hist -T50 --trace=file.txt
          Works as expected, "file.txt"
      
        rtla timerlat hist -T50 --trace file.txt
          Works as expected, "file.txt"
      
      In addition the following tests were performed to make sure that
      the default file name worked as expected including with trailing
      options.
      
        rtla timerlat hist -T50 -t
          Works as expected "timerlat_trace.txt"
      
        rtla timerlat hist -T50 --trace
          Works as expected "timerlat_trace.txt"
      
        rtla timerlat hist -T50 -t -u
          Works as expected "timerlat_trace.txt"
      
        rtla timerlat hist -T50 --trace -u
          Works as expected "timerlat_trace.txt"
      
      Link: https://lkml.kernel.org/r/20240515183024.59985-1-jkacur@redhat.com
      
      Cc: Daniel Bristot de Oliveria <bristot@kernel.org>
      Signed-off-by: default avatarJohn Kacur <jkacur@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      842fc5b8
    • John Kacur's avatar
      rtla/timerlat: Fix histogram report when a cpu count is 0 · 01b05fc0
      John Kacur authored
      On short runs it is possible to get no samples on a cpu, like this:
      
        # rtla timerlat hist -u -T50
      
        Index   IRQ-001   Thr-001   Usr-001   IRQ-002   Thr-002   Usr-002
        2             1         0         0         0         0         0
        33            0         1         0         0         0         0
        36            0         0         1         0         0         0
        49            0         0         0         1         0         0
        52            0         0         0         0         1         0
        over:         0         0         0         0         0         0
        count:        1         1         1         1         1         0
        min:          2        33        36        49        52 18446744073709551615
        avg:          2        33        36        49        52         -
        max:          2        33        36        49        52         0
        rtla timerlat hit stop tracing
          IRQ handler delay:		(exit from idle)	    48.21 us (91.09 %)
          IRQ latency:						    49.11 us
          Timerlat IRQ duration:				     2.17 us (4.09 %)
          Blocking thread:					     1.01 us (1.90 %)
        	               swapper/2:0        		     1.01 us
        ------------------------------------------------------------------------
          Thread latency:					    52.93 us (100%)
      
        Max timerlat IRQ latency from idle: 49.11 us in cpu 2
      
      Note, the value 18446744073709551615 is the same as ~0.
      
      Fix this by reporting no results for the min, avg and max if the count
      is 0.
      
      Link: https://lkml.kernel.org/r/20240510190318.44295-1-jkacur@redhat.com
      
      Cc: stable@vger.kernel.org
      Fixes: 1eeb6328 ("rtla/timerlat: Add timerlat hist mode")
      Suggested-by: default avatarDaniel Bristot de Oliveria <bristot@kernel.org>
      Signed-off-by: default avatarJohn Kacur <jkacur@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      01b05fc0
    • Daniel Bristot de Oliveira's avatar
      rtla: Add --trace-buffer-size option · e9a4062e
      Daniel Bristot de Oliveira authored
      Add the option allow the users to set a different buffer size for the
      trace. For example, in large systems, the user might be interested on
      reducing the trace buffer to avoid large tracing files.
      
      The buffer size is specified in kB, and it is only affecting
      the tracing instance.
      
      The function trace_set_buffer_size() appears on libtracefs v1.6,
      so increase the minimum required version on Makefile.config.
      
      Link: https://lkml.kernel.org/r/e7c9ca5b3865f28e131a49ec3b984fadf2d056c6.1715860611.git.bristot@kernel.org
      
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      e9a4062e
  2. 15 May, 2024 7 commits
  3. 12 May, 2024 5 commits
  4. 11 May, 2024 10 commits
  5. 10 May, 2024 15 commits