[bprof] README: was missing in svn or got lost in translation



commit 675d023e9e852c1afb21afc26a3786b399395531
Author: Stefan Kost <ensonic users sf net>
Date:   Wed Jun 17 18:52:15 2009 +0300

    README: was missing in svn or got lost in translation

 README |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/README b/README
new file mode 100644
index 0000000..7d30f6a
--- /dev/null
+++ b/README
@@ -0,0 +1,75 @@
+= Overview =
+Idea is to do a LD_PRELOAD lib that tracks ressource allocations over time.
+Based on this log it will draw a graph per ressource type
+                                                          time
+      ¨------------------------------------------------------>
+      +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+100 k |
+      +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 64 k |    [--------]
+      | [---]
+      +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 40 k | [-]  [-]  [-]     [-]      [---]
+      +------------------------------------------------------>
+      |     ^
+      |  /^/  \    ^\
+      | /      ---/  \....
+      +------------------------------------------------------>
+
+== Implementation ==
+=== glib based ===
+The lib can do g_mem_set_vtable() in __init().
+The malloc and free implementations will track the lifetime of each buffer 
+(start and end timestamp). The address of the allocation serves as id.
+=== strace ===
+We could use strace (strace -r -e file) to get a simillar trace for file-ops.
+A hash of the filename could be used as id.
+
+== Problems ==
+* overlapping ressources with same id (mem-size, file-name)
+  * how to minimize the number of rows
+  * how to preserve patterns
+
+== Ideas ==
+* initialy the lib can log to a file and later we analyze the file
+  * better would be to log to a socket and one can analaze the pattern on the fly
+* the analyzer app could use a canvas
+* the logger-lib could also add backtraces for alloc and free
+* the ui could show the backtraces when selecting an allocation
+* the backtraces could help to make the pattern bands
+  (same backtrace + same size = same band)
+  
+== Testing ==
+=== getting a time plot ==
+G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-typefind-0.10 ~/.bashrc
+G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-inspect-0.10 fakesink
+G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-launch-0.10 fakesrc num-buffers=5 ! fakesink
+./mempattern-plot
+evince mp.ps &
+
+MP_LOG_START=0.1 G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-inspect-0.10 --gst-disable-registry-fork fakesink
+MP_LOG_START=0.3 G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-launch-0.10 --gst-disable-registry-fork videotestsrc num-buffers=50 ! fakesink
+./mempattern-plot "videotestsrc num-buffers=50 ! fakesink"
+MP_LOG_START=0.3 G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so gst-launch-0.10 --gst-disable-registry-fork videotestsrc num-buffers=50 ! xvimagesink sync=false
+./mempattern-plot "videotestsrc num-buffers=50 ! xvimagesink"
+
+
+== resort by allocation time ===
+sort -k2 /tmp/mp_time.log | more
+
+=== getting a alocation size histogramm ===
+sort -n /tmp/mp_time.log | cut -b-6 | uniq -c
+sort -n /tmp/mp_time.log | cut -b-6 | uniq -c | sort -n
+
+=== getting a fragmentation plot ==
+G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so ./gst-launch fakesrc ! fakesink
+killall -s 1 <pid>
+
+=== interactively tracing allocation of certain size ===
+MP_TRACE_SIZE=1 G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so ./gst-inspect fakesink
+
+== log backtraces for allocation of certain size ===
+MP_TRACE_SIZE=1 MP_TRACE_INTERACTIVE=0 G_SLICE=always-malloc G_DEBUG=gc-friendly LD_PRELOAD=libmempattern.so ./gst-inspect fakesink
+sort -n /tmp/mp_bt.log | uniq -c
+sort -n /tmp/mp_bt.log | uniq -c | sort -n
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]