Skip to content
Snippets Groups Projects
  1. May 16, 2014
  2. May 15, 2014
  3. May 14, 2014
    • Tomasz Grabiec's avatar
      trace: introduce sampling profiler · b3fa77d3
      Tomasz Grabiec authored
      
      This introduces a simple timer-based sampling profiler which is
      reusing our tracing infrastructure to collect samples.
      
      To enable sampler from run.py run it like this:
      
       $ scripts/run.py ... --sampler [frequency]
      
      Where 'frequency' is an optional parameter for overriding sampling
      frequency. The default is 1000 (ticks per second). The bigger the
      frequency the bigger sampling overhead is. Too low values will hurt
      profile accuracy.
      
      Ad-hoc sampler enabling is planned. The code already takes that into
      account.
      
      To see the profile you need to extract the trace:
      
       $ trace extract
      
      And then show it like this:
      
       $ trace prof
      
      All 'prof' options can be applied, for example you can group by CPU:
      
       $ trace prof -g cpu
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      b3fa77d3
    • Tomasz Grabiec's avatar
      trace: strip leading unimportant frames from backtrace · f59a8a12
      Tomasz Grabiec authored
      
      First couple of frames always come from trace logging functions. I
      think we should not show them because they do not add any information.
      
      There was already a list of function names which should be filtered
      out. This is not appropriate in this case because tracing goes through
      a function named 'log' which is a pretty generic name and could as
      well be an application symbol, so we cannot just filter out all
      functions named 'log. This patch adds support for knocking off a
      leading sequence of frames form the backtrace which is more accurate
      and seems good enough.
      
      Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      f59a8a12
  4. May 12, 2014
  5. May 09, 2014
    • Tomasz Grabiec's avatar
      trace: fix default backtrace formatter construction · 7166013b
      Tomasz Grabiec authored
      
      That formatter is used for ad-hoc printing of samples, eg.
      in error messages.
      
      This fixes the following error message:
      
      Traceback (most recent call last):
        File "scripts/trace.py", line 576, in <module>
          args.func(args)
        File "scripts/trace.py", line 244, in prof_lock
          show_profile(args, get_profile)
        File "scripts/trace.py", line 208, in show_profile
          max_levels=args.max_levels)
        File "/home/tgrabiec/src/osv/scripts/osv/prof.py", line 170, in print_profile
          for sample in samples:
        File "/home/tgrabiec/src/osv/scripts/osv/prof.py", line 108, in get_duration_profile
          raise Exception('Double entry:\n%s\n%s\n' % (str(old), str(trace)))
        File "/home/tgrabiec/src/osv/scripts/osv/trace.py", line 125, in __str__
          return self.format()
        File "/home/tgrabiec/src/osv/scripts/osv/trace.py", line 122, in format
          bt_formatter(self.backtrace))
        File "/home/tgrabiec/src/osv/scripts/osv/trace.py", line 32, in __call__
          frames = list(debug.resolve_all(self.resolver, (x - 1 for x in backtrace if x)))
        File "/home/tgrabiec/src/osv/scripts/osv/debug.py", line 107, in resolve_all
          return itertools.chain.from_iterable(map(resolver, raw_addresses))
      TypeError: __init__() takes exactly 1 argument (2 given)
      
      When this should actually be printed:
      
      Traceback (most recent call last):
        File "scripts/trace.py", line 576, in <module>
          args.func(args)
        File "scripts/trace.py", line 244, in prof_lock
          show_profile(args, get_profile)
        File "scripts/trace.py", line 208, in show_profile
          max_levels=args.max_levels)
        File "/data/tgrabiec/osv/scripts/osv/prof.py", line 170, in print_profile
          for sample in samples:
        File "/data/tgrabiec/osv/scripts/osv/prof.py", line 108, in get_duration_profile
          raise Exception('Double entry:\n%s\n%s\n' % (str(old), str(trace)))
      Exception: Double entry:
      0xffffc00017668010                  3 1399542568.505835772 mutex_lock_wait (...)
      0xffffc00017668010                  1 1399542574.668642044 mutex_lock_wait (...)
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      7166013b
  6. May 07, 2014
  7. May 06, 2014
    • Tomasz Grabiec's avatar
      trace: suppress displaying of _M_invoke in the backtrace · 3ca12419
      Tomasz Grabiec authored
      
      It's just cluttering the backtrace.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      3ca12419
    • Tomasz Grabiec's avatar
      trace: include inlined-by functions in the backtrace · fff28fad
      Tomasz Grabiec authored
      
      Fixes #255.
      
      The default OSv build has plenty of inlined functions. The tracing
      tool is using 'addr2line -Cfp' to resolve symbols. That mode of
      operation of addr2line yields one line per symbol and that line will
      only show the inlined function, even though the information about
      "logical" callers is also available.
      
      Example:
      
        $ addr2line -Cfp -e build/release/loader.elf
        0x32963d
        lock_guard at (...)
      
      There is the '-i' switch we could use to also see code locations into
      which this function was inlined:
      
        $ addr2line -Cfpi -e build/release/loader.elf
        0x32963d
        lock_guard at (...)
         (inlined by) lock_guard_for_with_lock at (...)
         (inlined by) mmu::vm_fault(unsigned long, exception_frame*) at (...)
      
      In this case, 'mmu::vm_fault' is much more interesting than
      lock_guard and thus we would like to show it in the backtrace. This change
      allows symbol resolvers to return multiple source addresses per raw
      address and changes the default implementation to return inlined-by
      functions by default.
      
      The new behavior can be suppressed with --no-inlined-by.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      fff28fad
  8. May 05, 2014
  9. May 04, 2014
  10. Apr 29, 2014
  11. Apr 28, 2014
  12. Apr 25, 2014
  13. Apr 23, 2014
  14. Apr 22, 2014
Loading