3 #Demo for thread-local variable
5 #Note this kind of function time tracing already handled concurrent issue,
6 #but not aware on the recursion problem, user need to aware this limitation,
7 #so don't use this script to trace function which could be called recursive.
15 printf("measure time(us) of function vfs_read\n");
17 trace probe:vfs_read {
18 if (execname() == "ktap") {
22 self[tid()] = gettimeofday_us()
25 trace probe:vfs_read%return {
26 if (execname() == "ktap") {
30 if (self[tid()] == nil) {
34 local durtion = gettimeofday_us() - self[tid()]
35 if (durtion > count_max) {
39 if (min == 0 || durtion < min) {
43 count_num = count_num + 1
44 total_time = total_time + durtion
50 printf("avg\tmax\tmin\n");
51 printf("-------------------\n")
53 printf("%d\t%d\t%d\n", total_time/count_num,