Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: a-tsuji@bk.jp.nec.com (Atsushi Tsuji)
Subject: [ltt-dev] [PATCH] Add tracepoints to track pagecache transition
Date: Mon, 09 Feb 2009 11:54:38 +0900	[thread overview]
Message-ID: <498F9AEE.2080209@bk.jp.nec.com> (raw)
In-Reply-To: <y0m1vudogi4.fsf@ton.toronto.redhat.com>

Frank Ch. Eigler wrote:
> Atsushi Tsuji <a-tsuji at bk.jp.nec.com> writes:
> 
>> I thought it would be useful to trace pagecache behavior for problem
>> analysis (performance bottlenecks, behavior differences between stable
>> time and trouble time).
> 
> Interesting!  I hope it inspires more thinking about more places and
> ways for graphical data visualization to apply.
> 
>> By using those tracepoints, we can describe and visualize pagecache
>> transition (file-by-file basis) in kernel and pagecache consumes
>> most of the memory in running system and pagecache hit rate and
>> writeback behavior will influence system load and performance.
> 
> To what extent does your script work if it uses kprobes-based
> kernel.function() probes?  (It can use "!" type probe point
> decorations to automatically adapt to the preferred presence of the
> tracepoints/markers.)

Hi Frank,

Thank you for your response.
Yes, my script works using probe points in tapset (kprobes-based probes).
I attached this script below.

Thanks,
-Atsushi

----
Usage:
  ./pagecache_stat.stp

Output:
  This script outputs pagecache size(file-by-file basis) every 5 seconds like below.
 
  timestamp dev:inode pagecache size (KB), dev:inode pagecache size (KB),...

  (example)
  Thu Feb  5 05:21:29 2009 800003:4482806 112348
  Thu Feb  5 05:21:34 2009 800003:4482806 211968, 800003:4482817 96708,
  Thu Feb  5 05:21:39 2009 800003:4482806 294488, 800003:4482817 178604,
  Thu Feb  5 05:21:44 2009 800003:4482806 400560, 800003:4482817 288832,
                                .
                                .
                                .

#!/usr/bin/env stap

global cache

probe timer.ms(5000)
{
	printf("%s ",ctime(gettimeofday_s()));
	foreach([dev, ino] in cache){
		printf("%x:%d %d, ",dev ,ino , cache[dev, ino] * 4); /* page size is 4KB */
	}
	printf("\n");
}

probe vfs.add_to_page_cache.return
{
	/* $return == 0 if the page is really added to pagecache */
	if($return == 0){
		ino = $mapping->host->i_ino;
		dev = $mapping->host->i_sb->s_dev;
		cache[dev, ino]++;
	}
}

probe vfs.remove_from_page_cache
{
	cache[dev, ino]--;
}





  reply	other threads:[~2009-02-09  2:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-03  6:08 Atsushi Tsuji
2009-02-03 14:07 ` Mathieu Desnoyers
2009-02-03 14:16   ` Mathieu Desnoyers
2009-02-04  1:07     ` Atsushi Tsuji
2009-02-04  5:56       ` Mathieu Desnoyers
2009-02-05  0:48 ` Frank Ch. Eigler
2009-02-09  2:54   ` Atsushi Tsuji [this message]
2009-02-11  7:18 ` Mathieu Desnoyers

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=498F9AEE.2080209@bk.jp.nec.com \
    --to=a-tsuji@bk.jp.nec.com \
    /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