What (OS X) dtrace sensor is triggered when a page crashes from disk?

I am writing a document about a page crash and trying to get some specific numbers to work, so I wrote a simple program that reads 12 * 1024 * 1024 bytes of data. Easy:

int main()
{
  FILE*in = fopen("data.bin", "rb");
  int i;
  int total=0;
  for(i=0; i<1024*1024*12; i++)
    total += fgetc(in);
  printf("%d\n", total);
}

So yes, it goes through and reads the whole file. The problem is that I need a dtrace sensor that will fire 1536 times during this process (12M / 8k). Even if I count all fbt: mach_kernel: vm_fault *: probes and all vminfo: probes, I cannot find 500, so I know that I cannot find the correct probes.

Does anyone know where I can find dtrace sensors that trigger when a page crashes from disk?

UPDATE:

In the event that the problem was that some smart prefetch occurred in the stdio functions, I tried the following:

int main()
{
  int in = open("data.bin", O_RDONLY | O_NONBLOCK);
  int i;
  int total=0;
  char buf[128];
  for(i=0; i<1024*1024*12; i++)
  {
    read(in, buf, 1);
    total += buf[0];
  }
  printf("%d\n", total);
}

(42- , 10 , , ), , .

- (char int.) , , 0,0 .

+3
3

, , , . . , - -/VM , . , , , .

, mmap(2) , .

+1

, . DTrace , :

1.) OS X Internals Amit Singh 8.3 ( DTrace-).

2.) Solaris / . DTrace, vminfo.

3.) OS X , ( ). , Solaris. , .

+1

, , ( , N , , DTrace- N ; UN * Xes - , , . , mmap() .

, .

, , mmap , madvise (MADV_DONTNEED) / msync (MS_INVALIDATE).

0
source

Source: https://habr.com/ru/post/1756838/


All Articles