Home | History | Annotate | Download | only in tests
      1 // When we cull and compute the new minimum time between snapshots, we want
      2 // to ignore any gap between two uncullable snapshots, because it is not
      3 // representative.  This program tests that.
      4 
      5 
      6 #include <stdlib.h>
      7 
      8 int main(void)
      9 {
     10    int i;
     11 
     12    // The peak is from the first allocation.
     13    int* x = malloc(1024);
     14    free(x);
     15 
     16    // Now do an allocation to provide the post-peak baseline.
     17    malloc(512);
     18 
     19    // Now we do lots of allocations below the peak.  With the proper
     20    // handling, the allocations should still be smoothly distributed.
     21    // Without it, the snapshots in the second half of the graph would be
     22    // clustered much more closely than those in the first half.
     23    //
     24 
     25    for (i = 0; i < 350; i++) {
     26       int* y = malloc(256);
     27       free(y);
     28    }
     29 
     30    return 0;
     31 }
     32