public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* page faults counter example is broken?!
@ 2013-09-20 16:20 Thomas Knauth
  2013-09-21 19:58 ` Paddie O'Brien
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Knauth @ 2013-09-20 16:20 UTC (permalink / raw)
  To: systemtap

Dear list,

the system tap examples include a page fault counter. However, I've
noticed that it's way off with the number of page faults it records. A
simple

# stap -c df pfaults.stp

records about 20 page faults (minor and major). A simple cross-check with

# \time df

shows that it should report ~270 page faults.

What am I missing?!

Thanks,
Thomas.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: page faults counter example is broken?!
  2013-09-20 16:20 page faults counter example is broken?! Thomas Knauth
@ 2013-09-21 19:58 ` Paddie O'Brien
  2013-09-25 15:33   ` Thomas Knauth
  0 siblings, 1 reply; 5+ messages in thread
From: Paddie O'Brien @ 2013-09-21 19:58 UTC (permalink / raw)
  To: Thomas Knauth; +Cc: systemtap

I think the way minor faults are recorded is the problem. The code below
is used to determine the type of fault (from memory.stp). Perhaps the
check should be:

#if defined(VM_FAULT_MINOR) && VM_FAULT_MINOR == 0

function vm_fault_contains:long (value:long, test:long)
%{
    int res;
    switch (STAP_ARG_test){
    case 0: res = STAP_ARG_value & VM_FAULT_OOM; break;
    case 1: res = STAP_ARG_value & VM_FAULT_SIGBUS; break;
#if defined(VM_FAULT_MINOR) && VM_FAULT_MINOR != 0
    case 2: /* VM_FAULT_MINOR infered by that flags off */
        res = !((VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_MAJOR) &
                 STAP_ARG_value);
        break;
#else
    case 2: res = STAP_ARG_value == VM_FAULT_MINOR; break;

On 20 September 2013 17:20, Thomas Knauth <thomas.knauth@googlemail.com> wrote:
> Dear list,
>
> the system tap examples include a page fault counter. However, I've
> noticed that it's way off with the number of page faults it records. A
> simple
>
> # stap -c df pfaults.stp
>
> records about 20 page faults (minor and major). A simple cross-check with
>
> # \time df
>
> shows that it should report ~270 page faults.
>
> What am I missing?!
>
> Thanks,
> Thomas.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: page faults counter example is broken?!
  2013-09-21 19:58 ` Paddie O'Brien
@ 2013-09-25 15:33   ` Thomas Knauth
  2013-09-25 15:47     ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Knauth @ 2013-09-25 15:33 UTC (permalink / raw)
  To: Paddie O'Brien; +Cc: systemtap

On Sat, Sep 21, 2013 at 9:58 PM, Paddie O'Brien <paddieobrien@gmail.com> wrote:
> I think the way minor faults are recorded is the problem. The code below
> is used to determine the type of fault (from memory.stp). Perhaps the
> check should be:
>
> #if defined(VM_FAULT_MINOR) && VM_FAULT_MINOR == 0
>
> function vm_fault_contains:long (value:long, test:long)
> %{
>     int res;
>     switch (STAP_ARG_test){
>     case 0: res = STAP_ARG_value & VM_FAULT_OOM; break;
>     case 1: res = STAP_ARG_value & VM_FAULT_SIGBUS; break;
> #if defined(VM_FAULT_MINOR) && VM_FAULT_MINOR != 0
>     case 2: /* VM_FAULT_MINOR infered by that flags off */
>         res = !((VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_MAJOR) &
>                  STAP_ARG_value);
>         break;
> #else
>     case 2: res = STAP_ARG_value == VM_FAULT_MINOR; break;

After changing the != into an == operator the number of reported
faults indeed matches with the counters maintained by the OS.

Did this catch the attention of some systemtap developer or shall I
file a separate bug report?

Thanks,
Thomas.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: page faults counter example is broken?!
  2013-09-25 15:33   ` Thomas Knauth
@ 2013-09-25 15:47     ` Frank Ch. Eigler
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2013-09-25 15:47 UTC (permalink / raw)
  To: Thomas Knauth; +Cc: Paddie O'Brien, systemtap

Thomas Knauth <thomas.knauth@gmx.de> writes:

> Did this catch the attention of some systemtap developer or shall I
> file a separate bug report?

Thanks a lot, committed the patch.

- FChE

^ permalink raw reply	[flat|nested] 5+ messages in thread

* page faults counter example is broken?!
@ 2013-09-20 16:19 Thomas Knauth
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Knauth @ 2013-09-20 16:19 UTC (permalink / raw)
  To: systemtap

Dear list,

the system tap examples include a page fault counter. However, I've
noticed that it's way off with the number of page faults it records. A
simple

# stap -c df pfaults.stp

records about 20 page faults (minor and major). A simple cross-check with

# \time df

shows that it should report ~270 page faults.

What am I missing?!

Thanks,
Thomas.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-25 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-20 16:20 page faults counter example is broken?! Thomas Knauth
2013-09-21 19:58 ` Paddie O'Brien
2013-09-25 15:33   ` Thomas Knauth
2013-09-25 15:47     ` Frank Ch. Eigler
  -- strict thread matches above, loose matches on Subject: below --
2013-09-20 16:19 Thomas Knauth

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).