Last active
May 9, 2016 03:08
-
-
Save x2c3z4/1e756e845ab9e1dbfddb8aa9cfaa21ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
dtrace:::BEGIN | |
{ | |
num=0; | |
} | |
pid$target::di_init:entry | |
{ | |
self->ts = timestamp; | |
/* self->vts = vtimestamp; */ | |
} | |
pid$target::di_init:return | |
/self->ts/ | |
{ | |
/* printf("%d\n", timestamp - self->ts);*/ | |
@time[probefunc] = avg(timestamp - self->ts); | |
@ = quantize(timestamp - self->ts); | |
/*@c["On-CPU us:"] = lquantize((vtimestamp - self->vts) / 1000, 0, 10000, 10);*/ | |
self->ts = 0; | |
num++; | |
/*self->vts = 0;*/ | |
} | |
/* | |
fbt::sd_unit_attach:return | |
/self->ts == 0&& num >= $1/ | |
{ | |
exit(0); | |
} | |
*/ | |
/*tick-100s { exit(0); }*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
pid$target::di_init:entry, | |
pid$target::main:entry | |
{ | |
ts[probefunc] = timestamp; | |
/* self->vts = vtimestamp; */ | |
} | |
pid$target::main:return, | |
pid$target::di_init:return | |
/ts[probefunc]/ | |
{ | |
/* printf("%d\n", timestamp - self->ts);*/ | |
@time[probefunc] = sum(timestamp - ts[probefunc]); | |
/*@ = quantize(timestamp - ts[probefunc]);*/ | |
/*@c["On-CPU us:"] = lquantize((vtimestamp - self->vts) / 1000, 0, 10000, 10);*/ | |
ts[probefunc] = 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
#pragma D option flowindent | |
pid$target::main:entry | |
{ | |
self->trace = 1; | |
} | |
pid$target::main:return | |
/self->trace/ | |
{ | |
self->trace = 0; | |
} | |
pid$target:::entry, | |
pid$target:::return | |
/self->trace/ | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/dtrace -s | |
pid$target:::entry, | |
pid$target:::entry | |
{ | |
ts[probefunc] = timestamp; | |
/* self->vts = vtimestamp; */ | |
} | |
pid$target:::return, | |
pid$target:::return | |
/ts[probefunc]/ | |
{ | |
/* printf("%d\n", timestamp - self->ts);*/ | |
@time[probefunc] = sum(timestamp - ts[probefunc]); | |
/*@ = quantize(timestamp - ts[probefunc]);*/ | |
/*@c["On-CPU us:"] = lquantize((vtimestamp - self->vts) / 1000, 0, 10000, 10);*/ | |
ts[probefunc] = 0; | |
} |
dtrace -ln 'pid$target:::entry' -c "mpathadm list lu"
http://myaut.github.io/dtrace-stap-book/app/proc.html
http://www.mit.edu/course/13/13.715/jdk1.6.0_18/sample/dtrace/helpers/dtrace_helper.d
dynamic lib
dtrace -s ./user.d -Zc "mpathadm list lu"
dtrace -x stackframes=100 -n 'profile-997 /pid == $target/ { @[stack()] = count(); } tick-60s { exit(0); }' -c "mpathadm list lu" -o out.kern_stacks
dtrace -x ustackframes=100 -n 'profile-997 /pid == $target/ { @[ustack()] = count(); } tick-60s { exit(0); }' -c "mpathadm list lu" -o out.user_stacks
./stackcollapse.pl out.kern_stacks | ./flamegraph.pl >kern.svg
./stackcollapse.pl out.user_stacks | ./flamegraph.pl >user.svg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dtrace -s ./user.d -c "mpathadm list lu"