Callgrind

The test harness script generates a control file that can be used directly by running this command:

Executing /nz/kit/bin/adm/udxharness -f APPLYOP_CPP_func.harness -k /nz/kit

The command can be run under callgrind, a tool to profile code, as follows:

[nz@bdrosendev src]$ /usr/local/bin/valgrind --tool=callgrind \
--trace-children=yes -v /nz/kit/bin/adm/udxharness -f APPLYOP_CPP_func.harness -k
/nz/kit
==31290== Callgrind, a call-graph generating cache profiler.
==31290== Copyright (C) 2002-2008, and GNU GPL'd, by Josef Weidendorfer et al.
==31290== Using LibVEX rev 1884, a library for dynamic binary translation.
==31290== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==31290== Using valgrind-3.4.1, a dynamic binary instrumentation framework.
==31290== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==31290== 
--31290-- Command line
--31290--    /nz/kit/bin/adm/udxharness
--31290--    -f
--31290--    APPLYOP_CPP_func.harness
--31290--    -k
--31290--    /nz/kit
--31290-- Startup, with flags:
--31290--    --tool=callgrind
--31290--    --trace-children=yes
--31290--    -v
--31290-- Contents of /proc/version:
--31290--   Linux version 2.6.18-128.el5 \
     (mockbuild@hs20-bc1-7.build.redhat.com) (gcc version 4.1.2 20080704 \
     (Red Hat 4.1.2-44)) #1 SMP Wed Dec 17 11:41:38 EST 2008
--31290-- Arch and hwcaps: X86, x86-sse1-sse2
--31290-- Page sizes: currently 4096, max supported 4096
--31290-- Valgrind library directory: /usr/local/lib/valgrind
==31290== For interactive control, run 'callgrind_control -h'.
--31290-- Reading syms from /lib/ld-2.5.so (0x7dc000)
--31290-- Reading syms from /nz/kit/bin/adm/udxharness (0x8048000)
--31290-- Reading syms from /usr/local/lib/valgrind/x86-linux/callgrind \
      (0x38000000)
--31290-- object doesn't have a dynamic symbol table
--31290-- Found runtime_resolve (x86-def): ld-2.5.so +0x12cd0=0x7ef4c0, \
     length 24
--31290-- Reading syms from \
     /usr/local/lib/valgrind/x86-linux/vgpreload_core.so (0x46a0000)
--31290-- Reading syms from /lib/libdl-2.5.so (0x982000)
--31290-- Reading syms from /lib/libpthread-2.5.so (0x969000)
--31290-- Reading syms from /lib/libm-2.5.so (0x940000)
--31290-- Reading syms from /lib/libc-2.5.so (0x7fa000)
--31290-- Symbol match: found runtime_resolve: ld-2.5.so +0x7ef4c0=0x7ef4c0
starting execution
--31290-- Reading syms from
/nz/data/base/200103/library/200649/host/libnzaeparent.so (0x46c7000)
--31290-- Reading syms from /usr/lib/libstdc++.so.6.0.8 (0x9c6000)
--31290--    object doesn't have a symbol table
--31290-- Reading syms from /lib/libgcc_s-4.1.2-20080825.so.1 (0x988000)
--31290--    object doesn't have a symbol table
--31290-- Reading syms from
/nz/data/base/200103/library/200650/host/libnzaeadapters.so (0x4718000)
--31290-- Reading syms from
/nz/data/base/200103/library/200652/host/libnzaechild.so (0x4763000)
--31290-- Reading syms from /nz/data/base/200103/udf/217194.oh (0x46b3000)
 DOUBLE: 3.000000
Elapsed time: 0m0.610s

External references
vtable for __cxxabiv1::__class_type_info
vtable for __cxxabiv1::__si_class_type_info
operator delete[](void*)
operator delete(void*)
operator new(unsigned int)
__cxa_begin_catch
__cxa_end_catch
__cxa_pure_virtual
__gxx_personality_v0
free
nzaeisoAdapUdfClose
nzaeisoAdapUdfCreate
nzaeisoAdapUdfGetReturn
nzaeisoAdapUdfGetSizerResult
nzaeisoAdapUdfSetController
nzaeisoAdapUdfSwitchToSizerMode
nzaeisoCtrlUdfClose
nzaeisoCtrlUdfCreate
nzaeisoCtrlUdfGetResult
nzaeisoCtrlUdfNewInput
nzaeisoCtrlUdfNoMoreInput
nzaeisoCtrlUdfSetAdapter
sprintf
strcmp
strdup
throwError

