Add a stp file for usage from build directory
RFC 1/1 Add a stp file for usage from build directory
For systemtap the location of the process being tapped is crucial, so the existing stp file requires installation to use. A new file providing qemu.local prefixed probes lets scripts run without an install step.
---
Makefile.target | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Makefile.target +12 -1
@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak ifdef CONFIG_TRACE_SYSTEMTAP -stap: $(QEMU_PROG).stp +stap: $(QEMU_PROG).stp $(QEMU_PROG).local.stp ifdef CONFIG_USER_ONLY TARGET_TYPE=user
@@ -51,6 +51,17 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") + +$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events + $(call quiet-command,$(TRACETOOL) \ + --format=stap \ + --backend=$(TRACE_BACKEND) \ + --binary=$(SRC_PATH)/$(TARGET_DIR)$(QEMU_PROG) \ + --probe-prefix=qemu.local \ + --target-arch=$(TARGET_ARCH) \ + --target-type=$(TARGET_TYPE) \ + < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).local.stp") + else stap: endif
Signature · 1 line
1.8.2.1
Il 27/05/2013 04:19, Alon Levy ha scritto:
Quoted 24 lines
For systemtap the location of the process being tapped is crucial, so the existing stp file requires installation to use. A new file providing qemu.local prefixed probes lets scripts run without an install step.
Signed-off-by Alon Levy <[email protected]>---
Makefile.target | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)Makefile.target +1
-1@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak ifdef CONFIG_TRACE_SYSTEMTAP -stap: $(QEMU_PROG).stp +stap: $(QEMU_PROG).stp $(QEMU_PROG).local.stp ifdef CONFIG_USER_ONLY TARGET_TYPE=user
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 59
Quoted 9 lines
Makefile.target +6
-0@@ -51,6 +51,17 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") + +$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events + $(call quiet-command,$(TRACETOOL) \ + --format=stap \ + --backend=$(TRACE_BACKEND) \ + --binary=$(SRC_PATH)/$(TARGET_DIR)$(QEMU_PROG) \
This is not the build directory for out-of-tree builds.
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 60
Quoted 1 line
Makefile.target +1
-0+ --probe-prefix=qemu.local \
Why change the prefix?
Paolo
Quoted 8 lines
Makefile.target +4
-0+ --target-arch=$(TARGET_ARCH) \ + --target-type=$(TARGET_TYPE) \ + < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).local.stp") + else stap: endif
Quoted 22 lines · Paolo Bonzini
Il 27/05/2013 04:19, Alon Levy ha scritto:
Quoted 21 lines
For systemtap the location of the process being tapped is crucial, so the existing stp file requires installation to use. A new file providing qemu.local prefixed probes lets scripts run without an install step.
Signed-off-by Alon Levy <[email protected]>---
Makefile.target | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)Makefile.target +1
-1@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak ifdef CONFIG_TRACE_SYSTEMTAP -stap: $(QEMU_PROG).stp +stap: $(QEMU_PROG).stp $(QEMU_PROG).local.stp
Quoted 14 lines
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 59
Quoted 12 lines
Makefile.target +6
-0ifdef CONFIG_USER_ONLY TARGET_TYPE=user@@ -51,6 +51,17 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") + +$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events + $(call quiet-command,$(TRACETOOL) \ + --format=stap \ + --backend=$(TRACE_BACKEND) \ + --binary=$(SRC_PATH)/$(TARGET_DIR)$(QEMU_PROG) \This is not the build directory for out-of-tree builds.
I'll fix that.
Quoted 4 lines
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 60
Quoted 2 lines
Makefile.target +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
Quoted 13 lines
Paolo
Quoted 8 lines
Makefile.target +4
-0+ --target-arch=$(TARGET_ARCH) \ + --target-type=$(TARGET_TYPE) \ + < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).local.stp") + else stap: endif
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 9 lines
Quoted 3 lines
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 60
Quoted 1 line
Makefile.target +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
Paolo
Quoted 8 lines · Paolo Bonzini
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 7 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
It was one way to verify I was using the correct file. I'll change it back.
Quoted 6 lines
Quoted 2 lines
But in general does it make sense for you to have this in addition to the existing stp file?
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
I though it would be useful to have a bunch of scripts for developers. I have the following (didn't fix yet to use the same prefix):
scripts/stap-qxl-generic new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/bash -x +STP=$0.stp +ROOT=`dirname $0`/../ +sudo stap -v -I $ROOT/x86_64-softmmu $STP
scripts/stap-qxl-generic.stp new file +24 -0
@@ -0,0 +1,24 @@ +probe begin { printf("starting qxl generic probe\n") } + +global call, threads + +probe qemu.local.qxl* { + //printf("%d: %s: %s\n", tid(), pp(), $$vars) + //print_ubacktrace() + call[tid(), probefunc()] <<< 1 + threads[tid()] <<< 1 +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%10s %45s %s\n", "TID", "", "HITS"); + foreach([t] in threads-) { + printf("%10d %45s %d\n", t, "", @count(threads[t])); + } + printf("%10s %45s %s\n", + "TID", "CALL", "HITS") + foreach([tid, name] in call-) { + printf("%10d %45s %d\n", tid, name, + @count(call[tid, name])) + } +}
Quoted 4 lines
Paolo
Il 28/05/2013 14:33, Alon Levy ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 9 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
Quoted 6 lines
Quoted 3 lines
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
I though it would be useful to have a bunch of scripts for developers. I have the following (didn't fix yet to use the same prefix):
Ok, so it's just a matter of using the -I option to stap. That's the bit that has to be in the commit message.
Thanks!
Paolo
Quoted 48 lines
scripts/stap-qxl-generic new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/bash -x +STP=$0.stp +ROOT=`dirname $0`/../ +sudo stap -v -I $ROOT/x86_64-softmmu $STPscripts/stap-qxl-generic.stp new file +24
-0@@ -0,0 +1,24 @@ +probe begin { printf("starting qxl generic probe\n") } + +global call, threads + +probe qemu.local.qxl* { + //printf("%d: %s: %s\n", tid(), pp(), $$vars) + //print_ubacktrace() + call[tid(), probefunc()] <<< 1 + threads[tid()] <<< 1 +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%10s %45s %s\n", "TID", "", "HITS"); + foreach([t] in threads-) { + printf("%10d %45s %d\n", t, "", @count(threads[t])); + } + printf("%10s %45s %s\n", + "TID", "CALL", "HITS") + foreach([tid, name] in call-) { + printf("%10d %45s %d\n", tid, name, + @count(call[tid, name])) + } +}Quoted 6 lines
Paolo
Quoted 17 lines
Il 28/05/2013 14:33, Alon Levy ha scritto:
Quoted 16 lines · Paolo Bonzini
Quoted 14 lines
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 9 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
Quoted 5 lines
Quoted 2 lines
I though it would be useful to have a bunch of scripts for developers. I have the following (didn't fix yet to use the same prefix):
Ok, so it's just a matter of using the -I option to stap. That's the bit that has to be in the commit message.
Yes. Note that you add a directory, not a file. The only sure way to notice which hooks were used I found is looking at the generated c file.
Quoted 56 lines
Thanks!
Paolo
Quoted 48 lines
scripts/stap-qxl-generic new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/bash -x +STP=$0.stp +ROOT=`dirname $0`/../ +sudo stap -v -I $ROOT/x86_64-softmmu $STPscripts/stap-qxl-generic.stp new file +24
-0@@ -0,0 +1,24 @@ +probe begin { printf("starting qxl generic probe\n") } + +global call, threads + +probe qemu.local.qxl* { + //printf("%d: %s: %s\n", tid(), pp(), $$vars) + //print_ubacktrace() + call[tid(), probefunc()] <<< 1 + threads[tid()] <<< 1 +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%10s %45s %s\n", "TID", "", "HITS"); + foreach([t] in threads-) { + printf("%10d %45s %d\n", t, "", @count(threads[t])); + } + printf("%10s %45s %s\n", + "TID", "CALL", "HITS") + foreach([tid, name] in call-) { + printf("%10d %45s %d\n", tid, name, + @count(call[tid, name])) + } +}Quoted 6 lines
Paolo
Quoted 6 lines · Alon Levy
Quoted 6 lines
Il 28/05/2013 14:33, Alon Levy ha scritto:
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 3 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
Actually the problem is having two stp files (qemu-system-x86_64.stp & qemu-system-x86_64.local.stp) in the same directory providing the same probes is not workable with stap. In pass 2 it doesn't have any specific order of going through the directory. Solutions
1. have a different prefix
2. introduce another subdirectory x86_64-softmmu/local.stp/qemu-system-x86_64.stp
Quoted 76 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
Quoted 5 lines
Quoted 2 lines
I though it would be useful to have a bunch of scripts for developers. I have the following (didn't fix yet to use the same prefix):
Ok, so it's just a matter of using the -I option to stap. That's the bit that has to be in the commit message.
Yes. Note that you add a directory, not a file. The only sure way to notice which hooks were used I found is looking at the generated c file.
Quoted 56 lines
Thanks!
Paolo
Quoted 48 lines
scripts/stap-qxl-generic new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/bash -x +STP=$0.stp +ROOT=`dirname $0`/../ +sudo stap -v -I $ROOT/x86_64-softmmu $STPscripts/stap-qxl-generic.stp new file +24
-0@@ -0,0 +1,24 @@ +probe begin { printf("starting qxl generic probe\n") } + +global call, threads + +probe qemu.local.qxl* { + //printf("%d: %s: %s\n", tid(), pp(), $$vars) + //print_ubacktrace() + call[tid(), probefunc()] <<< 1 + threads[tid()] <<< 1 +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%10s %45s %s\n", "TID", "", "HITS"); + foreach([t] in threads-) { + printf("%10d %45s %d\n", t, "", @count(threads[t])); + } + printf("%10s %45s %s\n", + "TID", "CALL", "HITS") + foreach([tid, name] in call-) { + printf("%10d %45s %d\n", tid, name, + @count(call[tid, name])) + } +}Quoted 6 lines
Paolo
Il 28/05/2013 15:57, Alon Levy ha scritto:
Quoted 8 lines · Alon Levy
Quoted 6 lines
Quoted 6 lines
Il 28/05/2013 14:33, Alon Levy ha scritto:
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines
Il 28/05/2013 14:09, Alon Levy ha scritto:
Quoted 3 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
Quoted 7 lines
Actually the problem is having two stp files (qemu-system-x86_64.stp & qemu-system-x86_64.local.stp) in the same directory providing the same probes is not workable with stap. In pass 2 it doesn't have any specific order of going through the directory. Solutions
1. have a different prefix
2. introduce another subdirectory x86_64-softmmu/local.stp/qemu-system-x86_64.stp
Ah... that's a bit ugly. What about changing the name of the "installed" .stp file, for example x86_64-softmmu/qemu-system-x86_64.stp-installed and renaming it at "make install" time? The local file instead is built as x86_64-softmmu/qemu-system-x86_64.stp and is the only one that -I finds.
Paolo
Quoted 79 lines
Quoted 77 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
I think it does (with the same prefix so that you can share the scripts). But I'm not sure how you'd use it. :) Can you show an example and also put it in the commit message?
Quoted 5 lines
Quoted 2 lines
I though it would be useful to have a bunch of scripts for developers. I have the following (didn't fix yet to use the same prefix):
Ok, so it's just a matter of using the -I option to stap. That's the bit that has to be in the commit message.
Yes. Note that you add a directory, not a file. The only sure way to notice which hooks were used I found is looking at the generated c file.
Quoted 56 lines
Thanks!
Paolo
Quoted 48 lines
scripts/stap-qxl-generic new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/bash -x +STP=$0.stp +ROOT=`dirname $0`/../ +sudo stap -v -I $ROOT/x86_64-softmmu $STPscripts/stap-qxl-generic.stp new file +24
-0@@ -0,0 +1,24 @@ +probe begin { printf("starting qxl generic probe\n") } + +global call, threads + +probe qemu.local.qxl* { + //printf("%d: %s: %s\n", tid(), pp(), $$vars) + //print_ubacktrace() + call[tid(), probefunc()] <<< 1 + threads[tid()] <<< 1 +} + +probe timer.s(%( $# > 0 %? $1 %: 5 %)) { + ansi_clear_screen() + printf("%10s %45s %s\n", "TID", "", "HITS"); + foreach([t] in threads-) { + printf("%10d %45s %d\n", t, "", @count(threads[t])); + } + printf("%10s %45s %s\n", + "TID", "CALL", "HITS") + foreach([tid, name] in call-) { + printf("%10d %45s %d\n", tid, name, + @count(call[tid, name])) + } +}Quoted 6 lines
Paolo
Quoted 45 lines · Alon Levy
Quoted 22 lines · Paolo Bonzini
Il 27/05/2013 04:19, Alon Levy ha scritto:
Quoted 21 lines
For systemtap the location of the process being tapped is crucial, so the existing stp file requires installation to use. A new file providing qemu.local prefixed probes lets scripts run without an install step.
Signed-off-by Alon Levy <[email protected]>---
Makefile.target | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)Makefile.target +1
-1@@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak ifdef CONFIG_TRACE_SYSTEMTAP -stap: $(QEMU_PROG).stp +stap: $(QEMU_PROG).stp $(QEMU_PROG).local.stpQuoted 14 lines
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 59
Quoted 12 lines
Makefile.target +6
-0ifdef CONFIG_USER_ONLY TARGET_TYPE=user@@ -51,6 +51,17 @@ $(QEMU_PROG).stp: $(SRC_PATH)/trace-events --target-arch=$(TARGET_ARCH) \ --target-type=$(TARGET_TYPE) \ < $< > $@," GEN $(TARGET_DIR)$(QEMU_PROG).stp") + +$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events + $(call quiet-command,$(TRACETOOL) \ + --format=stap \ + --backend=$(TRACE_BACKEND) \ + --binary=$(SRC_PATH)/$(TARGET_DIR)$(QEMU_PROG) \This is not the build directory for out-of-tree builds.
I'll fix that.
Quoted 4 lines
Makefile.target $(QEMU_PROG).stp: $(SRC_PATH)/trace-events · line 60
Quoted 2 lines
Makefile.target +1
-0+ --probe-prefix=qemu.local \Why change the prefix?
Quoted 5 lines
It was one way to verify I was using the correct file. I'll change it back.
But in general does it make sense for you to have this in addition to the existing stp file?
Yes, I think it makes sense.
Stefan