Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 365aa51e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

staging: ktap: remove code from tree



ktap should be merged through the "proper" place in the kernel tree, in
the perf tool, not as a stand-alone kernel module in staging.  So remove
it from here for now so that it can be merged correctly later.

Reported-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Jovi Zhangwei <jovi.zhangwei@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9908b4f3
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -150,6 +150,4 @@ source "drivers/staging/dgnc/Kconfig"

source "drivers/staging/dgap/Kconfig"

source "drivers/staging/ktap/Kconfig"

endif # STAGING
+0 −1
Original line number Diff line number Diff line
@@ -67,4 +67,3 @@ obj-$(CONFIG_XILLYBUS) += xillybus/
obj-$(CONFIG_DGNC)			+= dgnc/
obj-$(CONFIG_DGAP)			+= dgap/
obj-$(CONFIG_MTD_SPINAND_MT29F)	+= mt29f_spinand/
obj-$(CONFIG_KTAP)		+= ktap/

drivers/staging/ktap/Kconfig

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
config KTAP
	tristate "a programable dynamic tracing tool for Linux"
	depends on PERF_EVENTS && EVENT_TRACING
	default n
	help
	  ktap is a new script-based dynamic tracing tool for Linux,
	  it uses a scripting language and lets users trace the
	  Linux kernel dynamically. ktap is designed to give
	  operational insights with interoperability that allow
	  users to tune, troubleshoot and extend kernel and application.
	  It's similar with Linux Systemtap and Solaris Dtrace.

	  ktap have different design principles from Linux mainstream
	  dynamic tracing language in that it's based on bytecode,
	  so it doesn't depend upon GCC, doesn't require compiling
	  kernel module for each script, safe to use in production
	  environment, fulfilling the embedded ecosystem's tracing needs.

	  See ktap tutorial for more information:
	      http://www.ktap.org/doc/tutorial.html

drivers/staging/ktap/Makefile

deleted100644 → 0
+0 −101
Original line number Diff line number Diff line

# Do not instrument the tracer itself:
ifdef CONFIG_FUNCTION_TRACER
ORIG_CFLAGS := $(KBUILD_CFLAGS)
KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
endif

all: mod ktap

INTP = interpreter

LIBDIR = $(INTP)/library

LIB_OBJS += $(LIBDIR)/baselib.o $(LIBDIR)/kdebug.o $(LIBDIR)/timer.o \
		$(LIBDIR)/ansilib.o

INTP_OBJS += $(INTP)/ktap.o $(INTP)/loader.o $(INTP)/object.o \
		$(INTP)/tstring.o $(INTP)/table.o $(INTP)/vm.o \
		$(INTP)/opcode.o $(INTP)/strfmt.o $(INTP)/transport.o \
		$(LIB_OBJS)

obj-m		+= ktapvm.o
ktapvm-y	:= $(INTP_OBJS)

KVERSION ?= $(shell uname -r)
KERNEL_SRC ?= /lib/modules/$(KVERSION)/build
mod:
	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules

modules_install:
	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules_install

KTAPC_CFLAGS = -Wall -O2

UDIR = userspace