Our UDX object used 0 bytes (may be rounded up to nearest page 4096)
Our UDX return value takes up 8 bytes, with 669 bytes for miscellaneous
Our UDX arguments take up 30 bytes, with 34 bytes for miscellaneous
Our UDX state values take up 0 bytes, with 8 bytes for miscellaneous
State information may be doubled, since we need two states for merge
--31290-- Discarding syms at 0x476bfb0-0x4789b64 in \
     /nz/data/base/200103/library/200652/host/libnza¬echild.so due to munmap()
--31290-- Discarding syms at 0x46b4b90-0x46b5c54 in \
     /nz/data/base/200103/udf/217194.oh due to munmap()
--31290-- Discarding syms at 0x4734250-0x4755d44 in \
     /nz/data/base/200103/library/200650/host/libnza¬eadapters.so due to \
     munmap()
--31290-- Discarding syms at 0x46d63f0-0x470c5d4 in \
     /nz/data/base/200103/library/200649/host/libnza¬eparent.so due to \
     munmap()
--31290-- Discarding syms at 0xa05c50-0xa810c4 in /usr/lib/libstdc++.so.6.0.8 \
     due to munmap()
--31290-- Discarding syms at 0x989660-0x990e94 in \
     /lib/libgcc_s-4.1.2-20080825.so.1 due to munmap()
==31290== 
--31290-- Start dumping at BB 1776785 (Prg.Term.)...
--31290-- Dump to /nz/src/callgrind.out.31290
--31290-- Dumping done.
--31290-- 
--31290-- Distinct objects:   14
--31290-- Distinct files:    147
--31290-- Distinct fns:     1987
--31290-- Distinct contexts:1987
--31290-- Distinct BBs:     9286
--31290-- Cost entries:     6488 (Chunks 1)
--31290-- Distinct BBCCs:   9697
--31290-- Distinct JCCs:    3140
--31290-- Distinct skips:   1051
--31290-- BB lookups:       9286
--31290-- With full      debug info: 47% (4388)
--31290-- With file/line debug info: 0% (0)
--31290-- With fn name   debug info: 43% (4030)
--31290-- With no        debug info: 9% (868)
--31290-- BBCC Clones:       411
--31290-- BBs Retranslated:  0
--31290-- Distinct instrs:   46884
--31290-- 
--31290-- LRU Contxt Misses: 1987
--31290-- LRU BBCC Misses:   372
--31290-- LRU JCC Misses:    3141
--31290-- BBs Executed:      1776786
--31290-- Calls:             118594
--31290-- CondJMP followed:  0
--31290-- Boring JMPs:       0
--31290-- Recursive calls:   63
--31290-- Returns:           118594
--31290-- 
==31290== Events : Ir
==31290== Collected : 10463471
==31290== 
==31290== I refs:        10,463,471
--31290-- translate:            fast SP updates identified: 0 ( --%)
--31290-- translate:   generic_known SP updates identified: 0 ( --%)
--31290-- translate: generic_unknown SP updates identified: 0 ( --%)
--31290--     tt/tc: 20,206 tt lookups requiring 21,949 probes
--31290--     tt/tc: 20,206 fast-cache updates, 8 flushes
--31290-- transtab: new         9,286 (163,107 -> 1,111,174; ratio 68:10) \
     [0 scs]
--31290--  transtab: dumped     0 (0 -> ??)
--31290--  transtab: discarded  2,324 (34,320 -> ??)
--31290-- scheduler: 1,776,785 jumps (bb entries).
--31290-- scheduler: 17/11,301 major/minor sched events.
--31290--    sanity: 18 cheap, 2 expensive checks.
--31290--    exectx: 769 lists, 0 contexts (avg 0 per list)
--31290--    exectx: 0 searches, 0 full compares (0 per 1000)
--31290--    exectx: 0 cmp2, 0 cmp4, 0 cmpAll
--31290-- errormgr: 0 supplist searches, 0 comparisons during search
--31290-- errormgr: 0 errlist searches, 0 comparisons during search
The above code generated two files that can be loaded in kcachegrind to get \
     a visual representation.
kcachegrind callgrind.out.8244 &

The files get produced by call grind in the current directory, and are viewable with KCachegrind.