public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: liang xie <xieliang007@gmail.com>
To: systemtap@sourceware.org
Subject: How to get the detailed kernel stack trace if specified fuction takes too long to finish?
Date: Fri, 28 Mar 2014 04:22:00 -0000	[thread overview]
Message-ID: <CADu=CFo=AtrBJLacPTa_6EfQA7vao=bSuT2Yns45x-hWYfmWZA@mail.gmail.com> (raw)

Hi all,

Probably it's a newbie question, to be honest, i am new to SystemTap,
currently i want to capture the kernel stack trace if "sys_write" runs
too long, if that i could know where it sucks.

My OS:2.6.32-220.el6.x86_64
# stap -V
Systemtap translator/driver (version 1.6/0.152 non-git sources)

My tried script:
global i=0
global tb=0
global te=0
probe kernel.function("sys_write") {
  tb=gettimeofday_us();
}
probe kernel.function("sys_write").return {
  te=gettimeofday_us();
  if(te-tb > 100000) {
   i++;
   printf("time_us: %d\n", te-tb);
   print_backtrace();
   if(i > 15) {
    exit();
   }
  }
}

# stap -x <pid> xxx.stp
time_us: 226795
Returning from:  0xffffffff81176f90 : sys_write+0x0/0x90 [kernel]
Returning to  :  0xffffffff8100b0f2 : system_call_fastpath+0x16/0x1b [kernel]
time_us: 101400
Returning from:  0xffffffff81176f90 : sys_write+0x0/0x90 [kernel]
Returning to  :  0xffffffff8100b0f2 : system_call_fastpath+0x16/0x1b [kernel]
time_us: 527853
Returning from:  0xffffffff81176f90 : sys_write+0x0/0x90 [kernel]
Returning to  :  0xffffffff8100b0f2 : system_call_fastpath+0x16/0x1b [kernel]
time_us: 133948
Returning from:  0xffffffff81176f90 : sys_write+0x0/0x90 [kernel]
Returning to  :  0xffffffff8100b0f2 : system_call_fastpath+0x16/0x1b [kernel]

It doesn't show my "expected" kernel stack trace,e.g. file system or
block layer related stack trace. How to archive that? Any pointers
will be highly appreciated!

Best,
Liang

             reply	other threads:[~2014-03-28  4:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28  4:22 liang xie [this message]
2014-03-28 16:56 ` Frank Ch. Eigler
2014-03-28 17:06 ` Josh Stone
2014-04-02 10:25   ` liang xie
2014-04-02 16:32     ` Josh Stone
2014-04-03  2:47       ` liang xie
2014-04-03 16:24         ` Josh Stone
2014-04-08  2:15           ` liang xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADu=CFo=AtrBJLacPTa_6EfQA7vao=bSuT2Yns45x-hWYfmWZA@mail.gmail.com' \
    --to=xieliang007@gmail.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).