$(UDIR)/lex.o: $(UDIR)/lex.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/parser.o: $(UDIR)/parser.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/code.o: $(UDIR)/code.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/dump.o: $(UDIR)/dump.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/main.o: $(UDIR)/main.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/util.o: $(UDIR)/util.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/ktapio.o: $(UDIR)/ktapio.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/eventdef.o: $(UDIR)/eventdef.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/opcode.o: $(INTP)/opcode.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/table.o: $(INTP)/table.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/tstring.o: $(INTP)/tstring.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
$(UDIR)/object.o: $(INTP)/object.c
	$(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<

KTAPOBJS =
KTAPOBJS += $(UDIR)/lex.o
KTAPOBJS += $(UDIR)/parser.o
KTAPOBJS += $(UDIR)/code.o
KTAPOBJS += $(UDIR)/dump.o
KTAPOBJS += $(UDIR)/main.o
KTAPOBJS += $(UDIR)/util.o
KTAPOBJS += $(UDIR)/ktapio.o
KTAPOBJS += $(UDIR)/eventdef.o
KTAPOBJS += $(UDIR)/opcode.o
KTAPOBJS += $(UDIR)/table.o
KTAPOBJS += $(UDIR)/tstring.o
KTAPOBJS += $(UDIR)/object.o

ktap: $(KTAPOBJS)
	$(QUIET_LINK)$(CC) $(KTAPC_CFLAGS) -o $@ $(KTAPOBJS) -lpthread

KMISC := /lib/modules/$(KVERSION)/ktapvm/

install: mod ktap
	install -d $(KMISC)
	install -m 644 -c *.ko /lib/modules/$(KVERSION)/ktapvm/
	/sbin/depmod -a

load:
	insmod ktapvm.ko

unload:
	rmmod ktapvm

test: FORCE
	cd test; sh ./run_test.sh; cd -

clean:
	$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
	$(RM) ktap

PHONY += FORCE
FORCE:

drivers/staging/ktap/README.md

deleted100644 → 0
+0 −144
Original line number Diff line number Diff line
# ktap

A New Scripting Dynamic Tracing Tool For Linux  
[www.ktap.org][homepage]

ktap is a new scripting dynamic tracing tool for Linux,
it uses a scripting language and lets users trace the Linux kernel dynamically.
ktap is designed to give operational insights with interoperability
that allows users to tune, troubleshoot and extend kernel and application.
It's similar with Linux Systemtap and Solaris Dtrace.

ktap have different design principles from Linux mainstream dynamic tracing
language in that it's based on bytecode, so it doesn't depend upon GCC,
doesn't require compiling kernel module for each script, safe to use in
production environment, fulfilling the embedded ecosystem's tracing needs.

More information can be found at [ktap homepage][homepage].

[homepage]: http://www.ktap.org

## Highlights

  * simple but powerful scripting language
  * register based interpreter (heavily optimized) in Linux kernel
  * small and lightweight (6KLOC of interpreter)
  * not depend on gcc for each script running
  * easy to use in embedded environment without debugging info
  * support for tracepoint, kprobe, uprobe, function trace, timer, and more
  * supported in x86, arm, ppc, mips
  * safety in sandbox

## Building & Running

1. Clone ktap from github

        $ git clone http://github.com/ktap/ktap.git

2. Compiling ktap

        $ cd ktap
        $ make       #generate ktapvm kernel module and ktap binary

3. Load ktapvm kernel module(make sure debugfs mounted)

        $ make load  #need to be root or have sudo access

4. Running ktap

        $ ./ktap scripts/helloworld.kp


## Examples

1. simplest one-liner command to enable all tracepoints

        ktap -e "trace *:* { print(argevent) }"

2. syscall tracing on target process

        ktap -e "trace syscalls:* { print(argevent) }" -- ls

3. function tracing

        ktap -e "trace ftrace:function { print(argevent) }"

        ktap -e "trace ftrace:function /ip==mutex*/ { print(argevent) }"

4. simple syscall tracing

        trace syscalls:* {
                print(cpu(), pid(), execname(), argevent)
        }

5. syscall tracing in histogram style

        s = {}

        trace syscalls:sys_enter_* {
                s[argname] += 1
        }

        trace_end {
                histogram(s)
        }

6. kprobe tracing

        trace probe:do_sys_open dfd=%di fname=%dx flags=%cx mode=+4($stack) {
                print("entry:", execname(), argevent)
        }

        trace probe:do_sys_open%return fd=$retval {
                print("exit:", execname(), argevent)
        }

7. uprobe tracing

        trace probe:/lib/libc.so.6:0x000773c0 {
                print("entry:", execname(), argevent)
        }

        trace probe:/lib/libc.so.6:0x000773c0%return {
                print("exit:", execname(), argevent)
        }

8. timer

        tick-1ms {
                printf("time fired on one cpu\n");
        }

        profile-2s {
                printf("time fired on every cpu\n");
        }

More sample scripts can be found at scripts/ directory.

## Mailing list

ktap@freelists.org  
You can subscribe to ktap mailing list at link (subscribe before posting):
http://www.freelists.org/list/ktap


## Copyright and License

ktap is licensed under GPL v2

Copyright (C) 2012-2013, Jovi Zhangwei <jovi.zhangwei@gmail.com>.
All rights reserved.  


## Contribution

ktap is still under active development, so contributions are welcome.
You are encouraged to report bugs, provide feedback, send feature request,
or hack on it.


## See More

More info can be found at [documentation][tutorial]
[tutorial]: http://www.ktap.org/doc/tutorial.html
Loading