]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a perf test to measure the speed (and memory) of PDB handling.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 17 Jan 2012 22:27:47 +0000 (22:27 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 17 Jan 2012 22:27:47 +0000 (22:27 +0000)
* modified perf/heap.c so that it optionally creates a partially defined bytes every N bytes
* created perf/heap_pdb4.vgperf calling heap 4 (so one byte on 4 is PDB in what heap allocates).

before/after pool alloc, here are the performances on a ppc64. So, it looks like
pool alloc also significantly improves the speed of PDB handling.

perl perf/vg_perf --vg=../pool_alloc --vg=../before_pool_trunk_untouched --reps=5 perf/heap_pdb4.vgperf
-- heap_pdb4 --
heap_pdb4 pool_alloc:0.41s  no: 3.0s ( 7.3x, -----)  me:11.9s (29.0x, -----)
heap_pdb4 before_pool_trunk_untouched:0.41s  no: 3.1s ( 7.6x, -3.7%)  me:16.9s (41.1x,-41.7%)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12342

perf/Makefile.am
perf/heap.c
perf/heap_pdb4.vgperf [new file with mode: 0644]

index ad5ceac6084f180b714d3a0a9c0e14228788f845..66b0ed05da3b483c8657d048b572c6847cb097ab 100644 (file)
@@ -10,6 +10,7 @@ EXTRA_DIST = \
        fbench.vgperf \
        ffbench.vgperf \
        heap.vgperf \
+       heap_pdb4.vgperf \
        many-loss-records.vgperf \
        many-xpts.vgperf \
        sarp.vgperf \
index c84f6cbfc3efceff77a19fefebcceeb2b030cd7b..8b38bec2227d518fb98e6e97cf79825281669829 100644 (file)
@@ -7,9 +7,16 @@
 
 char* arr[NLIVE];
 
-int main ( void )
+int main ( int argc, char* argv[] )
 {
    int i, j, nbytes = 0;
+   int pdb = 0;
+   int jpdb;
+
+   if (argc > 1) {
+      pdb = atoi(argv[1]);
+   }
+
    printf("initialising\n");
    for (i = 0; i < NLIVE; i++)
       arr[i] = NULL;
@@ -22,6 +29,12 @@ int main ( void )
       if (arr[j]) 
          free(arr[j]);
       arr[j] = malloc(nbytes);
+      if (pdb > 0) {
+         // create some partially defined bytes in arr[j]
+         for (jpdb=0; jpdb<nbytes; jpdb = jpdb+pdb) {
+            arr[j][jpdb] &= (jpdb & 0xff);
+         }
+      }
 
       // Cycle through the sizes 0,8,16,24,32.  Zero will get rounded up to
       // 8, so the 8B bucket will get twice as much traffic.
diff --git a/perf/heap_pdb4.vgperf b/perf/heap_pdb4.vgperf
new file mode 100644 (file)
index 0000000..30ed0f2
--- /dev/null
@@ -0,0 +1,2 @@
+prog: heap
+args: 4