Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved tracing

  • Loading branch information...
commit 62b4c270f07992b8f8d0be24238482e8ac7dafb7 1 parent 0c79398
@makelinux authored
Showing with 18 additions and 13 deletions.
  1. +1 −1  Makefile
  2. +1 −10 ctracer.h
  3. +13 −2 ldt-test
  4. +3 −0  ldt.c
View
2  Makefile
@@ -34,4 +34,4 @@ endif
_src=dio.c ldt.c ldt_plat_dev.c ldt_plat_drv.c ctracer.h
checkpatch:
- checkpatch.pl --no-tree --show-types --ignore LONG_LINE,LINE_CONTINUATIONS --terse -f $(_src) Makefile
+ /usr/src/linux-headers-$(shell uname -r)/scripts/checkpatch.pl --no-tree --show-types --ignore LONG_LINE,LINE_CONTINUATIONS --terse -f $(_src) Makefile
View
11 ctracer.h
@@ -241,16 +241,7 @@ static inline int empty_function(void)
#ifdef MODULE
/* omit full absolute path for modules */
-static inline char *ctracer_file_name_no_path(char *fn)
-{
- char *strrchr(const char *s, int c);
-
- char *p = strrchr(fn, '/');
- if (p)
- return p + 1;
- return fn;
-}
-
+#define ctracer_file_name_no_path(fn) (fn[0] != '/' ? fn : (strrchr(fn, '/') + 1))
#define __file__ ctracer_file_name_no_path(__FILE__)
#else
#define __file__ __FILE__
View
15 ldt-test
@@ -14,7 +14,8 @@ GREEN="\\033[0;32m"
GRAY="\\033[0;37m"
set -o errtrace
-tracing=/sys/kernel/debug/tracing
+debugfs=`grep debugfs /proc/mounts | awk '{ print $2; }'`
+tracing=$debugfs/tracing
irq=0 # define irq to bind diriver to HW IRQ, WARING: can hung the system
irq=4 # serial port
# irq=`grep ehci_hcd /proc/interrupts | cut -f1 -d:`
@@ -28,19 +29,29 @@ tracing_start()
{
tracing "echo :mod:ldt > set_ftrace_filter"
tracing "echo function > current_tracer"
+ #tracing "echo function_graph > current_tracer"
tracing "echo 1 > function_profile_enabled"
+ #tracing "echo XXX > set_ftrace_notrace"
#sudo cat $tracing/current_tracer
#sudo cat $tracing/set_ftrace_filter
#sudo cat $tracing/function_profile_enabled
+ # available_filter_functions
+ # echo $$ > set_ftrace_pid
+
}
tracing_stop()
+
{
( echo Profiling data per CPU
tracing "cat trace_stat/function*" )> trace_stat.log && echo trace_stat.log saved
tracing "echo 0 > function_profile_enabled"
- tracing "echo nop > current_tracer"
sudo cp $tracing/trace ftrace.log && echo ftrace.log saved
+ sudo dd iflag=nonblock if=$tracing/trace_pipe 2> /dev/null > trace_pipe.log || true && echo trace_pipe.log saved
+ tracing "echo nop > current_tracer"
+ #export PYTHONPATH=/usr/src/linux-headers-$(uname -r)/scripts/tracing/
+ python /usr/src/linux-headers-$(uname -r)/scripts/tracing/draw_functrace.py \
+ < trace_pipe.log > functrace.log && echo functrace.log saved || true
}
# sudo rmmod parport_pc parport ppdev lp
View
3  ldt.c
@@ -503,6 +503,7 @@ static __devinit int ldt_probe(struct platform_device *pdev)
}
pages_flag(virt_to_page(out_buf), PFN_UP(bufsize), PG_reserved, 1);
if (pdev) {
+ dev_dbg(&pdev->dev, "%s:%d %s detaching driver\n", __file__, __LINE__, __func__);
data = pdev->dev.platform_data;
r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (r && !irq)
@@ -543,6 +544,8 @@ static __devinit int ldt_probe(struct platform_device *pdev)
static int __devexit ldt_remove(struct platform_device *pdev)
{
_entry:
+ if (pdev)
+ dev_dbg(&pdev->dev, "%s:%d %s detaching driver\n", __file__, __LINE__, __func__);
remove_proc_entry(KBUILD_MODNAME, NULL);
misc_deregister(&ldt_miscdev);
Please sign in to comment.
Something went wrong with that request. Please try again.